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

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: Remove retain 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..c8957f5a7e68d0853960b917d0b425a39701aeed 100644
--- a/device/bluetooth/test/bluetooth_test_mac.mm
+++ b/device/bluetooth/test/bluetooth_test_mac.mm
@@ -41,18 +41,19 @@ explicit ScopedMockCentralManager(MockCentralManager* mock_central_manager) {
namespace {
-NSDictionary* CreateAdvertisementData(NSString* name, NSArray* uuids) {
- NSMutableDictionary* advertisement_data =
+scoped_nsobject<NSDictionary> CreateAdvertisementData(NSString* name,
jlebel 2016/06/01 02:50:01 Nit: Since there is no question about retain/relea
ccameron 2016/06/02 23:11:18 n/a now.
+ NSArray* uuids) {
+ scoped_nsobject<NSMutableDictionary> advertisement_data(
[NSMutableDictionary dictionaryWithDictionary:@{
CBAdvertisementDataLocalNameKey : name,
CBAdvertisementDataServiceDataKey : @{},
CBAdvertisementDataIsConnectable : @(YES),
- }];
+ }]);
if (uuids) {
[advertisement_data setObject:uuids
forKey:CBAdvertisementDataServiceUUIDsKey];
}
- return [advertisement_data retain];
+ return scoped_nsobject<NSDictionary>(advertisement_data);
sky 2016/06/01 03:35:33 This seems weird. is there nothing like std::move
ccameron 2016/06/02 23:11:18 This was a cast from NSMutableDictionary to its su
}
} // 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