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

Side by Side Diff: chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc

Issue 2738683002: WebVR compositor bypass via BrowserMain context + mailbox (Closed)
Patch Set: Less hacked up version 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
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 "chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h" 5 #include "chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "chrome/browser/android/vr_shell/vr_shell.h" 10 #include "chrome/browser/android/vr_shell/vr_shell.h"
11 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr.h" 11 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr.h"
12 12
13 namespace vr_shell { 13 namespace vr_shell {
14 14
15 namespace { 15 namespace {
16 static constexpr int64_t kPredictionTimeWithoutVsyncNanos = 50000000; 16 static constexpr int64_t kPredictionTimeWithoutVsyncNanos = 50000000;
17 } // namespace 17 } // namespace
18 18
19 NonPresentingGvrDelegate::NonPresentingGvrDelegate(gvr_context* context) 19 NonPresentingGvrDelegate::NonPresentingGvrDelegate(gvr_context* context)
20 : task_runner_(base::ThreadTaskRunnerHandle::Get()), 20 : task_runner_(base::ThreadTaskRunnerHandle::Get()),
21 binding_(this), 21 binding_(this),
22 weak_ptr_factory_(this) { 22 weak_ptr_factory_(this) {
23 gvr_api_ = gvr::GvrApi::WrapNonOwned(context); 23 gvr_api_ = gvr::GvrApi::WrapNonOwned(context);
24 } 24 }
25 25
26 NonPresentingGvrDelegate::~NonPresentingGvrDelegate() { 26 NonPresentingGvrDelegate::~NonPresentingGvrDelegate() {
27 StopVSyncLoop(); 27 StopVSyncLoop();
28 } 28 }
29 29
30 void NonPresentingGvrDelegate::SubmitWebVRFrame(
31 int16_t frame_index,
32 const gpu::MailboxHolder& mailbox,
33 device::mojom::VRSubmitFrameClientPtr submit_client) {
34 submit_client->OnSubmitFrameTransferred();
35 submit_client->OnSubmitFrameRendered();
36 }
37
30 void NonPresentingGvrDelegate::OnVRVsyncProviderRequest( 38 void NonPresentingGvrDelegate::OnVRVsyncProviderRequest(
31 device::mojom::VRVSyncProviderRequest request) { 39 device::mojom::VRVSyncProviderRequest request) {
32 binding_.Close(); 40 binding_.Close();
33 binding_.Bind(std::move(request)); 41 binding_.Bind(std::move(request));
34 binding_.set_connection_error_handler( 42 binding_.set_connection_error_handler(
35 base::Bind(&NonPresentingGvrDelegate::StopVSyncLoop, 43 base::Bind(&NonPresentingGvrDelegate::StopVSyncLoop,
36 weak_ptr_factory_.GetWeakPtr())); 44 weak_ptr_factory_.GetWeakPtr()));
37 StartVSyncLoop(); 45 StartVSyncLoop();
38 } 46 }
39 47
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 162 }
155 163
156 void NonPresentingGvrDelegate::CreateVRDisplayInfo( 164 void NonPresentingGvrDelegate::CreateVRDisplayInfo(
157 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, 165 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
158 uint32_t device_id) { 166 uint32_t device_id) {
159 callback.Run(VrShell::CreateVRDisplayInfo( 167 callback.Run(VrShell::CreateVRDisplayInfo(
160 gvr_api_.get(), device::kInvalidRenderTargetSize, device_id)); 168 gvr_api_.get(), device::kInvalidRenderTargetSize, device_id));
161 } 169 }
162 170
163 } // namespace vr_shell 171 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h ('k') | chrome/browser/android/vr_shell/vr_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698