OLD | NEW |
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 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 void BluetoothSocketThread::EnsureStarted() { | 57 void BluetoothSocketThread::EnsureStarted() { |
58 DCHECK(thread_checker_.CalledOnValidThread()); | 58 DCHECK(thread_checker_.CalledOnValidThread()); |
59 if (thread_) | 59 if (thread_) |
60 return; | 60 return; |
61 | 61 |
62 base::Thread::Options thread_options; | 62 base::Thread::Options thread_options; |
63 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; | 63 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; |
64 thread_.reset(new base::Thread("BluetoothSocketThread")); | 64 thread_.reset(new base::Thread("BluetoothSocketThread")); |
65 thread_->StartWithOptions(thread_options); | 65 thread_->StartWithOptions(thread_options); |
66 task_runner_ = thread_->message_loop_proxy(); | 66 task_runner_ = thread_->task_runner(); |
67 } | 67 } |
68 | 68 |
69 scoped_refptr<base::SequencedTaskRunner> BluetoothSocketThread::task_runner() | 69 scoped_refptr<base::SequencedTaskRunner> BluetoothSocketThread::task_runner() |
70 const { | 70 const { |
71 DCHECK(active_socket_count_ > 0); | 71 DCHECK(active_socket_count_ > 0); |
72 DCHECK(thread_); | 72 DCHECK(thread_); |
73 DCHECK(task_runner_.get()); | 73 DCHECK(task_runner_.get()); |
74 | 74 |
75 return task_runner_; | 75 return task_runner_; |
76 } | 76 } |
77 | 77 |
78 } // namespace device | 78 } // namespace device |
OLD | NEW |