summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authortimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-01 07:20:17 +0000
committertimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-01 07:20:17 +0000
commit2398bb363bbd65a4d11afc07b452eb5f276d2659 (patch)
tree5e92732bf2309e042e137e89c34bda7610c9700c /device
parent7d578333f8ff8090a9ae9b44fec86d4efc126b52 (diff)
downloadchromium_src-2398bb363bbd65a4d11afc07b452eb5f276d2659.zip
chromium_src-2398bb363bbd65a4d11afc07b452eb5f276d2659.tar.gz
chromium_src-2398bb363bbd65a4d11afc07b452eb5f276d2659.tar.bz2
Revert 197554 "Implemented chrome.bluetooth.addProfile and chrom..."
This has introduced a few memory leaks on the Valgrind and HeapChecker bots. > Implemented chrome.bluetooth.addProfile and chrome.bluetooth.removeProfile. > > We will reject the registration of the profiles that have already been registered. > When there is an incoming connection, we will route that connection to the extension that registered the profile. > > BUG=229636 > > Review URL: https://chromiumcodereview.appspot.com/14311007 TBR=youngki@chromium.org Review URL: https://codereview.chromium.org/14682006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197580 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device')
-rw-r--r--device/bluetooth/bluetooth_profile.h9
-rw-r--r--device/bluetooth/bluetooth_profile_mac.h5
-rw-r--r--device/bluetooth/bluetooth_profile_mac.mm7
-rw-r--r--device/bluetooth/test/mock_bluetooth_profile.cc15
-rw-r--r--device/bluetooth/test/mock_bluetooth_profile.h25
-rw-r--r--device/device.gyp2
6 files changed, 7 insertions, 56 deletions
diff --git a/device/bluetooth/bluetooth_profile.h b/device/bluetooth/bluetooth_profile.h
index 46200b3..466bdf2 100644
--- a/device/bluetooth/bluetooth_profile.h
+++ b/device/bluetooth/bluetooth_profile.h
@@ -12,10 +12,8 @@
namespace device {
-class BluetoothDevice;
class BluetoothProfileMac;
class BluetoothSocket;
-class MockBluetoothProfile;
// BluetoothProfile represents an implementation of either a client or server
// of a particular specified profile (aka service or protocol in other
@@ -94,14 +92,11 @@ class BluetoothProfile {
// The socket will be closed when all references are released; none of the
// BluetoothProfile, or BluetoothAdapter or BluetoothDevice objects are
// guaranteed to hold a reference so this may outlive all of them.
- typedef base::Callback<void(
- const BluetoothDevice*,
- scoped_refptr<BluetoothSocket>)> ConnectionCallback;
- virtual void SetConnectionCallback(const ConnectionCallback& callback) = 0;
+ typedef base::Callback<void(scoped_refptr<BluetoothSocket>)> SocketCallback;
+ virtual void SetConnectionCallback(const SocketCallback& callback) = 0;
private:
friend class BluetoothProfileMac;
- friend class MockBluetoothProfile;
BluetoothProfile();
virtual ~BluetoothProfile();
diff --git a/device/bluetooth/bluetooth_profile_mac.h b/device/bluetooth/bluetooth_profile_mac.h
index 0085efd..34b6b34 100644
--- a/device/bluetooth/bluetooth_profile_mac.h
+++ b/device/bluetooth/bluetooth_profile_mac.h
@@ -23,8 +23,7 @@ class BluetoothProfileMac : public BluetoothProfile {
public:
// BluetoothProfile override.
virtual void Unregister() OVERRIDE;
- virtual void SetConnectionCallback(
- const ConnectionCallback& callback) OVERRIDE;
+ virtual void SetConnectionCallback(const SocketCallback& callback) OVERRIDE;
// Makes an outgoing connection to |device|.
// This method runs |socket_callback_| with the socket and returns true if the
@@ -39,7 +38,7 @@ class BluetoothProfileMac : public BluetoothProfile {
const std::string uuid_;
const std::string name_;
- ConnectionCallback connection_callback_;
+ SocketCallback socket_callback_;
};
} // namespace device
diff --git a/device/bluetooth/bluetooth_profile_mac.mm b/device/bluetooth/bluetooth_profile_mac.mm
index c0658a9..ca50f06 100644
--- a/device/bluetooth/bluetooth_profile_mac.mm
+++ b/device/bluetooth/bluetooth_profile_mac.mm
@@ -59,8 +59,8 @@ void BluetoothProfileMac::Unregister() {
}
void BluetoothProfileMac::SetConnectionCallback(
- const ConnectionCallback& callback) {
- connection_callback_ = callback;
+ const SocketCallback& callback) {
+ socket_callback_ = callback;
}
bool BluetoothProfileMac::Connect(IOBluetoothDevice* device) {
@@ -70,8 +70,7 @@ bool BluetoothProfileMac::Connect(IOBluetoothDevice* device) {
scoped_refptr<BluetoothSocket> socket(
BluetoothSocketMac::CreateBluetoothSocket(record));
if (socket.get() != NULL) {
- BluetoothDeviceMac device_mac(device);
- connection_callback_.Run(&device_mac, socket);
+ socket_callback_.Run(socket);
return true;
}
}
diff --git a/device/bluetooth/test/mock_bluetooth_profile.cc b/device/bluetooth/test/mock_bluetooth_profile.cc
deleted file mode 100644
index bf2af21..0000000
--- a/device/bluetooth/test/mock_bluetooth_profile.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "device/bluetooth/test/mock_bluetooth_profile.h"
-
-namespace device {
-
-MockBluetoothProfile::MockBluetoothProfile() {
-}
-
-MockBluetoothProfile::~MockBluetoothProfile() {
-}
-
-} // namespace device
diff --git a/device/bluetooth/test/mock_bluetooth_profile.h b/device/bluetooth/test/mock_bluetooth_profile.h
deleted file mode 100644
index 92b7505..0000000
--- a/device/bluetooth/test/mock_bluetooth_profile.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_PROFILE_H_
-#define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_PROFILE_H_
-
-#include "device/bluetooth/bluetooth_profile.h"
-#include "testing/gmock/include/gmock/gmock.h"
-
-namespace device {
-
-class MockBluetoothProfile : public BluetoothProfile {
- public:
- MockBluetoothProfile();
- virtual ~MockBluetoothProfile();
-
- MOCK_METHOD0(Unregister, void());
- MOCK_METHOD1(SetConnectionCallback,
- void(const BluetoothProfile::ConnectionCallback&));
-};
-
-} // namespace device
-
-#endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_PROFILE_H_
diff --git a/device/device.gyp b/device/device.gyp
index 6afb8a0..3f3d010 100644
--- a/device/device.gyp
+++ b/device/device.gyp
@@ -110,8 +110,6 @@
'bluetooth/test/mock_bluetooth_adapter.h',
'bluetooth/test/mock_bluetooth_device.cc',
'bluetooth/test/mock_bluetooth_device.h',
- 'bluetooth/test/mock_bluetooth_profile.cc',
- 'bluetooth/test/mock_bluetooth_profile.h',
'bluetooth/test/mock_bluetooth_socket.cc',
'bluetooth/test/mock_bluetooth_socket.h',
],