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 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 #ifndef NDEBUG | |
61 bool CCProxy::isMainThread() | 60 bool CCProxy::isMainThread() |
62 { | 61 { |
63 ASSERT(s_mainThread); | 62 #ifndef NDEBUG |
| 63 DCHECK(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 #else |
| 68 return true; |
| 69 #endif |
67 } | 70 } |
68 | 71 |
69 bool CCProxy::isImplThread() | 72 bool CCProxy::isImplThread() |
70 { | 73 { |
| 74 #ifndef NDEBUG |
71 base::PlatformThreadId implThreadID = s_implThread ? s_implThread->threadID(
) : 0; | 75 base::PlatformThreadId implThreadID = s_implThread ? s_implThread->threadID(
) : 0; |
72 if (implThreadIsOverridden && base::PlatformThread::CurrentId() == threadIDO
verridenToBeImplThread) | 76 if (implThreadIsOverridden && base::PlatformThread::CurrentId() == threadIDO
verridenToBeImplThread) |
73 return true; | 77 return true; |
74 return base::PlatformThread::CurrentId() == implThreadID; | 78 return base::PlatformThread::CurrentId() == implThreadID; |
| 79 #else |
| 80 return true; |
| 81 #endif |
75 } | 82 } |
76 | 83 |
| 84 #ifndef NDEBUG |
77 void CCProxy::setCurrentThreadIsImplThread(bool isImplThread) | 85 void CCProxy::setCurrentThreadIsImplThread(bool isImplThread) |
78 { | 86 { |
79 implThreadIsOverridden = isImplThread; | 87 implThreadIsOverridden = isImplThread; |
80 if (isImplThread) | 88 if (isImplThread) |
81 threadIDOverridenToBeImplThread = base::PlatformThread::CurrentId(); | 89 threadIDOverridenToBeImplThread = base::PlatformThread::CurrentId(); |
82 } | 90 } |
| 91 #endif |
83 | 92 |
84 bool CCProxy::isMainThreadBlocked() | 93 bool CCProxy::isMainThreadBlocked() |
85 { | 94 { |
| 95 #ifndef NDEBUG |
86 return s_isMainThreadBlocked; | 96 return s_isMainThreadBlocked; |
| 97 #else |
| 98 return true; |
| 99 #endif |
87 } | 100 } |
88 | 101 |
| 102 #ifndef NDEBUG |
89 void CCProxy::setMainThreadBlocked(bool isMainThreadBlocked) | 103 void CCProxy::setMainThreadBlocked(bool isMainThreadBlocked) |
90 { | 104 { |
91 s_isMainThreadBlocked = isMainThreadBlocked; | 105 s_isMainThreadBlocked = isMainThreadBlocked; |
92 } | 106 } |
93 #endif | 107 #endif |
94 | 108 |
95 CCProxy::CCProxy() | 109 CCProxy::CCProxy() |
96 { | 110 { |
97 ASSERT(isMainThread()); | 111 DCHECK(isMainThread()); |
98 } | 112 } |
99 | 113 |
100 CCProxy::~CCProxy() | 114 CCProxy::~CCProxy() |
101 { | 115 { |
102 ASSERT(isMainThread()); | 116 DCHECK(isMainThread()); |
103 } | 117 } |
104 | 118 |
105 } | 119 } |
OLD | NEW |