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

Unified Diff: device/bluetooth/bluetooth_socket_mac.h

Issue 328903002: Factor out a BluetoothChannelMac base class and a BluetoothRfcommChannelMac subclass. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git-add new files Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_rfcomm_channel_mac.mm ('k') | device/bluetooth/bluetooth_socket_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_socket_mac.h
diff --git a/device/bluetooth/bluetooth_socket_mac.h b/device/bluetooth/bluetooth_socket_mac.h
index 803cd535d5becdef0e89de08b83bc9d518fe8799..a74d02083683801a24efa031bf8d5d98b647bf29 100644
--- a/device/bluetooth/bluetooth_socket_mac.h
+++ b/device/bluetooth/bluetooth_socket_mac.h
@@ -19,7 +19,6 @@
#include "device/bluetooth/bluetooth_socket.h"
#include "device/bluetooth/bluetooth_uuid.h"
-@class BluetoothRfcommChannelDelegate;
@class BluetoothRfcommConnectionListener;
namespace net {
@@ -30,6 +29,7 @@ class IOBufferWithSize;
namespace device {
class BluetoothAdapter;
+class BluetoothChannelMac;
// Implements the BluetoothSocket class for the Mac OS X platform.
class BluetoothSocketMac : public BluetoothSocket {
@@ -93,18 +93,15 @@ class BluetoothSocketMac : public BluetoothSocket {
const ErrorCompletionCallback& error_callback);
// Called by BluetoothRfcommConnectionListener.
- void OnRfcommChannelOpened(IOBluetoothRFCOMMChannel* rfcomm_channel);
-
- // Called by BluetoothRfcommChannelDelegate.
- void OnRfcommChannelOpenComplete(IOBluetoothRFCOMMChannel* rfcomm_channel,
- IOReturn status);
- void OnRfcommChannelClosed(IOBluetoothRFCOMMChannel* rfcomm_channel);
- void OnRfcommChannelDataReceived(IOBluetoothRFCOMMChannel* rfcomm_channel,
- void* data,
- size_t length);
- void OnRfcommChannelWriteComplete(IOBluetoothRFCOMMChannel* rfcomm_channel,
- void* refcon,
- IOReturn status);
+ void OnChannelOpened(scoped_ptr<BluetoothChannelMac> channel);
+
+ // Called by |channel_|.
+ // Note: OnChannelOpenComplete might be called before the |channel_| is set.
+ void OnChannelOpenComplete(const std::string& device_address,
+ IOReturn status);
+ void OnChannelClosed();
+ void OnChannelDataReceived(void* data, size_t length);
+ void OnChannelWriteComplete(void* refcon, IOReturn status);
private:
struct AcceptRequest {
@@ -166,16 +163,12 @@ class BluetoothSocketMac : public BluetoothSocket {
base::scoped_nsobject<BluetoothRfcommConnectionListener>
rfcomm_connection_listener_;
- // A simple delegate that forwards RFCOMM channel methods to |this| socket.
- base::scoped_nsobject<BluetoothRfcommChannelDelegate>
- rfcomm_channel_delegate_;
-
// A handle to the service record registered in the system SDP server.
// Used to eventually unregister the service.
BluetoothSDPServiceRecordHandle service_record_handle_;
- // The IOBluetooth RFCOMM channel used to issue commands.
- base::scoped_nsobject<IOBluetoothRFCOMMChannel> rfcomm_channel_;
+ // The channel used to issue commands.
+ scoped_ptr<BluetoothChannelMac> channel_;
// Connection callbacks -- when a pending async connection is active.
scoped_ptr<ConnectCallbacks> connect_callbacks_;
@@ -193,8 +186,8 @@ class BluetoothSocketMac : public BluetoothSocket {
// request.
scoped_ptr<AcceptRequest> accept_request_;
- // Queue of incoming RFCOMM connections.
- std::queue<base::scoped_nsobject<IOBluetoothRFCOMMChannel>> accept_queue_;
+ // Queue of incoming connections.
+ std::queue<linked_ptr<BluetoothChannelMac>> accept_queue_;
DISALLOW_COPY_AND_ASSIGN(BluetoothSocketMac);
};
« no previous file with comments | « device/bluetooth/bluetooth_rfcomm_channel_mac.mm ('k') | device/bluetooth/bluetooth_socket_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698