diff options
author | artemp <artem@mapnik.org> | 2014-10-29 14:35:58 -0400 |
---|---|---|
committer | artemp <artem@mapnik.org> | 2014-10-29 14:37:13 -0400 |
commit | 6622a07ad88c7ca2eb34db66cc46f416f7b5286f (patch) | |
tree | eb42b5f18872a1c3a8c6179e1e029c05cb85630f /src | |
parent | 2607a755afd347eba0c1422b77603b8ddcb097c6 (diff) | |
download | qtlocation-mapboxgl-6622a07ad88c7ca2eb34db66cc46f416f7b5286f.tar.gz |
simplify - remove before/afterParse and create Parser on stack in worker thread
Diffstat (limited to 'src')
-rw-r--r-- | src/map/tile_data.cpp | 10 | ||||
-rw-r--r-- | src/map/vector_tile_data.cpp | 12 |
2 files changed, 5 insertions, 17 deletions
diff --git a/src/map/tile_data.cpp b/src/map/tile_data.cpp index 7e4d1a1de1..bb3573ce2d 100644 --- a/src/map/tile_data.cpp +++ b/src/map/tile_data.cpp @@ -79,11 +79,8 @@ void TileData::cancel() { } } -void TileData::beforeParse() {} - -void TileData::reparse() { - beforeParse(); - +void TileData::reparse() +{ // We're creating a new work request. The work request deletes itself after it executed // the after work handler new uv::work<util::ptr<TileData>>( @@ -92,10 +89,7 @@ void TileData::reparse() { tile->parse(); }, [](util::ptr<TileData> &tile) { - tile->afterParse(); tile->map.update(); }, shared_from_this()); } - -void TileData::afterParse() {} diff --git a/src/map/vector_tile_data.cpp b/src/map/vector_tile_data.cpp index 4d9d2a5441..80ad3a3fce 100644 --- a/src/map/vector_tile_data.cpp +++ b/src/map/vector_tile_data.cpp @@ -17,10 +17,6 @@ VectorTileData::~VectorTileData() { map.getGlyphAtlas().removeGlyphs(id.to_uint64()); } -void VectorTileData::beforeParse() { - parser = std::make_unique<TileParser>(data, *this, map.getStyle(), map.getGlyphAtlas(), - map.getGlyphStore(), map.getSpriteAtlas(), map.getSprite()); -} void VectorTileData::parse() { if (state != State::loaded) { @@ -31,7 +27,9 @@ void VectorTileData::parse() { // Parsing creates state that is encapsulated in TileParser. While parsing, // the TileParser object writes results into this objects. All other state // is going to be discarded afterwards. - parser->parse(); + TileParser parser(data, *this, map.getStyle(), map.getGlyphAtlas(), + map.getGlyphStore(), map.getSpriteAtlas(), map.getSprite()); + parser.parse(); } catch (const std::exception& ex) { #if defined(DEBUG) fprintf(stderr, "[%p] exception [%d/%d/%d]... failed: %s\n", this, id.z, id.x, id.y, ex.what()); @@ -45,10 +43,6 @@ void VectorTileData::parse() { } } -void VectorTileData::afterParse() { - parser.reset(); -} - void VectorTileData::render(Painter &painter, util::ptr<StyleLayer> layer_desc, const mat4 &matrix) { if (state == State::parsed && layer_desc->bucket) { auto databucket_it = buckets.find(layer_desc->bucket->name); |