diff options
author | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-18 00:19:52 +0000 |
---|---|---|
committer | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-18 00:19:52 +0000 |
commit | dd909b1fe362c2b337be1687acd7c96c16685a7d (patch) | |
tree | a9ba16f5d0de162a7bccad9e8e758e76ff3aa7a6 | |
parent | 48297b548fbeb9ded21f401cb23784b783711aa3 (diff) | |
download | chromium_src-dd909b1fe362c2b337be1687acd7c96c16685a7d.zip chromium_src-dd909b1fe362c2b337be1687acd7c96c16685a7d.tar.gz chromium_src-dd909b1fe362c2b337be1687acd7c96c16685a7d.tar.bz2 |
cc: Pass impl task runner into TextureMailboxDeleter
BUG=348796
Review URL: https://codereview.chromium.org/195973004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257549 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/resources/texture_mailbox_deleter.cc | 10 | ||||
-rw-r--r-- | cc/resources/texture_mailbox_deleter.h | 8 | ||||
-rw-r--r-- | cc/resources/texture_mailbox_deleter_unittest.cc | 4 | ||||
-rw-r--r-- | cc/test/pixel_test.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 4 |
5 files changed, 21 insertions, 9 deletions
diff --git a/cc/resources/texture_mailbox_deleter.cc b/cc/resources/texture_mailbox_deleter.cc index 542b95e..ab86368 100644 --- a/cc/resources/texture_mailbox_deleter.cc +++ b/cc/resources/texture_mailbox_deleter.cc @@ -7,7 +7,7 @@ #include "base/bind.h" #include "base/location.h" #include "base/memory/weak_ptr.h" -#include "base/message_loop/message_loop_proxy.h" +#include "base/single_thread_task_runner.h" #include "cc/output/context_provider.h" #include "cc/resources/single_release_callback.h" #include "gpu/command_buffer/client/gles2_interface.h" @@ -34,7 +34,9 @@ static void PostTaskFromMainToImplThread( FROM_HERE, base::Bind(run_impl_callback, sync_point, is_lost)); } -TextureMailboxDeleter::TextureMailboxDeleter() : weak_ptr_factory_(this) {} +TextureMailboxDeleter::TextureMailboxDeleter( + const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) + : impl_task_runner_(task_runner), weak_ptr_factory_(this) {} TextureMailboxDeleter::~TextureMailboxDeleter() { for (size_t i = 0; i < impl_callbacks_.size(); ++i) @@ -65,9 +67,7 @@ scoped_ptr<SingleReleaseCallback> TextureMailboxDeleter::GetReleaseCallback( // thread. scoped_ptr<SingleReleaseCallback> main_callback = SingleReleaseCallback::Create(base::Bind( - &PostTaskFromMainToImplThread, - base::MessageLoopProxy::current(), - run_impl_callback)); + &PostTaskFromMainToImplThread, impl_task_runner_, run_impl_callback)); return main_callback.Pass(); } diff --git a/cc/resources/texture_mailbox_deleter.h b/cc/resources/texture_mailbox_deleter.h index add1549..ca0bc00 100644 --- a/cc/resources/texture_mailbox_deleter.h +++ b/cc/resources/texture_mailbox_deleter.h @@ -9,13 +9,18 @@ #include "cc/base/cc_export.h" #include "cc/base/scoped_ptr_vector.h" +namespace base { +class SingleThreadTaskRunner; +} + namespace cc { class ContextProvider; class SingleReleaseCallback; class CC_EXPORT TextureMailboxDeleter { public: - TextureMailboxDeleter(); + explicit TextureMailboxDeleter( + const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); ~TextureMailboxDeleter(); // Returns a Callback that can be used as the ReleaseCallback for a @@ -36,6 +41,7 @@ class CC_EXPORT TextureMailboxDeleter { uint32 sync_point, bool is_lost); + scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; ScopedPtrVector<SingleReleaseCallback> impl_callbacks_; base::WeakPtrFactory<TextureMailboxDeleter> weak_ptr_factory_; }; diff --git a/cc/resources/texture_mailbox_deleter_unittest.cc b/cc/resources/texture_mailbox_deleter_unittest.cc index 26b203a..0d04c99 100644 --- a/cc/resources/texture_mailbox_deleter_unittest.cc +++ b/cc/resources/texture_mailbox_deleter_unittest.cc @@ -4,6 +4,7 @@ #include "cc/resources/texture_mailbox_deleter.h" +#include "base/message_loop/message_loop_proxy.h" #include "cc/resources/single_release_callback.h" #include "cc/test/test_context_provider.h" #include "cc/test/test_web_graphics_context_3d.h" @@ -13,7 +14,8 @@ namespace cc { namespace { TEST(TextureMailboxDeleterTest, Destroy) { - scoped_ptr<TextureMailboxDeleter> deleter(new TextureMailboxDeleter); + scoped_ptr<TextureMailboxDeleter> deleter( + new TextureMailboxDeleter(base::MessageLoopProxy::current())); scoped_refptr<TestContextProvider> context_provider = TestContextProvider::Create(); diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc index 9277fe5..782a144 100644 --- a/cc/test/pixel_test.cc +++ b/cc/test/pixel_test.cc @@ -5,6 +5,7 @@ #include "cc/test/pixel_test.h" #include "base/command_line.h" +#include "base/message_loop/message_loop_proxy.h" #include "base/path_service.h" #include "base/run_loop.h" #include "cc/base/switches.h" @@ -123,7 +124,8 @@ void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend) { resource_provider_ = ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1); - texture_mailbox_deleter_ = make_scoped_ptr(new TextureMailboxDeleter); + texture_mailbox_deleter_ = make_scoped_ptr( + new TextureMailboxDeleter(base::MessageLoopProxy::current())); renderer_ = GLRenderer::Create(this, &settings_, diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 0dcb090..26ba2ee 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -240,7 +240,9 @@ LayerTreeHostImpl::LayerTreeHostImpl( paint_time_counter_(PaintTimeCounter::Create()), memory_history_(MemoryHistory::Create()), debug_rect_history_(DebugRectHistory::Create()), - texture_mailbox_deleter_(new TextureMailboxDeleter), + texture_mailbox_deleter_(new TextureMailboxDeleter( + proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() + : proxy_->MainThreadTaskRunner())), max_memory_needed_bytes_(0), last_sent_memory_visible_bytes_(0), last_sent_memory_visible_and_nearby_bytes_(0), |