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

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

Issue 2658643003: Refactor GvrDelegate ownership into GvrDelegateProvider and fix more threading violations. (Closed)
Patch Set: Address comments Created 3 years, 10 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/vr/vr_display_impl.h ('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 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 <utility> 5 #include <utility>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "device/vr/vr_device.h" 8 #include "device/vr/vr_device.h"
9 #include "device/vr/vr_service_impl.h" 9 #include "device/vr/vr_service_impl.h"
10 10
11 namespace device { 11 namespace device {
12 12
13 VRDisplayImpl::VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service) 13 VRDisplayImpl::VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service)
14 : binding_(this), 14 : binding_(this),
15 device_(device), 15 device_(device),
16 service_(service), 16 service_(service),
17 weak_ptr_factory_(this) { 17 weak_ptr_factory_(this) {
18 mojom::VRDisplayInfoPtr display_info = device->GetVRDevice(); 18 base::Callback<void(mojom::VRDisplayInfoPtr)> callback = base::Bind(
19 if (service->client()) { 19 &VRDisplayImpl::OnVRDisplayInfoCreated, weak_ptr_factory_.GetWeakPtr());
20 service->client()->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(), 20 device->GetVRDevice(callback);
21 mojo::MakeRequest(&client_), 21 }
22 std::move(display_info)); 22
23 void VRDisplayImpl::OnVRDisplayInfoCreated(
24 mojom::VRDisplayInfoPtr display_info) {
25 if (service_->client()) {
26 service_->client()->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(),
27 mojo::MakeRequest(&client_),
28 std::move(display_info));
23 } 29 }
24 } 30 }
25 31
26 VRDisplayImpl::~VRDisplayImpl() { 32 VRDisplayImpl::~VRDisplayImpl() {
27 device_->RemoveDisplay(this); 33 device_->RemoveDisplay(this);
28 } 34 }
29 35
30 void VRDisplayImpl::ResetPose() { 36 void VRDisplayImpl::ResetPose() {
31 if (!device_->IsAccessAllowed(this)) 37 if (!device_->IsAccessAllowed(this))
32 return; 38 return;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 std::move(right_bounds)); 83 std::move(right_bounds));
78 } 84 }
79 85
80 void VRDisplayImpl::GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) { 86 void VRDisplayImpl::GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) {
81 if (!device_->IsAccessAllowed(this)) { 87 if (!device_->IsAccessAllowed(this)) {
82 return; 88 return;
83 } 89 }
84 device_->GetVRVSyncProvider(std::move(request)); 90 device_->GetVRVSyncProvider(std::move(request));
85 } 91 }
86 } 92 }
OLDNEW
« no previous file with comments | « device/vr/vr_display_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698