diff options
-rw-r--r-- | cc/scoped_thread_proxy.h | 20 | ||||
-rw-r--r-- | cc/test/layer_tree_test_common.h | 5 | ||||
-rw-r--r-- | cc/thread_proxy.h | 4 | ||||
-rw-r--r-- | cc/thread_task.h | 4 |
4 files changed, 18 insertions, 15 deletions
diff --git a/cc/scoped_thread_proxy.h b/cc/scoped_thread_proxy.h index c4c658d..023eaba 100644 --- a/cc/scoped_thread_proxy.h +++ b/cc/scoped_thread_proxy.h @@ -6,11 +6,11 @@ #define CCScopedThreadProxy_h #include "base/logging.h" +#include "base/memory/ref_counted.h" #include "base/threading/platform_thread.h" #include "cc/thread_task.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> -#include <wtf/ThreadSafeRefCounted.h> namespace cc { @@ -24,21 +24,20 @@ namespace cc { // Implementation note: Unlike ScopedRunnableMethodFactory in Chromium, pending tasks are not cancelled by actually // destroying the proxy. Instead each pending task holds a reference to the proxy to avoid maintaining an explicit // list of outstanding tasks. -class ScopedThreadProxy : public ThreadSafeRefCounted<ScopedThreadProxy> { +class ScopedThreadProxy : public base::RefCountedThreadSafe<ScopedThreadProxy> { public: - static PassRefPtr<ScopedThreadProxy> create(Thread* targetThread) + static scoped_refptr<ScopedThreadProxy> create(Thread* targetThread) { DCHECK(base::PlatformThread::CurrentId() == targetThread->threadID()); - return adoptRef(new ScopedThreadProxy(targetThread)); + return make_scoped_refptr(new ScopedThreadProxy(targetThread)); } - ~ScopedThreadProxy(); // Can be called from any thread. Posts a task to the target thread that runs unless // shutdown() is called before it runs. void postTask(PassOwnPtr<Thread::Task> task) { - ref(); + AddRef(); m_targetThread->postTask(createThreadTask(this, &ScopedThreadProxy::runTaskIfNotShutdown, task)); } @@ -50,6 +49,9 @@ public: } private: + friend class base::RefCountedThreadSafe<ScopedThreadProxy>; + ~ScopedThreadProxy(); + explicit ScopedThreadProxy(Thread* targetThread); void runTaskIfNotShutdown(PassOwnPtr<Thread::Task> popTask) @@ -58,18 +60,18 @@ private: // If our shutdown flag is set, it's possible that m_targetThread has already been destroyed so don't // touch it. if (m_shutdown) { - deref(); + Release(); return; } DCHECK(base::PlatformThread::CurrentId() == m_targetThread->threadID()); task->performTask(); - deref(); + Release(); } Thread* m_targetThread; bool m_shutdown; // Only accessed on the target thread }; -} +} // namespace cc #endif diff --git a/cc/test/layer_tree_test_common.h b/cc/test/layer_tree_test_common.h index 3688c71..10f35ca 100644 --- a/cc/test/layer_tree_test_common.h +++ b/cc/test/layer_tree_test_common.h @@ -5,8 +5,9 @@ #ifndef CC_TEST_LAYER_TREE_TEST_COMMON_H_ #define CC_TEST_LAYER_TREE_TEST_COMMON_H_ -#include "cc/layer_tree_host.h" #include "base/hash_tables.h" +#include "base/memory/ref_counted.h" +#include "cc/layer_tree_host.h" #include "cc/layer_tree_host_impl.h" #include "cc/scoped_thread_proxy.h" #include "cc/test/compositor_fake_web_graphics_context_3d.h" @@ -120,7 +121,7 @@ protected: scoped_ptr<cc::LayerTreeHost> m_layerTreeHost; protected: - RefPtr<cc::ScopedThreadProxy> m_mainThreadProxy; + scoped_refptr<cc::ScopedThreadProxy> m_mainThreadProxy; private: bool m_beginning; diff --git a/cc/thread_proxy.h b/cc/thread_proxy.h index d20e8f4..1c57dfb 100644 --- a/cc/thread_proxy.h +++ b/cc/thread_proxy.h @@ -148,7 +148,7 @@ private: scoped_ptr<Scheduler> m_schedulerOnImplThread; - RefPtr<ScopedThreadProxy> m_mainThreadProxy; + scoped_refptr<ScopedThreadProxy> m_mainThreadProxy; // Holds on to the context we might use for compositing in between initializeContext() // and initializeRenderer() calls. @@ -180,6 +180,6 @@ private: bool m_deferredCommitPending; }; -} +} // namespace cc #endif diff --git a/cc/thread_task.h b/cc/thread_task.h index be85f12..05bd171 100644 --- a/cc/thread_task.h +++ b/cc/thread_task.h @@ -1,12 +1,12 @@ // Copyright 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. + #ifndef CCThreadTask_h #define CCThreadTask_h #include "cc/thread.h" #include <wtf/PassOwnPtr.h> -#include <wtf/PassRefPtr.h> namespace cc { @@ -300,6 +300,6 @@ PassOwnPtr<Thread::Task> createThreadTask( } -} // namespace cc +} // namespace cc #endif // CCThreadTask_h |