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

Side by Side Diff: content/browser/bluetooth/bluetooth_dispatcher_host.h

Issue 1377453007: bluetooth: Keep GATT connections open by retaining BluetoothGattConnection objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-thread-
Patch Set: clear in set_adapter Created 5 years, 2 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
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_dispatcher_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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/scoped_vector.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "content/public/browser/bluetooth_chooser.h" 12 #include "content/public/browser/bluetooth_chooser.h"
12 #include "content/public/browser/browser_message_filter.h" 13 #include "content/public/browser/browser_message_filter.h"
13 #include "device/bluetooth/bluetooth_adapter.h" 14 #include "device/bluetooth/bluetooth_adapter.h"
14 #include "device/bluetooth/bluetooth_gatt_connection.h" 15 #include "device/bluetooth/bluetooth_gatt_connection.h"
15 #include "device/bluetooth/bluetooth_gatt_service.h" 16 #include "device/bluetooth/bluetooth_gatt_service.h"
16 17
17 namespace device { 18 namespace device {
18 class BluetoothUUID; 19 class BluetoothUUID;
19 } 20 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // A BluetoothAdapter instance representing an adapter of the system. 181 // A BluetoothAdapter instance representing an adapter of the system.
181 scoped_refptr<device::BluetoothAdapter> adapter_; 182 scoped_refptr<device::BluetoothAdapter> adapter_;
182 183
183 // Automatically stops Bluetooth discovery a set amount of time after it was 184 // 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 185 // started. We have a single timer for all of Web Bluetooth because it's
185 // simpler than tracking timeouts for each RequestDeviceSession individually, 186 // simpler than tracking timeouts for each RequestDeviceSession individually,
186 // and because there's no harm in extending the length of a few discovery 187 // and because there's no harm in extending the length of a few discovery
187 // sessions when other sessions are active. 188 // sessions when other sessions are active.
188 base::Timer discovery_session_timer_; 189 base::Timer discovery_session_timer_;
189 190
191 // Retain BluetoothGattConnection objects to keep connections open.
192 // TODO(scheib): Destroy as connections are closed. http://crbug.com/539643
193 ScopedVector<device::BluetoothGattConnection> connections_;
194
190 // |weak_ptr_on_ui_thread_| provides weak pointers, e.g. for callbacks, and 195 // |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 196 // 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. 197 // copies verify they are also used on the UI thread.
193 base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_; 198 base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_;
194 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; 199 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_;
195 200
196 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); 201 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost);
197 }; 202 };
198 203
199 } // namespace content 204 } // namespace content
200 205
201 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 206 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698