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

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

Issue 2228403003: content: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 // ID Not In Map Note: 5 // ID Not In Map Note:
6 // A service, characteristic, or descriptor ID not in the corresponding 6 // A service, characteristic, or descriptor ID not in the corresponding
7 // WebBluetoothServiceImpl map [service_id_to_device_address_, 7 // WebBluetoothServiceImpl map [service_id_to_device_address_,
8 // characteristic_id_to_service_id_, descriptor_to_characteristic_] implies a 8 // characteristic_id_to_service_id_, descriptor_to_characteristic_] implies a
9 // hostile renderer because a renderer obtains the corresponding ID from this 9 // hostile renderer because a renderer obtains the corresponding ID from this
10 // class and it will be added to the map at that time. 10 // class and it will be added to the map at that time.
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 267 }
268 std::vector<PrimaryServicesRequestCallback> requests = 268 std::vector<PrimaryServicesRequestCallback> requests =
269 std::move(iter->second); 269 std::move(iter->second);
270 pending_primary_services_requests_.erase(iter); 270 pending_primary_services_requests_.erase(iter);
271 271
272 for (const PrimaryServicesRequestCallback& request : requests) { 272 for (const PrimaryServicesRequestCallback& request : requests) {
273 request.Run(device); 273 request.Run(device);
274 } 274 }
275 275
276 // Sending get-service responses unexpectedly queued another request. 276 // Sending get-service responses unexpectedly queued another request.
277 DCHECK(!ContainsKey(pending_primary_services_requests_, device_address)); 277 DCHECK(
278 !base::ContainsKey(pending_primary_services_requests_, device_address));
278 } 279 }
279 280
280 void WebBluetoothServiceImpl::GattCharacteristicValueChanged( 281 void WebBluetoothServiceImpl::GattCharacteristicValueChanged(
281 device::BluetoothAdapter* adapter, 282 device::BluetoothAdapter* adapter,
282 device::BluetoothRemoteGattCharacteristic* characteristic, 283 device::BluetoothRemoteGattCharacteristic* characteristic,
283 const std::vector<uint8_t>& value) { 284 const std::vector<uint8_t>& value) {
284 // Don't notify of characteristics that we haven't returned. 285 // Don't notify of characteristics that we haven't returned.
285 if (!ContainsKey(characteristic_id_to_service_id_, 286 if (!base::ContainsKey(characteristic_id_to_service_id_,
286 characteristic->GetIdentifier())) { 287 characteristic->GetIdentifier())) {
287 return; 288 return;
288 } 289 }
289 290
290 // On Chrome OS and Linux, GattCharacteristicValueChanged is called before the 291 // On Chrome OS and Linux, GattCharacteristicValueChanged is called before the
291 // success callback for ReadRemoteCharacteristic is called, which could result 292 // success callback for ReadRemoteCharacteristic is called, which could result
292 // in an event being fired before the readValue promise is resolved. 293 // in an event being fired before the readValue promise is resolved.
293 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( 294 if (!base::ThreadTaskRunnerHandle::Get()->PostTask(
294 FROM_HERE, 295 FROM_HERE,
295 base::Bind(&WebBluetoothServiceImpl::NotifyCharacteristicValueChanged, 296 base::Bind(&WebBluetoothServiceImpl::NotifyCharacteristicValueChanged,
296 weak_ptr_factory_.GetWeakPtr(), 297 weak_ptr_factory_.GetWeakPtr(),
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 characteristic_id_to_service_id_.clear(); 995 characteristic_id_to_service_id_.clear();
995 service_id_to_device_address_.clear(); 996 service_id_to_device_address_.clear();
996 connected_devices_.reset( 997 connected_devices_.reset(
997 new FrameConnectedBluetoothDevices(render_frame_host_)); 998 new FrameConnectedBluetoothDevices(render_frame_host_));
998 allowed_devices_map_ = BluetoothAllowedDevicesMap(); 999 allowed_devices_map_ = BluetoothAllowedDevicesMap();
999 device_chooser_controller_.reset(); 1000 device_chooser_controller_.reset();
1000 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); 1001 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this);
1001 } 1002 }
1002 1003
1003 } // namespace content 1004 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_device_chooser_controller.cc ('k') | content/browser/cache_storage/cache_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698