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

Side by Side Diff: device/bluetooth/bluetooth_socket_mac.mm

Issue 13983004: Simplified BluetoothDeviceMac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: set delegate to nil. Created 7 years, 8 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 | « device/bluetooth/bluetooth_device_mac.mm ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_socket_mac.h" 5 #include "device/bluetooth/bluetooth_socket_mac.h"
6 6
7 #import <IOBluetooth/objc/IOBluetoothDevice.h> 7 #import <IOBluetooth/objc/IOBluetoothDevice.h>
8 #import <IOBluetooth/objc/IOBluetoothRFCOMMChannel.h> 8 #import <IOBluetooth/objc/IOBluetoothRFCOMMChannel.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 namespace device { 46 namespace device {
47 47
48 BluetoothSocketMac::BluetoothSocketMac(IOBluetoothRFCOMMChannel* rfcomm_channel) 48 BluetoothSocketMac::BluetoothSocketMac(IOBluetoothRFCOMMChannel* rfcomm_channel)
49 : rfcomm_channel_(rfcomm_channel), 49 : rfcomm_channel_(rfcomm_channel),
50 delegate_([[BluetoothRFCOMMChannelDelegate alloc] initWithSocket:this]) { 50 delegate_([[BluetoothRFCOMMChannelDelegate alloc] initWithSocket:this]) {
51 [rfcomm_channel_ setDelegate:delegate_]; 51 [rfcomm_channel_ setDelegate:delegate_];
52 ResetIncomingDataBuffer(); 52 ResetIncomingDataBuffer();
53 } 53 }
54 54
55 BluetoothSocketMac::~BluetoothSocketMac() { 55 BluetoothSocketMac::~BluetoothSocketMac() {
56 [rfcomm_channel_ setDelegate:nil];
57 [rfcomm_channel_ closeChannel];
56 [rfcomm_channel_ release]; 58 [rfcomm_channel_ release];
57 [delegate_ release]; 59 [delegate_ release];
58 } 60 }
59 61
60 // static 62 // static
61 scoped_refptr<BluetoothSocket> BluetoothSocketMac::CreateBluetoothSocket( 63 scoped_refptr<BluetoothSocket> BluetoothSocketMac::CreateBluetoothSocket(
62 const BluetoothServiceRecord& service_record) { 64 const BluetoothServiceRecord& service_record) {
63 BluetoothSocketMac* bluetooth_socket = NULL; 65 BluetoothSocketMac* bluetooth_socket = NULL;
64 if (service_record.SupportsRfcomm()) { 66 if (service_record.SupportsRfcomm()) {
65 const BluetoothServiceRecordMac* service_record_mac = 67 const BluetoothServiceRecordMac* service_record_mac =
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 incoming_data_buffer_->set_offset( 134 incoming_data_buffer_->set_offset(
133 incoming_data_buffer_->offset() + data_size); 135 incoming_data_buffer_->offset() + data_size);
134 } 136 }
135 137
136 void BluetoothSocketMac::ResetIncomingDataBuffer() { 138 void BluetoothSocketMac::ResetIncomingDataBuffer() {
137 incoming_data_buffer_ = new net::GrowableIOBuffer(); 139 incoming_data_buffer_ = new net::GrowableIOBuffer();
138 incoming_data_buffer_->SetCapacity(1024); 140 incoming_data_buffer_->SetCapacity(1024);
139 } 141 }
140 142
141 } // namespace device 143 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698