diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-06-23 20:08:30 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-06-25 16:26:21 +0300 |
commit | a8b6b67dfeb79a2e7904a2aec6354161c4eb1b16 (patch) | |
tree | ffe6ebd296b440287979f8df74b9f59da0ee998d /test | |
parent | 7bb86368d4730c889f9b1f7007a7bada580db8ea (diff) | |
download | qtlocation-mapboxgl-a8b6b67dfeb79a2e7904a2aec6354161c4eb1b16.tar.gz |
Introduce the ThreadContext
mbgl::Thread will keep a ThreadContext for each running instance
in a thread_local so we don't need to lookup a man in the Environment
every time we need some info about the current thread.
This patch is moving the ::currentlyOn check used on Debug build from
the Environment class to the ThreadContext.
Diffstat (limited to 'test')
-rw-r--r-- | test/miscellaneous/map_context.cpp | 2 | ||||
-rw-r--r-- | test/miscellaneous/thread.cpp | 2 | ||||
-rw-r--r-- | test/style/mock_file_source.cpp | 2 | ||||
-rw-r--r-- | test/style/resource_loading.cpp | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/test/miscellaneous/map_context.cpp b/test/miscellaneous/map_context.cpp index 15061b1225..6e9ed85c3f 100644 --- a/test/miscellaneous/map_context.cpp +++ b/test/miscellaneous/map_context.cpp @@ -15,7 +15,7 @@ TEST(MapContext, DoubleStyleLoad) { DefaultFileSource fileSource(nullptr); MapData data(view, MapMode::Continuous); - util::Thread<MapContext> context("Map", util::ThreadPriority::Regular, view, fileSource, data); + util::Thread<MapContext> context({"Map", util::ThreadType::Map, util::ThreadPriority::Regular}, view, fileSource, data); context.invokeSync(&MapContext::setStyleJSON, "", ""); context.invokeSync(&MapContext::setStyleJSON, "", ""); diff --git a/test/miscellaneous/thread.cpp b/test/miscellaneous/thread.cpp index b0dd2210e9..9767bc4b79 100644 --- a/test/miscellaneous/thread.cpp +++ b/test/miscellaneous/thread.cpp @@ -64,7 +64,7 @@ TEST(Thread, invoke) { loop.invoke([&] { EXPECT_EQ(tid, std::this_thread::get_id()); - Thread<TestObject> thread("Test", ThreadPriority::Regular, tid); + Thread<TestObject> thread({"Test", ThreadType::Map, ThreadPriority::Regular}, tid); thread.invoke(&TestObject::fn1, 1); thread.invokeWithResult<int>(&TestObject::fn2, [&] (int result) { diff --git a/test/style/mock_file_source.cpp b/test/style/mock_file_source.cpp index 0f2d93f71f..6aa735d0ea 100644 --- a/test/style/mock_file_source.cpp +++ b/test/style/mock_file_source.cpp @@ -133,7 +133,7 @@ void MockFileSource::Impl::dispatchPendingRequests() { } MockFileSource::MockFileSource(Type type, const std::string& match) - : thread_(std::make_unique<util::Thread<Impl>>("FileSource", util::ThreadPriority::Low, type, match)) { + : thread_(std::make_unique<util::Thread<Impl>>(util::ThreadContext{"FileSource", util::ThreadType::Unknown, util::ThreadPriority::Low}, type, match)) { } void MockFileSource::setOnRequestDelayedCallback(std::function<void(void)> callback) { diff --git a/test/style/resource_loading.cpp b/test/style/resource_loading.cpp index fb6ba744a9..158af25909 100644 --- a/test/style/resource_loading.cpp +++ b/test/style/resource_loading.cpp @@ -117,7 +117,7 @@ void runTestCase(MockFileSource::Type type, std::unique_ptr<util::Thread<MockMapContext>> context( std::make_unique<util::Thread<MockMapContext>>( - "Map", util::ThreadPriority::Regular, view, fileSource, callback)); + util::ThreadContext{"Map", util::ThreadType::Map, util::ThreadPriority::Regular}, view, fileSource, callback)); uv_run(loop.get(), UV_RUN_DEFAULT); |