diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-10-16 16:14:55 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-10-26 15:54:27 +0100 |
commit | 5173bf1bb8d21054b0dd6251d23eb37323d6c525 (patch) | |
tree | d13536c22b8279e9fd7e8f4892596c42973170f3 /src/mbgl/text | |
parent | 4e3503ea6cf30c55a2cc86f78c4a607bd14f1c41 (diff) | |
download | qtlocation-mapboxgl-5173bf1bb8d21054b0dd6251d23eb37323d6c525.tar.gz |
[core] Make response data shared to avoid excessive copying
Diffstat (limited to 'src/mbgl/text')
-rw-r--r-- | src/mbgl/text/glyph_pbf.cpp | 5 | ||||
-rw-r--r-- | src/mbgl/text/glyph_pbf.hpp | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/mbgl/text/glyph_pbf.cpp b/src/mbgl/text/glyph_pbf.cpp index f351e66c2a..66008adb96 100644 --- a/src/mbgl/text/glyph_pbf.cpp +++ b/src/mbgl/text/glyph_pbf.cpp @@ -98,14 +98,15 @@ GlyphPBF::GlyphPBF(GlyphStore* store, GlyphPBF::~GlyphPBF() = default; void GlyphPBF::parse(GlyphStore* store, const std::string& fontStack, const std::string& url) { - if (data.empty()) { + assert(data); + if (data->empty()) { // If there is no data, this means we either haven't // received any data. return; } try { - parseGlyphPBF(**store->getFontStack(fontStack), std::move(data)); + parseGlyphPBF(**store->getFontStack(fontStack), *data); } catch (const std::exception& ex) { std::stringstream message; message << "Failed to parse [" << url << "]: " << ex.what(); diff --git a/src/mbgl/text/glyph_pbf.hpp b/src/mbgl/text/glyph_pbf.hpp index 205824bfe5..bf8567dbec 100644 --- a/src/mbgl/text/glyph_pbf.hpp +++ b/src/mbgl/text/glyph_pbf.hpp @@ -42,7 +42,7 @@ private: void parse(GlyphStore* store, const std::string& fontStack, const std::string& url); - std::string data; + std::shared_ptr<const std::string> data; std::atomic<bool> parsed; RequestHolder req; |