| 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 "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 5 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 error); | 228 error); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 void BluetoothRemoteGattCharacteristic::StopNotifySession( | 232 void BluetoothRemoteGattCharacteristic::StopNotifySession( |
| 233 BluetoothGattNotifySession* session, | 233 BluetoothGattNotifySession* session, |
| 234 const base::Closure& callback) { | 234 const base::Closure& callback) { |
| 235 NotifySessionCommand* command = new NotifySessionCommand( | 235 NotifySessionCommand* command = new NotifySessionCommand( |
| 236 base::Bind(&BluetoothRemoteGattCharacteristic::ExecuteStopNotifySession, | 236 base::Bind(&BluetoothRemoteGattCharacteristic::ExecuteStopNotifySession, |
| 237 GetWeakPtr(), session, callback), | 237 GetWeakPtr(), session, callback), |
| 238 callback /* cancel_callback */); | 238 base::Bind(&BluetoothRemoteGattCharacteristic::CancelStopNotifySession, |
| 239 GetWeakPtr(), callback)); |
| 239 | 240 |
| 240 pending_notify_commands_.push(std::unique_ptr<NotifySessionCommand>(command)); | 241 pending_notify_commands_.push(std::unique_ptr<NotifySessionCommand>(command)); |
| 241 if (pending_notify_commands_.size() == 1) { | 242 if (pending_notify_commands_.size() == 1) { |
| 242 command->Execute(); | 243 command->Execute(); |
| 243 } | 244 } |
| 244 } | 245 } |
| 245 | 246 |
| 246 void BluetoothRemoteGattCharacteristic::ExecuteStopNotifySession( | 247 void BluetoothRemoteGattCharacteristic::ExecuteStopNotifySession( |
| 247 BluetoothGattNotifySession* session, | 248 BluetoothGattNotifySession* session, |
| 248 base::Closure callback, | 249 base::Closure callback, |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 | 353 |
| 353 pending_notify_commands_.pop(); | 354 pending_notify_commands_.pop(); |
| 354 if (!pending_notify_commands_.empty()) { | 355 if (!pending_notify_commands_.empty()) { |
| 355 pending_notify_commands_.front()->Execute( | 356 pending_notify_commands_.front()->Execute( |
| 356 NotifySessionCommand::COMMAND_STOP, NotifySessionCommand::RESULT_ERROR, | 357 NotifySessionCommand::COMMAND_STOP, NotifySessionCommand::RESULT_ERROR, |
| 357 error); | 358 error); |
| 358 } | 359 } |
| 359 } | 360 } |
| 360 | 361 |
| 361 } // namespace device | 362 } // namespace device |
| OLD | NEW |