| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_THREAD_WIN_H_ | |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_THREAD_WIN_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/threading/thread_checker.h" | |
| 11 | |
| 12 namespace base { | |
| 13 class SequencedTaskRunner; | |
| 14 class Thread; | |
| 15 } // namespace base | |
| 16 | |
| 17 namespace device { | |
| 18 | |
| 19 // Thread abstraction used by |BluetoothSocketWWin| to perform IO operations on | |
| 20 // the underlying platform sockets. An instance of this class can be shared by | |
| 21 // many active sockets. | |
| 22 class BluetoothSocketThreadWin | |
| 23 : public base::RefCountedThreadSafe<BluetoothSocketThreadWin> { | |
| 24 public: | |
| 25 static scoped_refptr<BluetoothSocketThreadWin> Get(); | |
| 26 void OnSocketActivate(); | |
| 27 void OnSocketDeactivate(); | |
| 28 | |
| 29 scoped_refptr<base::SequencedTaskRunner> task_runner() const; | |
| 30 | |
| 31 private: | |
| 32 friend class base::RefCountedThreadSafe<BluetoothSocketThreadWin>; | |
| 33 BluetoothSocketThreadWin(); | |
| 34 virtual ~BluetoothSocketThreadWin(); | |
| 35 | |
| 36 void EnsureStarted(); | |
| 37 | |
| 38 base::ThreadChecker thread_checker_; | |
| 39 int active_socket_count_; | |
| 40 scoped_ptr<base::Thread> thread_; | |
| 41 scoped_refptr<base::SequencedTaskRunner> task_runner_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketThreadWin); | |
| 44 }; | |
| 45 | |
| 46 } // namespace device | |
| 47 | |
| 48 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_THREAD_WIN_H_ | |
| OLD | NEW |