tuple: update to make use of C++11
[chromium-blink-merge.git] / content / public / utility / utility_thread.cc
blob87bd71e10b8859e0ab84519e5082c3a8a8c67c16
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/utility/utility_thread.h"
7 #include "base/lazy_instance.h"
8 #include "base/threading/thread_local.h"
10 namespace content {
12 // Keep the global UtilityThread in a TLS slot so it is impossible to access
13 // incorrectly from the wrong thread.
14 static base::LazyInstance<base::ThreadLocalPointer<UtilityThread> >::Leaky
15 lazy_tls = LAZY_INSTANCE_INITIALIZER;
17 UtilityThread* UtilityThread::Get() {
18 return lazy_tls.Pointer()->Get();
21 UtilityThread::UtilityThread() {
22 lazy_tls.Pointer()->Set(this);
25 UtilityThread::~UtilityThread() {
26 lazy_tls.Pointer()->Set(NULL);
29 } // namespace content