diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-11-06 12:20:26 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-01 11:16:57 -0800 |
commit | 96f5ae7cb886a3312d1718133e25e0e9b565179d (patch) | |
tree | f326b374315cc214849f692d12e51688f74761bf /src/mbgl | |
parent | 4dc4eef83e67f91b66ff22eb27b120ed753c48a2 (diff) | |
download | qtlocation-mapboxgl-96f5ae7cb886a3312d1718133e25e0e9b565179d.tar.gz |
[core] Don't share Style& across threads
Diffstat (limited to 'src/mbgl')
-rw-r--r-- | src/mbgl/map/tile_worker.cpp | 24 | ||||
-rw-r--r-- | src/mbgl/map/tile_worker.hpp | 12 | ||||
-rw-r--r-- | src/mbgl/map/vector_tile_data.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/style/style_bucket_parameters.hpp | 4 |
4 files changed, 26 insertions, 18 deletions
diff --git a/src/mbgl/map/tile_worker.cpp b/src/mbgl/map/tile_worker.cpp index 9686d579ae..f591d138d9 100644 --- a/src/mbgl/map/tile_worker.cpp +++ b/src/mbgl/map/tile_worker.cpp @@ -1,7 +1,6 @@ #include <mbgl/text/collision_tile.hpp> #include <mbgl/map/tile_worker.hpp> #include <mbgl/map/geometry_tile.hpp> -#include <mbgl/style/style.hpp> #include <mbgl/style/style_layer.hpp> #include <mbgl/style/style_bucket_parameters.hpp> #include <mbgl/sprite/sprite_atlas.hpp> @@ -15,16 +14,20 @@ using namespace mbgl; TileWorker::TileWorker(TileID id_, std::string sourceID_, - Style& style_, + SpriteStore& spriteStore_, + GlyphAtlas& glyphAtlas_, + GlyphStore& glyphStore_, const std::atomic<TileData::State>& state_) : id(id_), sourceID(sourceID_), - style(style_), + spriteStore(spriteStore_), + glyphAtlas(glyphAtlas_), + glyphStore(glyphStore_), state(state_) { } TileWorker::~TileWorker() { - style.glyphAtlas->removeGlyphs(reinterpret_cast<uintptr_t>(this)); + glyphAtlas.removeGlyphs(reinterpret_cast<uintptr_t>(this)); } TileParseResult TileWorker::parseAllLayers(std::vector<util::ptr<StyleLayer>> layers, @@ -63,11 +66,13 @@ TileParseResult TileWorker::parsePendingLayers() { if (layer.type == StyleLayerType::Symbol) { auto symbolBucket = dynamic_cast<SymbolBucket*>(bucket.get()); - if (!symbolBucket->needsDependencies(*style.glyphStore, *style.spriteStore)) { + if (!symbolBucket->needsDependencies(glyphStore, spriteStore)) { const SymbolLayer* symbolLayer = dynamic_cast<const SymbolLayer*>(&layer); symbolBucket->addFeatures(reinterpret_cast<uintptr_t>(this), *symbolLayer->spriteAtlas, - *style.glyphAtlas, *style.glyphStore, *collisionTile); + glyphAtlas, + glyphStore, + *collisionTile); insertBucket(layer.bucketName(), std::move(bucket)); pending.erase(it++); continue; @@ -130,10 +135,9 @@ void TileWorker::parseLayer(const StyleLayer& layer, const GeometryTile& geometr state, reinterpret_cast<uintptr_t>(this), partialParse, - *style.spriteAtlas, - *style.spriteStore, - *style.glyphAtlas, - *style.glyphStore, + spriteStore, + glyphAtlas, + glyphStore, *collisionTile); std::unique_ptr<Bucket> bucket = layer.createBucket(parameters); diff --git a/src/mbgl/map/tile_worker.hpp b/src/mbgl/map/tile_worker.hpp index ee94f756ed..110948b169 100644 --- a/src/mbgl/map/tile_worker.hpp +++ b/src/mbgl/map/tile_worker.hpp @@ -18,7 +18,9 @@ namespace mbgl { class CollisionTile; class GeometryTile; -class Style; +class SpriteStore; +class GlyphAtlas; +class GlyphStore; class Bucket; class StyleLayer; @@ -37,7 +39,9 @@ class TileWorker : public util::noncopyable { public: TileWorker(TileID, std::string sourceID, - Style&, + SpriteStore&, + GlyphAtlas&, + GlyphStore&, const std::atomic<TileData::State>&); ~TileWorker(); @@ -58,7 +62,9 @@ private: const TileID id; const std::string sourceID; - Style& style; + SpriteStore& spriteStore; + GlyphAtlas& glyphAtlas; + GlyphStore& glyphStore; const std::atomic<TileData::State>& state; bool partialParse = false; diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp index 2ec0085585..53bd941be5 100644 --- a/src/mbgl/map/vector_tile_data.cpp +++ b/src/mbgl/map/vector_tile_data.cpp @@ -20,7 +20,9 @@ VectorTileData::VectorTileData(const TileID& id_, worker(style_.workers), tileWorker(id_, sourceID, - style_, + *style_.spriteStore, + *style_.glyphAtlas, + *style_.glyphStore, state), monitor(std::move(monitor_)) { diff --git a/src/mbgl/style/style_bucket_parameters.hpp b/src/mbgl/style/style_bucket_parameters.hpp index c27d1287b2..1650ddab8a 100644 --- a/src/mbgl/style/style_bucket_parameters.hpp +++ b/src/mbgl/style/style_bucket_parameters.hpp @@ -11,7 +11,6 @@ namespace mbgl { class TileID; class GeometryTileLayer; class GeometryTileFeature; -class SpriteAtlas; class SpriteStore; class GlyphAtlas; class GlyphStore; @@ -24,7 +23,6 @@ public: const std::atomic<TileData::State>& state_, uintptr_t tileUID_, bool& partialParse_, - SpriteAtlas& spriteAtlas_, SpriteStore& spriteStore_, GlyphAtlas& glyphAtlas_, GlyphStore& glyphStore_, @@ -34,7 +32,6 @@ public: state(state_), tileUID(tileUID_), partialParse(partialParse_), - spriteAtlas(spriteAtlas_), spriteStore(spriteStore_), glyphAtlas(glyphAtlas_), glyphStore(glyphStore_), @@ -51,7 +48,6 @@ public: const std::atomic<TileData::State>& state; uintptr_t tileUID; bool& partialParse; - SpriteAtlas& spriteAtlas; SpriteStore& spriteStore; GlyphAtlas& glyphAtlas; GlyphStore& glyphStore; |