From 074d61a55e32e83173ec12b2eb34b78ddaaf0ef1 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Wed, 14 Oct 2015 22:39:42 -0700 Subject: [PATCH] [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. --- src/mbgl/map/map_context.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index 977dcf92a..a383e6035 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -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;