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

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

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 | « content/browser/bluetooth/bluetooth_dispatcher_host.h ('k') | no next file » | 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 // NETWORK_ERROR Note: 5 // NETWORK_ERROR Note:
6 // When a device can't be found in the BluetoothAdapter, that generally 6 // When a device can't be found in the BluetoothAdapter, that generally
7 // indicates that it's gone out of range. We reject with a NetworkError in that 7 // indicates that it's gone out of range. We reject with a NetworkError in that
8 // case. 8 // case.
9 // https://webbluetoothchrome.github.io/web-bluetooth/#dom-bluetoothdevice-conne ctgatt 9 // https://webbluetoothchrome.github.io/web-bluetooth/#dom-bluetoothdevice-conne ctgatt
10 10
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 const int request_id; 266 const int request_id;
267 const std::vector<BluetoothScanFilter> filters; 267 const std::vector<BluetoothScanFilter> filters;
268 const std::vector<BluetoothUUID> optional_services; 268 const std::vector<BluetoothUUID> optional_services;
269 scoped_ptr<BluetoothChooser> chooser; 269 scoped_ptr<BluetoothChooser> chooser;
270 scoped_ptr<device::BluetoothDiscoverySession> discovery_session; 270 scoped_ptr<device::BluetoothDiscoverySession> discovery_session;
271 }; 271 };
272 272
273 void BluetoothDispatcherHost::set_adapter( 273 void BluetoothDispatcherHost::set_adapter(
274 scoped_refptr<device::BluetoothAdapter> adapter) { 274 scoped_refptr<device::BluetoothAdapter> adapter) {
275 DCHECK_CURRENTLY_ON(BrowserThread::UI); 275 DCHECK_CURRENTLY_ON(BrowserThread::UI);
276 connections_.clear();
276 if (adapter_.get()) 277 if (adapter_.get())
277 adapter_->RemoveObserver(this); 278 adapter_->RemoveObserver(this);
278 adapter_ = adapter; 279 adapter_ = adapter;
279 if (adapter_.get()) 280 if (adapter_.get())
280 adapter_->AddObserver(this); 281 adapter_->AddObserver(this);
281 } 282 }
282 283
283 void BluetoothDispatcherHost::StartDeviceDiscovery( 284 void BluetoothDispatcherHost::StartDeviceDiscovery(
284 RequestDeviceSession* session, 285 RequestDeviceSession* session,
285 int chooser_id) { 286 int chooser_id) {
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 request_device_sessions_.Remove(chooser_id); 835 request_device_sessions_.Remove(chooser_id);
835 } 836 }
836 837
837 void BluetoothDispatcherHost::OnGATTConnectionCreated( 838 void BluetoothDispatcherHost::OnGATTConnectionCreated(
838 int thread_id, 839 int thread_id,
839 int request_id, 840 int request_id,
840 const std::string& device_instance_id, 841 const std::string& device_instance_id,
841 base::TimeTicks start_time, 842 base::TimeTicks start_time,
842 scoped_ptr<device::BluetoothGattConnection> connection) { 843 scoped_ptr<device::BluetoothGattConnection> connection) {
843 DCHECK_CURRENTLY_ON(BrowserThread::UI); 844 DCHECK_CURRENTLY_ON(BrowserThread::UI);
844 // TODO(ortuno): Save the BluetoothGattConnection so we can disconnect 845 connections_.push_back(connection.Pass());
845 // from it.
846 RecordConnectGATTTimeSuccess(base::TimeTicks::Now() - start_time); 846 RecordConnectGATTTimeSuccess(base::TimeTicks::Now() - start_time);
847 RecordConnectGATTOutcome(UMAConnectGATTOutcome::SUCCESS); 847 RecordConnectGATTOutcome(UMAConnectGATTOutcome::SUCCESS);
848 Send(new BluetoothMsg_ConnectGATTSuccess(thread_id, request_id, 848 Send(new BluetoothMsg_ConnectGATTSuccess(thread_id, request_id,
849 device_instance_id)); 849 device_instance_id));
850 } 850 }
851 851
852 void BluetoothDispatcherHost::OnCreateGATTConnectionError( 852 void BluetoothDispatcherHost::OnCreateGATTConnectionError(
853 int thread_id, 853 int thread_id,
854 int request_id, 854 int request_id,
855 const std::string& device_instance_id, 855 const std::string& device_instance_id,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 DCHECK_CURRENTLY_ON(BrowserThread::UI); 955 DCHECK_CURRENTLY_ON(BrowserThread::UI);
956 NOTIMPLEMENTED(); 956 NOTIMPLEMENTED();
957 } 957 }
958 958
959 void BluetoothDispatcherHost::ShowBluetoothAdapterOffLink() { 959 void BluetoothDispatcherHost::ShowBluetoothAdapterOffLink() {
960 DCHECK_CURRENTLY_ON(BrowserThread::UI); 960 DCHECK_CURRENTLY_ON(BrowserThread::UI);
961 NOTIMPLEMENTED(); 961 NOTIMPLEMENTED();
962 } 962 }
963 963
964 } // namespace content 964 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_dispatcher_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698