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

Unified Diff: device/vr/vr_display_impl.cc

Issue 2537723002: Refine VRDevice Class (Closed)
Patch Set: Rebase Created 4 years 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
« no previous file with comments | « device/vr/vr_display_impl.h ('k') | device/vr/vr_display_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/vr_display_impl.cc
diff --git a/device/vr/vr_display_impl.cc b/device/vr/vr_display_impl.cc
index 9c4b2c4960e98e5c7be7c2ed8c5515d33eb0f612..d964da92220c8451a7222269392f33c8cb3ee6c8 100644
--- a/device/vr/vr_display_impl.cc
+++ b/device/vr/vr_display_impl.cc
@@ -16,8 +16,6 @@ VRDisplayImpl::VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service)
service_(service),
weak_ptr_factory_(this) {
mojom::VRDisplayInfoPtr display_info = device->GetVRDevice();
- // Client might be null in unittest.
- // TODO: setup a mock client in unittest too?
if (service->client()) {
service->client()->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(),
mojo::GetProxy(&client_),
@@ -28,7 +26,7 @@ VRDisplayImpl::VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service)
VRDisplayImpl::~VRDisplayImpl() {}
void VRDisplayImpl::GetPose(const GetPoseCallback& callback) {
- if (!device_->IsAccessAllowed(service_)) {
+ if (!device_->IsAccessAllowed(this)) {
callback.Run(nullptr);
return;
}
@@ -37,7 +35,7 @@ void VRDisplayImpl::GetPose(const GetPoseCallback& callback) {
}
void VRDisplayImpl::ResetPose() {
- if (!device_->IsAccessAllowed(service_))
+ if (!device_->IsAccessAllowed(this))
return;
device_->ResetPose();
@@ -45,7 +43,7 @@ void VRDisplayImpl::ResetPose() {
void VRDisplayImpl::RequestPresent(bool secure_origin,
const RequestPresentCallback& callback) {
- if (!device_->IsAccessAllowed(service_)) {
+ if (!device_->IsAccessAllowed(this)) {
callback.Run(false);
return;
}
@@ -59,26 +57,26 @@ void VRDisplayImpl::RequestPresentResult(const RequestPresentCallback& callback,
bool secure_origin,
bool success) {
if (success) {
- device_->SetPresentingService(service_);
+ device_->SetPresentingDisplay(this);
device_->SetSecureOrigin(secure_origin);
}
callback.Run(success);
}
void VRDisplayImpl::ExitPresent() {
- if (device_->IsPresentingService(service_))
+ if (device_->CheckPresentingDisplay(this))
device_->ExitPresent();
}
void VRDisplayImpl::SubmitFrame(mojom::VRPosePtr pose) {
- if (!device_->IsPresentingService(service_))
+ if (!device_->CheckPresentingDisplay(this))
return;
device_->SubmitFrame(std::move(pose));
}
void VRDisplayImpl::UpdateLayerBounds(mojom::VRLayerBoundsPtr left_bounds,
mojom::VRLayerBoundsPtr right_bounds) {
- if (!device_->IsAccessAllowed(service_))
+ if (!device_->IsAccessAllowed(this))
return;
device_->UpdateLayerBounds(std::move(left_bounds), std::move(right_bounds));
« no previous file with comments | « device/vr/vr_display_impl.h ('k') | device/vr/vr_display_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698