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.
8 #include "cc/thread_impl.h"
12 Thread
* Proxy::mainThread() const
14 return m_mainThread
.get();
17 bool Proxy::hasImplThread() const
22 Thread
* Proxy::implThread() const
24 return m_implThread
.get();
27 Thread
* Proxy::currentThread() const
29 if (mainThread() && mainThread()->belongsToCurrentThread())
31 if (implThread() && implThread()->belongsToCurrentThread())
36 bool Proxy::isMainThread() const
40 if (m_implThreadIsOverridden
)
42 return mainThread()->belongsToCurrentThread();
48 bool Proxy::isImplThread() const
51 if (m_implThreadIsOverridden
)
53 return implThread() && implThread()->belongsToCurrentThread();
60 void Proxy::setCurrentThreadIsImplThread(bool isImplThread
)
62 m_implThreadIsOverridden
= isImplThread
;
66 bool Proxy::isMainThreadBlocked() const
69 return m_isMainThreadBlocked
;
76 void Proxy::setMainThreadBlocked(bool isMainThreadBlocked
)
78 m_isMainThreadBlocked
= isMainThreadBlocked
;
82 Proxy::Proxy(scoped_ptr
<Thread
> implThread
)
83 : m_mainThread(ThreadImpl::createForCurrentThread())
84 , m_implThread(implThread
.Pass())
86 , m_implThreadIsOverridden(false)
87 , m_isMainThreadBlocked(false)
94 DCHECK(isMainThread());