summaryrefslogtreecommitdiffstats
path: root/cc/proxy.h
diff options
context:
space:
mode:
authoraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-08 07:03:44 +0000
committeraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-08 07:03:44 +0000
commit61de581375ce3d76628772a78719cad63f0aabae (patch)
tree90e5818095cfa31182ceca09224c42d999644e4d /cc/proxy.h
parentde8686ed05a28324b0978b2bb81cf3407f13762b (diff)
downloadchromium_src-61de581375ce3d76628772a78719cad63f0aabae.zip
chromium_src-61de581375ce3d76628772a78719cad63f0aabae.tar.gz
chromium_src-61de581375ce3d76628772a78719cad63f0aabae.tar.bz2
Remove static thread pointers from CC, attempt 3
BUG=152904 Review URL: https://chromiumcodereview.appspot.com/11232051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/proxy.h')
-rw-r--r--cc/proxy.h56
1 files changed, 31 insertions, 25 deletions
diff --git a/cc/proxy.h b/cc/proxy.h
index ac61540..d9d5bd3 100644
--- a/cc/proxy.h
+++ b/cc/proxy.h
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/time.h"
+#include "base/memory/scoped_ptr.h"
#include <public/WebCompositorOutputSurface.h>
#include "cc/cc_export.h"
@@ -26,15 +27,21 @@ struct RendererCapabilities;
// the compositor over to the compositor implementation.
class CC_EXPORT Proxy {
public:
- static void setMainThread(Thread*);
- static Thread* mainThread();
-
- static bool hasImplThread();
- static void setImplThread(Thread*);
- static Thread* implThread();
+ Thread* mainThread() const;
+ bool hasImplThread() const;
+ Thread* implThread() const;
// Returns 0 if the current thread is neither the main thread nor the impl thread.
- static Thread* currentThread();
+ Thread* currentThread() const;
+
+ // Debug hooks
+ bool isMainThread() const;
+ bool isImplThread() const;
+ bool isMainThreadBlocked() const;
+#ifndef NDEBUG
+ void setMainThreadBlocked(bool);
+ void setCurrentThreadIsImplThread(bool);
+#endif
virtual ~Proxy();
@@ -90,46 +97,45 @@ public:
virtual void acquireLayerTextures() = 0;
- // Debug hooks
- static bool isMainThread();
- static bool isImplThread();
- static bool isMainThreadBlocked();
-#ifndef NDEBUG
- static void setMainThreadBlocked(bool);
-#endif
-
// Testing hooks
virtual void loseContext() = 0;
-#ifndef NDEBUG
- static void setCurrentThreadIsImplThread(bool);
-#endif
-
protected:
- Proxy();
+ explicit Proxy(scoped_ptr<Thread> implThread);
friend class DebugScopedSetImplThread;
+ friend class DebugScopedSetMainThread;
friend class DebugScopedSetMainThreadBlocked;
private:
DISALLOW_COPY_AND_ASSIGN(Proxy);
+
+ scoped_ptr<Thread> m_mainThread;
+ scoped_ptr<Thread> m_implThread;
+#ifndef NDEBUG
+ bool m_implThreadIsOverridden;
+ bool m_isMainThreadBlocked;
+#endif
};
class DebugScopedSetMainThreadBlocked {
public:
- DebugScopedSetMainThreadBlocked()
+ explicit DebugScopedSetMainThreadBlocked(Proxy* proxy)
+ : m_proxy(proxy)
{
#ifndef NDEBUG
- DCHECK(!Proxy::isMainThreadBlocked());
- Proxy::setMainThreadBlocked(true);
+ DCHECK(!m_proxy->isMainThreadBlocked());
+ m_proxy->setMainThreadBlocked(true);
#endif
}
~DebugScopedSetMainThreadBlocked()
{
#ifndef NDEBUG
- DCHECK(Proxy::isMainThreadBlocked());
- Proxy::setMainThreadBlocked(false);
+ DCHECK(m_proxy->isMainThreadBlocked());
+ m_proxy->setMainThreadBlocked(false);
#endif
}
+private:
+ Proxy* m_proxy;
};
}