Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1340)

Unified Diff: cc/single_thread_proxy.h

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 165064 Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/single_thread_proxy.h
diff --git a/cc/single_thread_proxy.h b/cc/single_thread_proxy.h
index 93f8c09a6a3bc927c71cbe1c9a6532f96695d487..0d801daea6f8a36dacfeae8bd12030689e1a1c02 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()
+ DebugScopedSetImplThread(Proxy* proxy)
jamesr 2012/10/31 04:42:13 explicit
+ : 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()
+ DebugScopedSetMainThread(Proxy* proxy)
jamesr 2012/10/31 04:42:13 explicit
+ : 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:
+ DebugScopedSetImplThreadAndMainThreadBlocked(Proxy* proxy)
jamesr 2012/10/31 04:42:13 explicit
+ : m_implThread(proxy)
+ , m_mainThreadBlocked(proxy)
+ {
+ }
private:
DebugScopedSetImplThread m_implThread;
DebugScopedSetMainThreadBlocked m_mainThreadBlocked;

Powered by Google App Engine
This is Rietveld 408576698