From 1da2c3f840c83cab72a94c7af29bfc1da2f4d9bd Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 1 Jul 2015 17:38:49 -0700 Subject: Remove unnecessary virtual methods from TileData --- src/mbgl/map/raster_tile_data.cpp | 5 ----- src/mbgl/map/raster_tile_data.hpp | 4 +--- src/mbgl/map/source.cpp | 16 +++++++++------- src/mbgl/map/tile_data.hpp | 9 --------- src/mbgl/map/vector_tile_data.hpp | 4 ++-- 5 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/mbgl/map/raster_tile_data.cpp b/src/mbgl/map/raster_tile_data.cpp index 837f4c0f1b..b0fa4d171b 100644 --- a/src/mbgl/map/raster_tile_data.cpp +++ b/src/mbgl/map/raster_tile_data.cpp @@ -60,11 +60,6 @@ void RasterTileData::request(float pixelRatio, }); } -bool RasterTileData::reparse(std::function) { - assert(false); - return false; -} - Bucket* RasterTileData::getBucket(StyleLayer const&) { return &bucket; } diff --git a/src/mbgl/map/raster_tile_data.hpp b/src/mbgl/map/raster_tile_data.hpp index ce0286f5a0..93d018bced 100644 --- a/src/mbgl/map/raster_tile_data.hpp +++ b/src/mbgl/map/raster_tile_data.hpp @@ -19,9 +19,7 @@ public: ~RasterTileData(); void request(float pixelRatio, - const std::function& callback) override; - - bool reparse(std::function callback) override; + const std::function& callback); void cancel() override; diff --git a/src/mbgl/map/source.cpp b/src/mbgl/map/source.cpp index f468ab33ed..7b6a35ed2a 100644 --- a/src/mbgl/map/source.cpp +++ b/src/mbgl/map/source.cpp @@ -290,18 +290,20 @@ TileData::State Source::addTile(MapData& data, // If we don't find working tile data, we're just going to load it. if (info.type == SourceType::Vector) { - new_tile.data = - std::make_shared(normalized_id, style, info, + auto tileData = std::make_shared(normalized_id, style, info, transformState.getAngle(), data.getCollisionDebug()); - new_tile.data->request(transformState.getPixelRatio(), callback); + tileData->request(transformState.getPixelRatio(), callback); + new_tile.data = tileData; } else if (info.type == SourceType::Raster) { - new_tile.data = std::make_shared(normalized_id, texturePool, info, style.workers); - new_tile.data->request(transformState.getPixelRatio(), callback); + auto tileData = std::make_shared(normalized_id, texturePool, info, style.workers); + tileData->request(transformState.getPixelRatio(), callback); + new_tile.data = tileData; } else if (info.type == SourceType::Annotations) { - new_tile.data = std::make_shared(normalized_id, data.annotationManager, + auto tileData = std::make_shared(normalized_id, data.annotationManager, style, info, transformState.getAngle(), data.getCollisionDebug()); - new_tile.data->reparse(callback); + tileData->reparse(callback); + new_tile.data = tileData; } else { throw std::runtime_error("source type not implemented"); } diff --git a/src/mbgl/map/tile_data.hpp b/src/mbgl/map/tile_data.hpp index 5525256957..476172ce55 100644 --- a/src/mbgl/map/tile_data.hpp +++ b/src/mbgl/map/tile_data.hpp @@ -70,15 +70,6 @@ public: TileData(const TileID&); virtual ~TileData() = default; - virtual void request(float pixelRatio, - const std::function& callback) = 0; - - // Schedule a tile reparse on a worker thread and call the callback on - // completion. It will return true if the work was schedule or false it was - // not, which can occur if the tile is already being parsed by another - // worker. - virtual bool reparse(std::function callback) = 0; - // Mark this tile as no longer needed and cancel any pending work. virtual void cancel() = 0; diff --git a/src/mbgl/map/vector_tile_data.hpp b/src/mbgl/map/vector_tile_data.hpp index a035015f4d..b0b5ec6e89 100644 --- a/src/mbgl/map/vector_tile_data.hpp +++ b/src/mbgl/map/vector_tile_data.hpp @@ -29,9 +29,9 @@ public: size_t countBuckets() const; void request(float pixelRatio, - const std::function& callback) override; + const std::function& callback); - bool reparse(std::function callback) override; + virtual bool reparse(std::function callback); void redoPlacement(float angle, bool collisionDebug) override; -- cgit v1.2.1