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

Side by Side Diff: device/test/usb_test_gadget_impl.cc

Issue 2254833003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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
« no previous file with comments | « device/geolocation/location_arbitrator_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 session_id_ = base::StringPrintf("%d-%d", process_id, next_session_id++); 211 session_id_ = base::StringPrintf("%d-%d", process_id, next_session_id++);
212 212
213 observer_.Add(usb_service_); 213 observer_.Add(usb_service_);
214 } 214 }
215 215
216 ~UsbGadgetFactory() override {} 216 ~UsbGadgetFactory() override {}
217 217
218 std::unique_ptr<UsbTestGadget> WaitForDevice() { 218 std::unique_ptr<UsbTestGadget> WaitForDevice() {
219 EnumerateDevices(); 219 EnumerateDevices();
220 run_loop_.Run(); 220 run_loop_.Run();
221 return base::WrapUnique( 221 return base::MakeUnique<UsbTestGadgetImpl>(request_context_getter_,
222 new UsbTestGadgetImpl(request_context_getter_, usb_service_, device_)); 222 usb_service_, device_);
223 } 223 }
224 224
225 private: 225 private:
226 void EnumerateDevices() { 226 void EnumerateDevices() {
227 if (!device_) { 227 if (!device_) {
228 usb_service_->GetDevices(base::Bind( 228 usb_service_->GetDevices(base::Bind(
229 &UsbGadgetFactory::OnDevicesEnumerated, weak_factory_.GetWeakPtr())); 229 &UsbGadgetFactory::OnDevicesEnumerated, weak_factory_.GetWeakPtr()));
230 } 230 }
231 } 231 }
232 232
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 return false; 613 return false;
614 } 614 }
615 615
616 DeviceAddListener add_listener(usb_service_, device_address_, -1); 616 DeviceAddListener add_listener(usb_service_, device_address_, -1);
617 device_ = add_listener.WaitForAdd(); 617 device_ = add_listener.WaitForAdd();
618 DCHECK(device_.get()); 618 DCHECK(device_.get());
619 return true; 619 return true;
620 } 620 }
621 621
622 } // namespace device 622 } // namespace device
OLDNEW
« no previous file with comments | « device/geolocation/location_arbitrator_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698