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

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

Issue 2729523002: Re-land^2 WebVR compositor bypass via BrowserMain context + mailbox (Closed)
Patch Set: Rebase to 11e28fd6b9380b77273db51ef0b6ccc7ea341944 Created 3 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
« 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 »
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
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 void VRDisplayImpl::ResetPose() { 36 void VRDisplayImpl::ResetPose() {
37 if (!device_->IsAccessAllowed(this)) 37 if (!device_->IsAccessAllowed(this))
38 return; 38 return;
39 39
40 device_->ResetPose(); 40 device_->ResetPose();
41 } 41 }
42 42
43 void VRDisplayImpl::RequestPresent(bool secure_origin, 43 void VRDisplayImpl::RequestPresent(bool secure_origin,
44 mojom::VRSubmitFrameClientPtr submit_client,
44 const RequestPresentCallback& callback) { 45 const RequestPresentCallback& callback) {
45 if (!device_->IsAccessAllowed(this)) { 46 if (!device_->IsAccessAllowed(this)) {
46 callback.Run(false); 47 callback.Run(false);
47 return; 48 return;
48 } 49 }
49 50
50 device_->RequestPresent(base::Bind(&VRDisplayImpl::RequestPresentResult, 51 device_->RequestPresent(
51 weak_ptr_factory_.GetWeakPtr(), callback, 52 std::move(submit_client),
52 secure_origin)); 53 base::Bind(&VRDisplayImpl::RequestPresentResult,
54 weak_ptr_factory_.GetWeakPtr(), callback, secure_origin));
53 } 55 }
54 56
55 void VRDisplayImpl::RequestPresentResult(const RequestPresentCallback& callback, 57 void VRDisplayImpl::RequestPresentResult(const RequestPresentCallback& callback,
56 bool secure_origin, 58 bool secure_origin,
57 bool success) { 59 bool success) {
58 if (success) { 60 if (success) {
59 device_->SetPresentingDisplay(this); 61 device_->SetPresentingDisplay(this);
60 device_->SetSecureOrigin(secure_origin); 62 device_->SetSecureOrigin(secure_origin);
61 } 63 }
62 callback.Run(success); 64 callback.Run(success);
63 } 65 }
64 66
65 void VRDisplayImpl::ExitPresent() { 67 void VRDisplayImpl::ExitPresent() {
66 if (device_->CheckPresentingDisplay(this)) 68 if (device_->CheckPresentingDisplay(this))
67 device_->ExitPresent(); 69 device_->ExitPresent();
68 } 70 }
69 71
70 void VRDisplayImpl::SubmitFrame(mojom::VRPosePtr pose) { 72 void VRDisplayImpl::SubmitFrame(int16_t frame_index,
73 const gpu::MailboxHolder& mailbox) {
71 if (!device_->CheckPresentingDisplay(this)) 74 if (!device_->CheckPresentingDisplay(this))
72 return; 75 return;
73 device_->SubmitFrame(std::move(pose)); 76 device_->SubmitFrame(frame_index, mailbox);
74 } 77 }
75 78
76 void VRDisplayImpl::UpdateLayerBounds(int16_t frame_index, 79 void VRDisplayImpl::UpdateLayerBounds(int16_t frame_index,
77 mojom::VRLayerBoundsPtr left_bounds, 80 mojom::VRLayerBoundsPtr left_bounds,
78 mojom::VRLayerBoundsPtr right_bounds) { 81 mojom::VRLayerBoundsPtr right_bounds,
82 int16_t source_width,
83 int16_t source_height) {
79 if (!device_->IsAccessAllowed(this)) 84 if (!device_->IsAccessAllowed(this))
80 return; 85 return;
81 86
82 device_->UpdateLayerBounds(frame_index, std::move(left_bounds), 87 device_->UpdateLayerBounds(frame_index, std::move(left_bounds),
83 std::move(right_bounds)); 88 std::move(right_bounds), source_width,
89 source_height);
84 } 90 }
85 91
86 void VRDisplayImpl::GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) { 92 void VRDisplayImpl::GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) {
87 if (!device_->IsAccessAllowed(this)) { 93 if (!device_->IsAccessAllowed(this)) {
88 return; 94 return;
89 } 95 }
90 device_->GetVRVSyncProvider(std::move(request)); 96 device_->GetVRVSyncProvider(std::move(request));
91 } 97 }
92 } 98 }
OLDNEW
« 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