| OLD | NEW |
| 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 #include "device/bluetooth/bluetooth_rfcomm_channel_mac.h" | 5 #include "device/bluetooth/bluetooth_rfcomm_channel_mac.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "device/bluetooth/bluetooth_classic_device_mac.h" | 8 #include "device/bluetooth/bluetooth_classic_device_mac.h" |
| 9 #include "device/bluetooth/bluetooth_socket_mac.h" | 9 #include "device/bluetooth/bluetooth_socket_mac.h" |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 withChannelID:channel_id | 87 withChannelID:channel_id |
| 88 delegate:channel->delegate_]; | 88 delegate:channel->delegate_]; |
| 89 if (*status == kIOReturnSuccess) { | 89 if (*status == kIOReturnSuccess) { |
| 90 // Note: No need to retain the |rfcomm_channel| -- the returned channel is | 90 // Note: No need to retain the |rfcomm_channel| -- the returned channel is |
| 91 // already retained. | 91 // already retained. |
| 92 channel->channel_.reset(rfcomm_channel); | 92 channel->channel_.reset(rfcomm_channel); |
| 93 } else { | 93 } else { |
| 94 channel.reset(); | 94 channel.reset(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 return channel.Pass(); | 97 return channel; |
| 98 } | 98 } |
| 99 | 99 |
| 100 void BluetoothRfcommChannelMac::SetSocket(BluetoothSocketMac* socket) { | 100 void BluetoothRfcommChannelMac::SetSocket(BluetoothSocketMac* socket) { |
| 101 BluetoothChannelMac::SetSocket(socket); | 101 BluetoothChannelMac::SetSocket(socket); |
| 102 if (!this->socket()) | 102 if (!this->socket()) |
| 103 return; | 103 return; |
| 104 | 104 |
| 105 // Now that the socket is set, it's safe to associate a delegate, which can | 105 // Now that the socket is set, it's safe to associate a delegate, which can |
| 106 // call back to the socket. | 106 // call back to the socket. |
| 107 DCHECK(!delegate_); | 107 DCHECK(!delegate_); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 void* refcon, | 159 void* refcon, |
| 160 IOReturn status) { | 160 IOReturn status) { |
| 161 // Note: We use "CHECK" below to ensure we never run into unforeseen | 161 // Note: We use "CHECK" below to ensure we never run into unforeseen |
| 162 // occurrences of asynchronous callbacks, which could lead to data | 162 // occurrences of asynchronous callbacks, which could lead to data |
| 163 // corruption. | 163 // corruption. |
| 164 CHECK_EQ(channel_, channel); | 164 CHECK_EQ(channel_, channel); |
| 165 socket()->OnChannelWriteComplete(refcon, status); | 165 socket()->OnChannelWriteComplete(refcon, status); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace device | 168 } // namespace device |
| OLD | NEW |