[core] Convert uses of std::set to std::unordered_set (#6325)
* src/mbgl/annotation/annotation_manager.hpp * src/mbgl/algorithm/update_renderables.hpp * src/mbgl/geometry/glyph_atlas.hpp * src/mbgl/renderer/painter.cpp and src/mbgl/renderer/render_item.hpp * src/mbgl/renderer/symbol_bucket.hpp and src/mbgl/text/glyph_store.hpp * src/mbgl/sprite/sprite_atlas.hpp * include/mbgl/storage/network_status.hpp * src/mbgl/text/collision_tile.cpp * src/mbgl/style/update_batch.hpp * platform/default/mbgl/storage/offline_download.hpp * Add GlyphRangeSet typedef * Fix whitespace & unused imports
This commit is contained in:
committed by
John Firebaugh
parent
79708ff9d8
commit
37cb2bd756
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
private:
|
||||
static std::atomic<bool> online;
|
||||
static std::mutex mtx;
|
||||
static std::set<util::AsyncTask*> observers;
|
||||
static std::unordered_set<util::AsyncTask*> observers;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <mbgl/storage/offline.hpp>
|
||||
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <memory>
|
||||
|
||||
namespace mbgl {
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
OfflineRegionStatus status;
|
||||
std::unique_ptr<OfflineRegionObserver> observer;
|
||||
std::list<std::unique_ptr<AsyncRequest>> requests;
|
||||
std::set<std::string> requiredSourceURLs;
|
||||
std::unordered_set<std::string> requiredSourceURLs;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <mbgl/util/range.hpp>
|
||||
#include <mbgl/storage/resource.hpp>
|
||||
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace mbgl {
|
||||
namespace algorithm {
|
||||
@@ -21,7 +21,7 @@ void updateRenderables(GetTileFn getTile,
|
||||
const IdealTileIDs& idealTileIDs,
|
||||
const Range<uint8_t>& zoomRange,
|
||||
const uint8_t dataTileZoom) {
|
||||
std::set<UnwrappedTileID> checked;
|
||||
std::unordered_set<UnwrappedTileID> checked;
|
||||
bool covered;
|
||||
int32_t overscaledZ;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace mbgl {
|
||||
@@ -72,8 +72,8 @@ private:
|
||||
SymbolAnnotationTree symbolTree;
|
||||
SymbolAnnotationMap symbolAnnotations;
|
||||
ShapeAnnotationMap shapeAnnotations;
|
||||
std::set<std::string> obsoleteShapeAnnotationLayers;
|
||||
std::set<AnnotationTile*> tiles;
|
||||
std::unordered_set<std::string> obsoleteShapeAnnotationLayers;
|
||||
std::unordered_set<AnnotationTile*> tiles;
|
||||
SpriteAtlas spriteAtlas;
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
namespace mbgl {
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
bool sdfIcons = false;
|
||||
bool iconsNeedLinear = false;
|
||||
|
||||
std::set<GlyphRange> ranges;
|
||||
GlyphRangeSet ranges;
|
||||
std::vector<SymbolInstance> symbolInstances;
|
||||
std::vector<SymbolFeature> features;
|
||||
};
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
@@ -80,7 +81,7 @@ void Painter::render(const Style& style, const FrameData& frame_, SpriteAtlas& a
|
||||
|
||||
RenderData renderData = style.getRenderData(frame.debugOptions);
|
||||
const std::vector<RenderItem>& order = renderData.order;
|
||||
const std::set<Source*>& sources = renderData.sources;
|
||||
const std::unordered_set<Source*>& sources = renderData.sources;
|
||||
const Color& background = renderData.backgroundColor;
|
||||
|
||||
// Update the default matrices to the current viewport dimensions.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <mbgl/util/color.hpp>
|
||||
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
namespace mbgl {
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
class RenderData {
|
||||
public:
|
||||
Color backgroundColor;
|
||||
std::set<style::Source*> sources;
|
||||
std::unordered_set<style::Source*> sources;
|
||||
std::vector<RenderItem> order;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <mbgl/style/layers/symbol_layer_properties.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
@@ -140,7 +140,7 @@ private:
|
||||
std::recursive_mutex mtx;
|
||||
BinPack<dimension> bin;
|
||||
std::map<Key, Holder> images;
|
||||
std::set<std::string> uninitialized;
|
||||
std::unordered_set<std::string> uninitialized;
|
||||
std::unique_ptr<uint32_t[]> data;
|
||||
std::atomic<bool> dirtyFlag;
|
||||
bool fullUploadRequired = true;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace mbgl {
|
||||
|
||||
std::atomic<bool> NetworkStatus::online(true);
|
||||
std::mutex NetworkStatus::mtx;
|
||||
std::set<util::AsyncTask *> NetworkStatus::observers;
|
||||
std::unordered_set<util::AsyncTask *> NetworkStatus::observers;
|
||||
|
||||
NetworkStatus::Status NetworkStatus::Get() {
|
||||
if (online) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <string>
|
||||
|
||||
namespace mbgl {
|
||||
@@ -8,7 +8,7 @@ namespace style {
|
||||
|
||||
class UpdateBatch {
|
||||
public:
|
||||
std::set<std::string> sourceIDs;
|
||||
std::unordered_set<std::string> sourceIDs;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
|
||||
@@ -156,7 +156,7 @@ Box CollisionTile::getTreeBox(const Point<float>& anchor, const CollisionBox& bo
|
||||
std::vector<IndexedSubfeature> CollisionTile::queryRenderedSymbols(const mapbox::geometry::box<int16_t>& box, const float scale) {
|
||||
|
||||
std::vector<IndexedSubfeature> result;
|
||||
std::unordered_map<std::string, std::set<std::size_t>> sourceLayerFeatures;
|
||||
std::unordered_map<std::string, std::unordered_set<std::size_t>> sourceLayerFeatures;
|
||||
|
||||
auto anchor = util::matrixMultiply(rotationMatrix, convertPoint<float>(box.min));
|
||||
CollisionBox queryBox(anchor, 0, 0, box.max.x - box.min.x, box.max.y - box.min.y, scale);
|
||||
|
||||
@@ -39,7 +39,7 @@ void GlyphAtlas::requestGlyphRange(const FontStack& fontStack, const GlyphRange&
|
||||
std::make_unique<GlyphPBF>(this, fontStack, range, observer, fileSource));
|
||||
}
|
||||
|
||||
bool GlyphAtlas::hasGlyphRanges(const FontStack& fontStack, const std::set<GlyphRange>& glyphRanges) {
|
||||
bool GlyphAtlas::hasGlyphRanges(const FontStack& fontStack, const GlyphRangeSet& glyphRanges) {
|
||||
if (glyphRanges.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
#include <mutex>
|
||||
#include <exception>
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
// made and when the glyph if finally parsed, it gets added to the respective
|
||||
// GlyphSet and a signal is emitted to notify the observers. This method
|
||||
// can be called from any thread.
|
||||
bool hasGlyphRanges(const FontStack&, const std::set<GlyphRange>&);
|
||||
bool hasGlyphRanges(const FontStack&, const GlyphRangeSet&);
|
||||
|
||||
void setURL(const std::string &url) {
|
||||
glyphURL = url;
|
||||
@@ -95,7 +95,7 @@ private:
|
||||
GlyphValue(Rect<uint16_t> rect_, uintptr_t id)
|
||||
: rect(std::move(rect_)), ids({ id }) {}
|
||||
Rect<uint16_t> rect;
|
||||
std::set<uintptr_t> ids;
|
||||
std::unordered_set<uintptr_t> ids;
|
||||
};
|
||||
|
||||
std::mutex mtx;
|
||||
|
||||
@@ -2,9 +2,19 @@
|
||||
|
||||
#include <utility>
|
||||
#include <cstdint>
|
||||
#include <unordered_set>
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
typedef std::pair<uint16_t, uint16_t> GlyphRange;
|
||||
|
||||
struct GlyphRangeHash {
|
||||
std::size_t operator()(const GlyphRange& glyphRange) const {
|
||||
return boost::hash_value(glyphRange);
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::unordered_set<GlyphRange, GlyphRangeHash> GlyphRangeSet;
|
||||
|
||||
} // end namespace mbgl
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
StubStyleObserver observer;
|
||||
GlyphAtlas glyphAtlas { 32, 32, fileSource };
|
||||
|
||||
void run(const std::string& url, const FontStack& fontStack, const std::set<GlyphRange>& glyphRanges) {
|
||||
void run(const std::string& url, const FontStack& fontStack, const GlyphRangeSet& glyphRanges) {
|
||||
// Squelch logging.
|
||||
Log::setObserver(std::make_unique<Log::NullObserver>());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user