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

Unified Diff: device/bluetooth/test/bluetooth_test_mac.mm

Issue 2028823003: Mac: Make ScopedTypeRef require explicit constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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
Index: device/bluetooth/test/bluetooth_test_mac.mm
diff --git a/device/bluetooth/test/bluetooth_test_mac.mm b/device/bluetooth/test/bluetooth_test_mac.mm
index 4a27f3be741b9b46614d225762a8a071b70e8f58..903dc53b0b026e2c525b82e41e301df7ff51d7c3 100644
--- a/device/bluetooth/test/bluetooth_test_mac.mm
+++ b/device/bluetooth/test/bluetooth_test_mac.mm
@@ -41,7 +41,8 @@ explicit ScopedMockCentralManager(MockCentralManager* mock_central_manager) {
namespace {
-NSDictionary* CreateAdvertisementData(NSString* name, NSArray* uuids) {
+scoped_nsobject<NSDictionary> CreateAdvertisementData(NSString* name,
+ NSArray* uuids) {
NSMutableDictionary* advertisement_data =
[NSMutableDictionary dictionaryWithDictionary:@{
CBAdvertisementDataLocalNameKey : name,
@@ -52,7 +53,7 @@ explicit ScopedMockCentralManager(MockCentralManager* mock_central_manager) {
[advertisement_data setObject:uuids
forKey:CBAdvertisementDataServiceUUIDsKey];
}
- return [advertisement_data retain];
+ return scoped_nsobject<NSDictionary>([advertisement_data retain]);
Reilly Grant (use Gerrit) 2016/06/01 01:05:15 I believe this retain was and still is unnecessary
ccameron 2016/06/01 01:59:31 Yeah, I suspected. Removed.
Eugene But (OOO till 7-30) 2016/06/01 05:12:06 Wait... this retain is still necessary (and actual
Reilly Grant (use Gerrit) 2016/06/01 15:34:42 I only pretend to understand Objective-C memory ma
Eugene But (OOO till 7-30) 2016/06/01 15:58:35 In Objective-C the method prefix tell if you are r
jlebel 2016/06/02 23:07:34 And "create" when we are using functions. That's t
ccameron 2016/06/02 23:11:18 I've added a base::scoped_policy::RETAIN here.
}
} // namespace
@@ -229,7 +230,7 @@ explicit ScopedMockCentralManager(MockCentralManager* mock_central_manager) {
static_cast<BluetoothLowEnergyDeviceMac*>(device);
CBPeripheral* peripheral = device_mac->GetPeripheral();
MockCBPeripheral* peripheral_mock = ObjCCast<MockCBPeripheral>(peripheral);
- scoped_nsobject<NSMutableArray> services = [[NSMutableArray alloc] init];
+ scoped_nsobject<NSMutableArray> services([[NSMutableArray alloc] init]);
for (auto uuid : uuids) {
CBUUID* cb_service_uuid = [CBUUID UUIDWithString:@(uuid.c_str())];
[services addObject:cb_service_uuid];

Powered by Google App Engine
This is Rietveld 408576698