Notify data changes using Observer pattern

This pattern, in contrast with callbacks, allows us to clearly see
the dependency and hierarchy between the objects. It will also help
on writing unit tests as we can count how many times a notification
was triggered.
This commit is contained in:
Thiago Marcos P. Santos
2015-04-21 14:33:14 +02:00
parent 4956da61b9
commit f4baa0ba3e
5 changed files with 64 additions and 24 deletions

View File

@@ -168,10 +168,7 @@ void MapContext::updateTiles() {
if (!style) return;
for (const auto& source : style->sources) {
source->update(data, transformState, *style, *glyphAtlas, *glyphStore, *spriteAtlas,
getSprite(), *texturePool, [this]() {
assert(Environment::currentlyOn(ThreadType::Map));
triggerUpdate();
});
getSprite(), *texturePool);
}
}