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
3 // found in the LICENSE file.
10 #include "cc/thread_impl.h"
14 Thread
* Proxy::mainThread() const
16 return m_mainThread
.get();
19 bool Proxy::hasImplThread() const
24 Thread
* Proxy::implThread() const
26 return m_implThread
.get();
29 Thread
* Proxy::currentThread() const
31 if (mainThread() && mainThread()->belongsToCurrentThread())
33 if (implThread() && implThread()->belongsToCurrentThread())
38 bool Proxy::isMainThread() const
42 if (m_implThreadIsOverridden
)
44 return mainThread()->belongsToCurrentThread();
50 bool Proxy::isImplThread() const
53 if (m_implThreadIsOverridden
)
55 return implThread() && implThread()->belongsToCurrentThread();
62 void Proxy::setCurrentThreadIsImplThread(bool isImplThread
)
64 m_implThreadIsOverridden
= isImplThread
;
68 bool Proxy::isMainThreadBlocked() const
71 return m_isMainThreadBlocked
;
78 void Proxy::setMainThreadBlocked(bool isMainThreadBlocked
)
80 m_isMainThreadBlocked
= isMainThreadBlocked
;
84 Proxy::Proxy(scoped_ptr
<Thread
> implThread
)
85 : m_mainThread(ThreadImpl::createForCurrentThread())
86 , m_implThread(implThread
.Pass())
88 , m_implThreadIsOverridden(false)
89 , m_isMainThreadBlocked(false)
96 DCHECK(isMainThread());