Index: cc/proxy.cc |
diff --git a/cc/proxy.cc b/cc/proxy.cc |
index bc15bc58501651a2927c6390ee5a97f8aac3aff9..75523377cff984277b05cd11199892acf389ab6b 100644 |
--- a/cc/proxy.cc |
+++ b/cc/proxy.cc |
@@ -6,72 +6,63 @@ |
#include "cc/proxy.h" |
+#include "ccthread_impl.h" |
#include "cc/thread_task.h" |
namespace cc { |
-namespace { |
-#ifndef NDEBUG |
-bool implThreadIsOverridden = false; |
-bool s_isMainThreadBlocked = false; |
-base::PlatformThreadId threadIDOverridenToBeImplThread; |
-#endif |
-CCThread* s_mainThread = 0; |
-CCThread* s_implThread = 0; |
-} |
- |
void CCProxy::setMainThread(CCThread* thread) |
{ |
- s_mainThread = thread; |
+ m_compositorSupportState->mainThread = thread; |
} |
-CCThread* CCProxy::mainThread() |
+CCThread* CCProxy::mainThread() const |
{ |
- return s_mainThread; |
+ return m_compositorSupportState->mainThread; |
} |
-bool CCProxy::hasImplThread() |
+bool CCProxy::hasImplThread() const |
{ |
- return s_implThread; |
+ return !!m_compositorSupportState->implThread; |
} |
void CCProxy::setImplThread(CCThread* thread) |
{ |
- s_implThread = thread; |
+ m_compositorSupportState->implThread = thread; |
} |
-CCThread* CCProxy::implThread() |
+CCThread* CCProxy::implThread() const |
{ |
- return s_implThread; |
+ return m_compositorSupportState->implThread; |
} |
-CCThread* CCProxy::currentThread() |
+CCThread* CCProxy::currentThread() const |
{ |
base::PlatformThreadId currentThreadIdentifier = base::PlatformThread::CurrentId(); |
- if (s_mainThread && s_mainThread->threadID() == currentThreadIdentifier) |
- return s_mainThread; |
- if (s_implThread && s_implThread->threadID() == currentThreadIdentifier) |
- return s_implThread; |
+ if (mainThread() && mainThread()->threadID() == currentThreadIdentifier) |
+ return mainThread(); |
+ if (implThread() && implThread()->threadID() == currentThreadIdentifier) |
+ return implThread(); |
return 0; |
} |
-bool CCProxy::isMainThread() |
+bool CCProxy::isMainThread() const |
{ |
#ifndef NDEBUG |
- DCHECK(s_mainThread); |
- if (implThreadIsOverridden && base::PlatformThread::CurrentId() == threadIDOverridenToBeImplThread) |
+ DCHECK(mainThread()); |
+ if (m_implThreadIsOverridden && base::PlatformThread::CurrentId() == m_threadIDOverridenToBeImplThread) |
return false; |
- return base::PlatformThread::CurrentId() == s_mainThread->threadID(); |
+ return base::PlatformThread::CurrentId() == mainThread()->threadID(); |
#else |
return true; |
#endif |
} |
-bool CCProxy::isImplThread() |
+bool CCProxy::isImplThread() const |
{ |
#ifndef NDEBUG |
- base::PlatformThreadId implThreadID = s_implThread ? s_implThread->threadID() : 0; |
- if (implThreadIsOverridden && base::PlatformThread::CurrentId() == threadIDOverridenToBeImplThread) |
+ base::PlatformThreadId implThreadID = implThread() ? implThread()->threadID() : 0; |
+ if (m_implThreadIsOverridden && base::PlatformThread::CurrentId() == m_threadIDOverridenToBeImplThread) |
return true; |
return base::PlatformThread::CurrentId() == implThreadID; |
#else |
@@ -82,16 +73,16 @@ bool CCProxy::isImplThread() |
#ifndef NDEBUG |
void CCProxy::setCurrentThreadIsImplThread(bool isImplThread) |
{ |
- implThreadIsOverridden = isImplThread; |
+ m_implThreadIsOverridden = isImplThread; |
if (isImplThread) |
- threadIDOverridenToBeImplThread = base::PlatformThread::CurrentId(); |
+ m_threadIDOverridenToBeImplThread = base::PlatformThread::CurrentId(); |
} |
#endif |
-bool CCProxy::isMainThreadBlocked() |
+bool CCProxy::isMainThreadBlocked() const |
{ |
#ifndef NDEBUG |
- return s_isMainThreadBlocked; |
+ return m_isMainThreadBlocked; |
#else |
return true; |
#endif |
@@ -100,13 +91,17 @@ bool CCProxy::isMainThreadBlocked() |
#ifndef NDEBUG |
void CCProxy::setMainThreadBlocked(bool isMainThreadBlocked) |
{ |
- s_isMainThreadBlocked = isMainThreadBlocked; |
+ m_isMainThreadBlocked = isMainThreadBlocked; |
} |
#endif |
-CCProxy::CCProxy() |
+CCProxy::CCProxy(CompositorSupportState* compositorSupportState) |
+ : m_compositorSupportState(compositorSupportState) |
+#ifndef NDEBUG |
+ , m_implThreadIsOverridden(false) |
+ , m_isMainThreadBlocked(false) |
+#endif |
{ |
- DCHECK(isMainThread()); |
} |
CCProxy::~CCProxy() |