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 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/id_map.h" | 9 #include "base/id_map.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // A BluetoothAdapter instance representing an adapter of the system. | 180 // A BluetoothAdapter instance representing an adapter of the system. |
181 scoped_refptr<device::BluetoothAdapter> adapter_; | 181 scoped_refptr<device::BluetoothAdapter> adapter_; |
182 | 182 |
183 // Automatically stops Bluetooth discovery a set amount of time after it was | 183 // Automatically stops Bluetooth discovery a set amount of time after it was |
184 // started. We have a single timer for all of Web Bluetooth because it's | 184 // started. We have a single timer for all of Web Bluetooth because it's |
185 // simpler than tracking timeouts for each RequestDeviceSession individually, | 185 // simpler than tracking timeouts for each RequestDeviceSession individually, |
186 // and because there's no harm in extending the length of a few discovery | 186 // and because there's no harm in extending the length of a few discovery |
187 // sessions when other sessions are active. | 187 // sessions when other sessions are active. |
188 base::Timer discovery_session_timer_; | 188 base::Timer discovery_session_timer_; |
189 | 189 |
190 // Must be last member, see base/memory/weak_ptr.h documentation | 190 // |weak_ptr_on_ui_thread_| provides weak pointers, e.g. for callbacks, and |
| 191 // because it exists and has been bound to the UI thread enforces that all |
| 192 // copies verify they are also used on the UI thread. |
| 193 base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_; |
191 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; | 194 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; |
192 | 195 |
193 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); | 196 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); |
194 }; | 197 }; |
195 | 198 |
196 } // namespace content | 199 } // namespace content |
197 | 200 |
198 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 201 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
OLD | NEW |