Don't hide PopupZoomer if the content size didn't change.
[chromium-blink-merge.git] / cc / proxy.cc
blob9a07254c24aa6765f9d09ae60695f91672c17667
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.
5 #include "cc/proxy.h"
7 #include "cc/thread.h"
8 #include "cc/thread_impl.h"
10 namespace cc {
12 Thread* Proxy::mainThread() const
14 return m_mainThread.get();
17 bool Proxy::hasImplThread() const
19 return m_implThread;
22 Thread* Proxy::implThread() const
24 return m_implThread.get();
27 Thread* Proxy::currentThread() const
29 if (mainThread() && mainThread()->belongsToCurrentThread())
30 return mainThread();
31 if (implThread() && implThread()->belongsToCurrentThread())
32 return implThread();
33 return 0;
36 bool Proxy::isMainThread() const
38 #ifndef NDEBUG
39 DCHECK(mainThread());
40 if (m_implThreadIsOverridden)
41 return false;
42 return mainThread()->belongsToCurrentThread();
43 #else
44 return true;
45 #endif
48 bool Proxy::isImplThread() const
50 #ifndef NDEBUG
51 if (m_implThreadIsOverridden)
52 return true;
53 return implThread() && implThread()->belongsToCurrentThread();
54 #else
55 return true;
56 #endif
59 #ifndef NDEBUG
60 void Proxy::setCurrentThreadIsImplThread(bool isImplThread)
62 m_implThreadIsOverridden = isImplThread;
64 #endif
66 bool Proxy::isMainThreadBlocked() const
68 #ifndef NDEBUG
69 return m_isMainThreadBlocked;
70 #else
71 return true;
72 #endif
75 #ifndef NDEBUG
76 void Proxy::setMainThreadBlocked(bool isMainThreadBlocked)
78 m_isMainThreadBlocked = isMainThreadBlocked;
80 #endif
82 Proxy::Proxy(scoped_ptr<Thread> implThread)
83 : m_mainThread(ThreadImpl::createForCurrentThread())
84 , m_implThread(implThread.Pass())
85 #ifndef NDEBUG
86 , m_implThreadIsOverridden(false)
87 , m_isMainThreadBlocked(false)
88 #endif
92 Proxy::~Proxy()
94 DCHECK(isMainThread());
97 } // namespace cc