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

Side by Side Diff: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid er.h" 5 #include "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid er.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 if (services.size() > 0) { 461 if (services.size() > 0) {
462 return services; 462 return services;
463 } 463 }
464 464
465 scoped_ptr<NiceMockBluetoothGattService> heart_rate( 465 scoped_ptr<NiceMockBluetoothGattService> heart_rate(
466 GetBaseGATTService(device_ptr, kHeartRateServiceUUID)); 466 GetBaseGATTService(device_ptr, kHeartRateServiceUUID));
467 467
468 device_ptr->AddMockService(std::move(heart_rate)); 468 device_ptr->AddMockService(std::move(heart_rate));
469 base::ThreadTaskRunnerHandle::Get()->PostTask( 469 base::ThreadTaskRunnerHandle::Get()->PostTask(
470 FROM_HERE, base::Bind(&NotifyServicesDiscovered, 470 FROM_HERE, base::Bind(&NotifyServicesDiscovered,
471 make_scoped_refptr(adapter_ptr), device_ptr)); 471 base::RetainedRef(adapter_ptr), device_ptr));
472 472
473 DCHECK(services.size() == 0); 473 DCHECK(services.size() == 0);
474 return services; 474 return services;
475 })); 475 }));
476 476
477 adapter->AddMockDevice(std::move(device)); 477 adapter->AddMockDevice(std::move(device));
478 478
479 return adapter; 479 return adapter;
480 } 480 }
481 481
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 scoped_ptr<NiceMockBluetoothDevice> device( 648 scoped_ptr<NiceMockBluetoothDevice> device(
649 GetBaseDevice(adapter, device_name, uuids, address)); 649 GetBaseDevice(adapter, device_name, uuids, address));
650 650
651 MockBluetoothDevice* device_ptr = device.get(); 651 MockBluetoothDevice* device_ptr = device.get();
652 652
653 ON_CALL(*device, CreateGattConnection(_, _)) 653 ON_CALL(*device, CreateGattConnection(_, _))
654 .WillByDefault(RunCallbackWithResult<0 /* success_callback */>( 654 .WillByDefault(RunCallbackWithResult<0 /* success_callback */>(
655 [adapter, device_ptr]() { 655 [adapter, device_ptr]() {
656 base::ThreadTaskRunnerHandle::Get()->PostTask( 656 base::ThreadTaskRunnerHandle::Get()->PostTask(
657 FROM_HERE, base::Bind(&NotifyServicesDiscovered, 657 FROM_HERE, base::Bind(&NotifyServicesDiscovered,
658 make_scoped_refptr(adapter), device_ptr)); 658 base::RetainedRef(adapter), device_ptr));
659 return make_scoped_ptr(new NiceMockBluetoothGattConnection( 659 return make_scoped_ptr(new NiceMockBluetoothGattConnection(
660 adapter, device_ptr->GetAddress())); 660 adapter, device_ptr->GetAddress()));
661 })); 661 }));
662 662
663 return device; 663 return device;
664 } 664 }
665 665
666 // static 666 // static
667 scoped_ptr<NiceMockBluetoothDevice> 667 scoped_ptr<NiceMockBluetoothDevice>
668 LayoutTestBluetoothAdapterProvider::GetUnconnectableDevice( 668 LayoutTestBluetoothAdapterProvider::GetUnconnectableDevice(
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 return BluetoothUUID(); 1035 return BluetoothUUID();
1036 } 1036 }
1037 1037
1038 // static 1038 // static
1039 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { 1039 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) {
1040 return BluetoothDevice::CanonicalizeAddress( 1040 return BluetoothDevice::CanonicalizeAddress(
1041 base::StringPrintf("%012" PRIx64, addr)); 1041 base::StringPrintf("%012" PRIx64, addr));
1042 } 1042 }
1043 1043
1044 } // namespace content 1044 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698