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

Unified Diff: content/public/renderer/render_thread.cc

Issue 8171015: Rename RenderThread to RenderThreadImpl (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/devtools_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/renderer/render_thread.cc
===================================================================
--- content/public/renderer/render_thread.cc (revision 104358)
+++ content/public/renderer/render_thread.cc (working copy)
@@ -5,4 +5,25 @@
#include "content/public/renderer/render_thread.h"
#include "base/lazy_instance.h"
+#include "base/threading/thread_local.h"
+namespace content {
+
+// Keep the global RenderThread in a TLS slot so it is impossible to access
+// incorrectly from the wrong thread.
+static base::LazyInstance<base::ThreadLocalPointer<RenderThread> > lazy_tls(
+ base::LINKER_INITIALIZED);
+
+RenderThread* RenderThread::Get() {
+ return lazy_tls.Pointer()->Get();
+}
+
+RenderThread::RenderThread() {
+ lazy_tls.Pointer()->Set(this);
+}
+
+RenderThread::~RenderThread() {
+ lazy_tls.Pointer()->Set(NULL);
+}
+
+} // namespace content
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/devtools_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698