Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / content / public / renderer / render_thread.cc
blobef04a50dd3b31cdfdf8c30e60bb5e602cfec3d2a
1 // Copyright (c) 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 "content/public/renderer/render_thread.h"
7 #include "base/lazy_instance.h"
8 #include "base/threading/thread_local.h"
10 namespace content {
12 // Keep the global RenderThread in a TLS slot so it is impossible to access
13 // incorrectly from the wrong thread.
14 static base::LazyInstance<base::ThreadLocalPointer<RenderThread> > lazy_tls =
15 LAZY_INSTANCE_INITIALIZER;
17 RenderThread* RenderThread::Get() {
18 return lazy_tls.Pointer()->Get();
21 RenderThread::RenderThread() {
22 lazy_tls.Pointer()->Set(this);
25 RenderThread::~RenderThread() {
26 lazy_tls.Pointer()->Set(NULL);
29 } // namespace content