Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "content/browser/bluetooth/frame_connected_bluetooth_devices.h" | 5 #include "content/browser/bluetooth/frame_connected_bluetooth_devices.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "device/bluetooth/bluetooth_gatt_connection.h" | 10 #include "device/bluetooth/bluetooth_gatt_connection.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 return std::string(); | 92 return std::string(); |
| 93 } | 93 } |
| 94 std::string device_id = device_address_iter->second; | 94 std::string device_id = device_address_iter->second; |
| 95 CHECK(device_address_to_id_map_.erase(device_address)); | 95 CHECK(device_address_to_id_map_.erase(device_address)); |
| 96 CHECK(device_id_to_connection_map_.erase(device_id)); | 96 CHECK(device_id_to_connection_map_.erase(device_id)); |
| 97 DecrementDevicesConnectedCount(); | 97 DecrementDevicesConnectedCount(); |
| 98 return device_id; | 98 return device_id; |
| 99 } | 99 } |
| 100 | 100 |
| 101 void FrameConnectedBluetoothDevices::IncrementDevicesConnectedCount() { | 101 void FrameConnectedBluetoothDevices::IncrementDevicesConnectedCount() { |
| 102 // There are no cases in which IncrementDevicesConnectedCount could be | |
| 103 // called while WebContentsImpl's destructor is running. | |
| 104 DCHECK(!web_contents_impl_->IsBeingDestroyed()); | |
|
Jeffrey Yasskin
2016/06/06 16:55:36
Because this has security implications, make it a
ortuno
2016/06/06 18:25:16
Done.
| |
| 102 web_contents_impl_->IncrementBluetoothConnectedDeviceCount(); | 105 web_contents_impl_->IncrementBluetoothConnectedDeviceCount(); |
| 103 } | 106 } |
| 104 | 107 |
| 105 void FrameConnectedBluetoothDevices::DecrementDevicesConnectedCount() { | 108 void FrameConnectedBluetoothDevices::DecrementDevicesConnectedCount() { |
| 109 if (web_contents_impl_->IsBeingDestroyed()) { | |
|
Jeffrey Yasskin
2016/06/06 16:55:36
Would it make more sense to put this check in WebC
ortuno
2016/06/06 18:25:16
I think so. Done.
| |
| 110 return; | |
| 111 } | |
| 106 web_contents_impl_->DecrementBluetoothConnectedDeviceCount(); | 112 web_contents_impl_->DecrementBluetoothConnectedDeviceCount(); |
| 107 } | 113 } |
| 108 | 114 |
| 109 } // namespace content | 115 } // namespace content |
| OLD | NEW |