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

Side by Side Diff: device/vr/vr_service_impl.cc

Issue 2851173004: Eliminate bind callback that doesn't take a BindSourceInfo parameter. (Closed)
Patch Set: . Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "device/vr/vr_service_impl.h" 5 #include "device/vr/vr_service_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "device/vr/vr_device.h" 11 #include "device/vr/vr_device.h"
12 #include "device/vr/vr_device_manager.h" 12 #include "device/vr/vr_device_manager.h"
13 #include "mojo/public/cpp/bindings/strong_binding.h" 13 #include "mojo/public/cpp/bindings/strong_binding.h"
14 14
15 namespace device { 15 namespace device {
16 16
17 VRServiceImpl::VRServiceImpl() 17 VRServiceImpl::VRServiceImpl()
18 : listening_for_activate_(false), weak_ptr_factory_(this) {} 18 : listening_for_activate_(false), weak_ptr_factory_(this) {}
19 19
20 VRServiceImpl::~VRServiceImpl() { 20 VRServiceImpl::~VRServiceImpl() {
21 // Destroy VRDisplay before calling RemoveService below. RemoveService might 21 // Destroy VRDisplay before calling RemoveService below. RemoveService might
22 // implicitly trigger destory VRDevice which VRDisplay needs to access in its 22 // implicitly trigger destory VRDevice which VRDisplay needs to access in its
23 // dtor. 23 // dtor.
24 displays_.clear(); 24 displays_.clear();
25 VRDeviceManager::GetInstance()->RemoveService(this); 25 VRDeviceManager::GetInstance()->RemoveService(this);
26 } 26 }
27 27
28 void VRServiceImpl::Create(mojo::InterfaceRequest<mojom::VRService> request) { 28 void VRServiceImpl::Create(const service_manager::BindSourceInfo& source_info,
29 mojom::VRServiceRequest request) {
29 mojo::MakeStrongBinding(base::MakeUnique<VRServiceImpl>(), 30 mojo::MakeStrongBinding(base::MakeUnique<VRServiceImpl>(),
30 std::move(request)); 31 std::move(request));
31 } 32 }
32 33
33 void VRServiceImpl::SetClient(mojom::VRServiceClientPtr service_client, 34 void VRServiceImpl::SetClient(mojom::VRServiceClientPtr service_client,
34 const SetClientCallback& callback) { 35 const SetClientCallback& callback) {
35 DCHECK(!client_.get()); 36 DCHECK(!client_.get());
36 client_ = std::move(service_client); 37 client_ = std::move(service_client);
37 VRDeviceManager* device_manager = VRDeviceManager::GetInstance(); 38 VRDeviceManager* device_manager = VRDeviceManager::GetInstance();
38 // Once a client has been connected AddService will force any VRDisplays to 39 // Once a client has been connected AddService will force any VRDisplays to
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 displays_[device] = base::MakeUnique<VRDisplayImpl>( 79 displays_[device] = base::MakeUnique<VRDisplayImpl>(
79 device, this, client_.get(), std::move(display_info)); 80 device, this, client_.get(), std::move(display_info));
80 } 81 }
81 82
82 VRDisplayImpl* VRServiceImpl::GetVRDisplayImplForTesting(VRDevice* device) { 83 VRDisplayImpl* VRServiceImpl::GetVRDisplayImplForTesting(VRDevice* device) {
83 auto it = displays_.find(device); 84 auto it = displays_.find(device);
84 return (it == displays_.end()) ? nullptr : it->second.get(); 85 return (it == displays_.end()) ? nullptr : it->second.get();
85 } 86 }
86 87
87 } // namespace device 88 } // namespace device
OLDNEW
« no previous file with comments | « device/vr/vr_service_impl.h ('k') | extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698