summaryrefslogtreecommitdiffstats
path: root/cc/single_thread_proxy.h
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 19:48:47 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 19:48:47 +0000
commitb375853a5b2305fe3cc689e2b3712bf42258ef4d (patch)
treeed1707a941a96624ba442f4360b736e5416a3158 /cc/single_thread_proxy.h
parentb2b06c4f160763133874468c5f6715afc8832e06 (diff)
downloadchromium_src-b375853a5b2305fe3cc689e2b3712bf42258ef4d.zip
chromium_src-b375853a5b2305fe3cc689e2b3712bf42258ef4d.tar.gz
chromium_src-b375853a5b2305fe3cc689e2b3712bf42258ef4d.tar.bz2
Remove static thread pointers from CC
BUG=152904 Review URL: https://codereview.chromium.org/11232051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/single_thread_proxy.h')
-rw-r--r--cc/single_thread_proxy.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/cc/single_thread_proxy.h b/cc/single_thread_proxy.h
index 91e0810..fa3ce013 100644
--- a/cc/single_thread_proxy.h
+++ b/cc/single_thread_proxy.h
@@ -91,42 +91,58 @@ private:
// code is running on the impl thread to satisfy assertion checks.
class DebugScopedSetImplThread {
public:
- DebugScopedSetImplThread()
+ explicit DebugScopedSetImplThread(Proxy* proxy)
+ : m_proxy(proxy)
{
#ifndef NDEBUG
- Proxy::setCurrentThreadIsImplThread(true);
+ m_previousValue = m_proxy->m_implThreadIsOverridden;
+ m_proxy->setCurrentThreadIsImplThread(true);
#endif
}
~DebugScopedSetImplThread()
{
#ifndef NDEBUG
- Proxy::setCurrentThreadIsImplThread(false);
+ m_proxy->setCurrentThreadIsImplThread(m_previousValue);
#endif
}
+private:
+ bool m_previousValue;
+ Proxy* m_proxy;
};
// For use in the single-threaded case. In debug builds, it pretends that the
// code is running on the main thread to satisfy assertion checks.
class DebugScopedSetMainThread {
public:
- DebugScopedSetMainThread()
+ explicit DebugScopedSetMainThread(Proxy* proxy)
+ : m_proxy(proxy)
{
#ifndef NDEBUG
- Proxy::setCurrentThreadIsImplThread(false);
+ m_previousValue = m_proxy->m_implThreadIsOverridden;
+ m_proxy->setCurrentThreadIsImplThread(false);
#endif
}
~DebugScopedSetMainThread()
{
#ifndef NDEBUG
- Proxy::setCurrentThreadIsImplThread(true);
+ m_proxy->setCurrentThreadIsImplThread(m_previousValue);
#endif
}
+private:
+ bool m_previousValue;
+ Proxy* m_proxy;
};
// For use in the single-threaded case. In debug builds, it pretends that the
// code is running on the impl thread and that the main thread is blocked to
// satisfy assertion checks
class DebugScopedSetImplThreadAndMainThreadBlocked {
+public:
+ explicit DebugScopedSetImplThreadAndMainThreadBlocked(Proxy* proxy)
+ : m_implThread(proxy)
+ , m_mainThreadBlocked(proxy)
+ {
+ }
private:
DebugScopedSetImplThread m_implThread;
DebugScopedSetMainThreadBlocked m_mainThreadBlocked;