| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "CCProxy.h" | 7 #include "CCProxy.h" |
| 8 | 8 |
| 9 #include "CCThreadTask.h" | 9 #include "CCThreadTask.h" |
| 10 | 10 |
| 11 using namespace WTF; | 11 using namespace WTF; |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 #if CC_DCHECK_ENABLED() | 16 #ifndef NDEBUG |
| 17 bool implThreadIsOverridden = false; | 17 bool implThreadIsOverridden = false; |
| 18 bool s_isMainThreadBlocked = false; | 18 bool s_isMainThreadBlocked = false; |
| 19 base::PlatformThreadId threadIDOverridenToBeImplThread; | 19 base::PlatformThreadId threadIDOverridenToBeImplThread; |
| 20 #endif | 20 #endif |
| 21 CCThread* s_mainThread = 0; | 21 CCThread* s_mainThread = 0; |
| 22 CCThread* s_implThread = 0; | 22 CCThread* s_implThread = 0; |
| 23 } | 23 } |
| 24 | 24 |
| 25 void CCProxy::setMainThread(CCThread* thread) | 25 void CCProxy::setMainThread(CCThread* thread) |
| 26 { | 26 { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 50 CCThread* CCProxy::currentThread() | 50 CCThread* CCProxy::currentThread() |
| 51 { | 51 { |
| 52 base::PlatformThreadId currentThreadIdentifier = base::PlatformThread::Curre
ntId(); | 52 base::PlatformThreadId currentThreadIdentifier = base::PlatformThread::Curre
ntId(); |
| 53 if (s_mainThread && s_mainThread->threadID() == currentThreadIdentifier) | 53 if (s_mainThread && s_mainThread->threadID() == currentThreadIdentifier) |
| 54 return s_mainThread; | 54 return s_mainThread; |
| 55 if (s_implThread && s_implThread->threadID() == currentThreadIdentifier) | 55 if (s_implThread && s_implThread->threadID() == currentThreadIdentifier) |
| 56 return s_implThread; | 56 return s_implThread; |
| 57 return 0; | 57 return 0; |
| 58 } | 58 } |
| 59 | 59 |
| 60 #if CC_DCHECK_ENABLED() | 60 #ifndef NDEBUG |
| 61 bool CCProxy::isMainThread() | 61 bool CCProxy::isMainThread() |
| 62 { | 62 { |
| 63 DCHECK(s_mainThread); | 63 ASSERT(s_mainThread); |
| 64 if (implThreadIsOverridden && base::PlatformThread::CurrentId() == threadIDO
verridenToBeImplThread) | 64 if (implThreadIsOverridden && base::PlatformThread::CurrentId() == threadIDO
verridenToBeImplThread) |
| 65 return false; | 65 return false; |
| 66 return base::PlatformThread::CurrentId() == s_mainThread->threadID(); | 66 return base::PlatformThread::CurrentId() == s_mainThread->threadID(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool CCProxy::isImplThread() | 69 bool CCProxy::isImplThread() |
| 70 { | 70 { |
| 71 base::PlatformThreadId implThreadID = s_implThread ? s_implThread->threadID(
) : 0; | 71 base::PlatformThreadId implThreadID = s_implThread ? s_implThread->threadID(
) : 0; |
| 72 if (implThreadIsOverridden && base::PlatformThread::CurrentId() == threadIDO
verridenToBeImplThread) | 72 if (implThreadIsOverridden && base::PlatformThread::CurrentId() == threadIDO
verridenToBeImplThread) |
| 73 return true; | 73 return true; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 87 } | 87 } |
| 88 | 88 |
| 89 void CCProxy::setMainThreadBlocked(bool isMainThreadBlocked) | 89 void CCProxy::setMainThreadBlocked(bool isMainThreadBlocked) |
| 90 { | 90 { |
| 91 s_isMainThreadBlocked = isMainThreadBlocked; | 91 s_isMainThreadBlocked = isMainThreadBlocked; |
| 92 } | 92 } |
| 93 #endif | 93 #endif |
| 94 | 94 |
| 95 CCProxy::CCProxy() | 95 CCProxy::CCProxy() |
| 96 { | 96 { |
| 97 DCHECK(isMainThread()); | 97 ASSERT(isMainThread()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 CCProxy::~CCProxy() | 100 CCProxy::~CCProxy() |
| 101 { | 101 { |
| 102 DCHECK(isMainThread()); | 102 ASSERT(isMainThread()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } | 105 } |
| OLD | NEW |