diff options
Diffstat (limited to 'src/mbgl/map/backend_scope.cpp')
-rw-r--r-- | src/mbgl/map/backend_scope.cpp | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/mbgl/map/backend_scope.cpp b/src/mbgl/map/backend_scope.cpp deleted file mode 100644 index 824ad4498b..0000000000 --- a/src/mbgl/map/backend_scope.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include <mbgl/map/backend_scope.hpp> -#include <mbgl/map/backend.hpp> -#include <mbgl/util/thread_local.hpp> - -#include <cassert> - -namespace mbgl { - -static util::ThreadLocal<BackendScope> currentScope; - -BackendScope::BackendScope(Backend& backend_, ScopeType scopeType_) - : priorScope(currentScope.get()), - nextScope(nullptr), - backend(backend_), - scopeType(scopeType_) { - if (priorScope) { - assert(priorScope->nextScope == nullptr); - priorScope->nextScope = this; - } - if (scopeType == ScopeType::Explicit) { - backend.activate(); - } - - currentScope.set(this); -} - -BackendScope::~BackendScope() { - assert(nextScope == nullptr); - if (priorScope) { - priorScope->backend.activate(); - currentScope.set(priorScope); - assert(priorScope->nextScope == this); - priorScope->nextScope = nullptr; - } else { - if (scopeType == ScopeType::Explicit) { - backend.deactivate(); - } - - currentScope.set(nullptr); - } -} - -bool BackendScope::exists() { - return currentScope.get(); -} - -} // namespace mbgl |