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

Side by Side Diff: device/bluetooth/bluetooth_socket_thread.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_socket_thread.h" 5 #include "device/bluetooth/bluetooth_socket_thread.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/sequenced_task_runner.h" 8 #include "base/sequenced_task_runner.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 10
11 namespace device { 11 namespace device {
12 12
13 base::LazyInstance<scoped_refptr<BluetoothSocketThread> > g_instance = 13 base::LazyInstance<scoped_refptr<BluetoothSocketThread>>::DestructorAtExit
14 LAZY_INSTANCE_INITIALIZER; 14 g_instance = LAZY_INSTANCE_INITIALIZER;
15 15
16 // static 16 // static
17 scoped_refptr<BluetoothSocketThread> BluetoothSocketThread::Get() { 17 scoped_refptr<BluetoothSocketThread> BluetoothSocketThread::Get() {
18 if (!g_instance.Get().get()) { 18 if (!g_instance.Get().get()) {
19 g_instance.Get() = new BluetoothSocketThread(); 19 g_instance.Get() = new BluetoothSocketThread();
20 } 20 }
21 return g_instance.Get(); 21 return g_instance.Get();
22 } 22 }
23 23
24 // static 24 // static
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 scoped_refptr<base::SequencedTaskRunner> BluetoothSocketThread::task_runner() 64 scoped_refptr<base::SequencedTaskRunner> BluetoothSocketThread::task_runner()
65 const { 65 const {
66 DCHECK(active_socket_count_ > 0); 66 DCHECK(active_socket_count_ > 0);
67 DCHECK(thread_); 67 DCHECK(thread_);
68 DCHECK(task_runner_.get()); 68 DCHECK(task_runner_.get());
69 69
70 return task_runner_; 70 return task_runner_;
71 } 71 }
72 72
73 } // namespace device 73 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_adapter_factory_wrapper.h ('k') | extensions/browser/api/alarms/alarm_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698