summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-10-28 11:58:42 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-10-28 15:54:34 -0700
commit014b517820b935137d1f6cf654c42fb041ee2d71 (patch)
tree52faeed442d203a9cdfa5fc28f195da3f9897cbc /src
parentdd56e832b5035a07ae6d1d362ee2560b24ae0681 (diff)
downloadqtlocation-mapboxgl-014b517820b935137d1f6cf654c42fb041ee2d71.tar.gz
[node] Output debug logs when a render test times out
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/map.cpp4
-rw-r--r--src/mbgl/map/map_context.cpp11
-rw-r--r--src/mbgl/map/map_context.hpp2
-rw-r--r--src/mbgl/map/source.cpp9
-rw-r--r--src/mbgl/map/source.hpp1
-rw-r--r--src/mbgl/map/sprite.cpp4
-rw-r--r--src/mbgl/map/sprite.hpp2
-rw-r--r--src/mbgl/map/tile_data.cpp6
-rw-r--r--src/mbgl/map/tile_data.hpp2
-rw-r--r--src/mbgl/style/style.cpp12
-rw-r--r--src/mbgl/style/style.hpp2
11 files changed, 55 insertions, 0 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index a1823dc8e1..f4db160c27 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -500,4 +500,8 @@ void Map::onLowMemory() {
context->invoke(&MapContext::onLowMemory);
}
+void Map::dumpDebugLogs() const {
+ context->invokeSync(&MapContext::dumpDebugLogs);
+}
+
}
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp
index 11d631a57a..b6ebffe2e2 100644
--- a/src/mbgl/map/map_context.cpp
+++ b/src/mbgl/map/map_context.cpp
@@ -324,4 +324,15 @@ void MapContext::onResourceLoadingFailed(std::exception_ptr error) {
}
}
+void MapContext::dumpDebugLogs() const {
+ Log::Info(Event::General, "--------------------------------------------------------------------------------");
+ Log::Info(Event::General, "MapContext::styleURL: %s", styleURL.c_str());
+ if (style) {
+ style->dumpDebugLogs();
+ } else {
+ Log::Info(Event::General, "no style loaded");
+ }
+ Log::Info(Event::General, "--------------------------------------------------------------------------------");
+}
+
}
diff --git a/src/mbgl/map/map_context.hpp b/src/mbgl/map/map_context.hpp
index 028a05e4bb..c2e0213dfb 100644
--- a/src/mbgl/map/map_context.hpp
+++ b/src/mbgl/map/map_context.hpp
@@ -67,6 +67,8 @@ public:
void onTileDataChanged() override;
void onResourceLoadingFailed(std::exception_ptr error) override;
+ void dumpDebugLogs() const;
+
private:
// Update the state indicated by the accumulated Update flags, then render.
void update();
diff --git a/src/mbgl/map/source.cpp b/src/mbgl/map/source.cpp
index 8a7f97d963..7af58788e4 100644
--- a/src/mbgl/map/source.cpp
+++ b/src/mbgl/map/source.cpp
@@ -594,4 +594,13 @@ void Source::emitTileLoadingFailed(const std::string& message) {
observer_->onTileLoadingFailed(error);
}
+void Source::dumpDebugLogs() const {
+ Log::Info(Event::General, "Source::id: %s", info.source_id.c_str());
+ Log::Info(Event::General, "Source::loaded: %d", loaded);
+
+ for (const auto& tile : tiles) {
+ tile.second->data->dumpDebugLogs();
+ }
+}
+
}
diff --git a/src/mbgl/map/source.hpp b/src/mbgl/map/source.hpp
index 2193ea8af6..4aab4a8b44 100644
--- a/src/mbgl/map/source.hpp
+++ b/src/mbgl/map/source.hpp
@@ -91,6 +91,7 @@ public:
void onLowMemory();
void setObserver(Observer* observer);
+ void dumpDebugLogs() const;
SourceInfo info;
bool enabled;
diff --git a/src/mbgl/map/sprite.cpp b/src/mbgl/map/sprite.cpp
index cbd8c44338..84e01324b5 100644
--- a/src/mbgl/map/sprite.cpp
+++ b/src/mbgl/map/sprite.cpp
@@ -111,4 +111,8 @@ void Sprite::setObserver(Observer* observer_) {
observer = observer_;
}
+void Sprite::dumpDebugLogs() const {
+ Log::Info(Event::General, "Sprite::loaded: %d", loaded);
+}
+
} // namespace mbgl
diff --git a/src/mbgl/map/sprite.hpp b/src/mbgl/map/sprite.hpp
index 47ce1dbc8b..cd82460a12 100644
--- a/src/mbgl/map/sprite.hpp
+++ b/src/mbgl/map/sprite.hpp
@@ -34,6 +34,8 @@ public:
return loaded;
}
+ void dumpDebugLogs() const;
+
const float pixelRatio;
void setObserver(Observer* observer);
diff --git a/src/mbgl/map/tile_data.cpp b/src/mbgl/map/tile_data.cpp
index d5fef9d0b4..bba7d7fe22 100644
--- a/src/mbgl/map/tile_data.cpp
+++ b/src/mbgl/map/tile_data.cpp
@@ -23,4 +23,10 @@ const char* TileData::StateToString(const State state) {
}
}
+void TileData::dumpDebugLogs() const {
+ Log::Info(Event::General, "TileData::id: %s", std::string(id).c_str());
+ Log::Info(Event::General, "TileData::state: %s", TileData::StateToString(state));
+ Log::Info(Event::General, "TileData::error: %s", error.c_str());
+}
+
} // namespace mbgl
diff --git a/src/mbgl/map/tile_data.hpp b/src/mbgl/map/tile_data.hpp
index d9895ce01a..2a5745142d 100644
--- a/src/mbgl/map/tile_data.hpp
+++ b/src/mbgl/map/tile_data.hpp
@@ -91,6 +91,8 @@ public:
return error;
}
+ void dumpDebugLogs() const;
+
const TileID id;
// Contains the tile ID string for painting debug information.
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index b68ce496b8..3c87c4c9b7 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -262,4 +262,16 @@ void Style::emitResourceLoadingFailed(std::exception_ptr error) {
}
}
+void Style::dumpDebugLogs() const {
+ for (const auto& source : sources) {
+ source->dumpDebugLogs();
+ }
+
+ if (!sprite) {
+ Log::Info(Event::General, "no sprite loaded");
+ } else {
+ sprite->dumpDebugLogs();
+ }
+}
+
}
diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp
index f4b2aac480..c9261bd6c4 100644
--- a/src/mbgl/style/style.hpp
+++ b/src/mbgl/style/style.hpp
@@ -69,6 +69,8 @@ public:
void addLayer(util::ptr<StyleLayer>, const std::string& beforeLayerID);
void removeLayer(const std::string& layerID);
+ void dumpDebugLogs() const;
+
MapData& data;
std::unique_ptr<GlyphStore> glyphStore;
std::unique_ptr<GlyphAtlas> glyphAtlas;