[core] MapContext setStyle{URL,JSON} should ignore redundant calls

Our engine should be robust enough to ignore redundant calls and avoid
triggering a whole style update if the style URL and/or JSON are the
same.
This commit is contained in:
Bruno de Oliveira Abinader
2015-10-14 22:39:42 -07:00
parent e63fb44499
commit 074d61a55e

View File

@@ -92,6 +92,10 @@ void MapContext::triggerUpdate(const TransformState& state, const Update flags)
}
void MapContext::setStyleURL(const std::string& url) {
if (styleURL == url) {
return;
}
FileSource* fs = util::ThreadContext::getFileSource();
if (styleRequest) {
@@ -121,6 +125,10 @@ void MapContext::setStyleURL(const std::string& url) {
}
void MapContext::setStyleJSON(const std::string& json, const std::string& base) {
if (styleJSON == json) {
return;
}
styleURL.clear();
styleJSON = json;