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

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

Issue 2550803002: WebVR: avoid race conditions for partially-initialized display (Closed)
Patch Set: 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 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/vr_shell.h" 5 #include "chrome/browser/android/vr_shell/vr_shell.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "chrome/browser/android/vr_shell/ui_elements.h" 8 #include "chrome/browser/android/vr_shell/ui_elements.h"
9 #include "chrome/browser/android/vr_shell/ui_interface.h" 9 #include "chrome/browser/android/vr_shell/ui_interface.h"
10 #include "chrome/browser/android/vr_shell/ui_scene.h" 10 #include "chrome/browser/android/vr_shell/ui_scene.h"
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 void VrShell::DrawFrame(JNIEnv* env, const JavaParamRef<jobject>& obj) { 562 void VrShell::DrawFrame(JNIEnv* env, const JavaParamRef<jobject>& obj) {
563 TRACE_EVENT0("gpu", "VrShell::DrawFrame"); 563 TRACE_EVENT0("gpu", "VrShell::DrawFrame");
564 // Reset the viewport list to just the pair of viewports for the 564 // Reset the viewport list to just the pair of viewports for the
565 // primary buffer each frame. Head-locked viewports get added by 565 // primary buffer each frame. Head-locked viewports get added by
566 // DrawVrShell if needed. 566 // DrawVrShell if needed.
567 buffer_viewport_list_->SetToRecommendedBufferViewports(); 567 buffer_viewport_list_->SetToRecommendedBufferViewports();
568 568
569 if (html_interface_->GetMode() == UiInterface::Mode::WEB_VR) { 569 if (html_interface_->GetMode() == UiInterface::Mode::WEB_VR) {
570 // If needed, resize the primary buffer for use with WebVR. 570 // If needed, resize the primary buffer for use with WebVR.
571 if (render_size_primary_ != render_size_primary_webvr_) { 571 if (render_size_primary_ != render_size_primary_webvr_) {
572 if (!render_size_primary_webvr_.width) {
573 VLOG(2) << "WebVR rendering size not known yet, dropping frame";
574 return;
575 }
572 render_size_primary_ = render_size_primary_webvr_; 576 render_size_primary_ = render_size_primary_webvr_;
573 swap_chain_->ResizeBuffer(kFramePrimaryBuffer, render_size_primary_); 577 swap_chain_->ResizeBuffer(kFramePrimaryBuffer, render_size_primary_);
574 } 578 }
575 } else { 579 } else {
576 if (render_size_primary_ != render_size_primary_vrshell_) { 580 if (render_size_primary_ != render_size_primary_vrshell_) {
577 render_size_primary_ = render_size_primary_vrshell_; 581 render_size_primary_ = render_size_primary_vrshell_;
578 swap_chain_->ResizeBuffer(kFramePrimaryBuffer, render_size_primary_); 582 swap_chain_->ResizeBuffer(kFramePrimaryBuffer, render_size_primary_);
579 } 583 }
580 } 584 }
581 585
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 const JavaParamRef<jobject>& ui_web_contents, 1053 const JavaParamRef<jobject>& ui_web_contents,
1050 jlong ui_window_android) { 1054 jlong ui_window_android) {
1051 return reinterpret_cast<intptr_t>(new VrShell( 1055 return reinterpret_cast<intptr_t>(new VrShell(
1052 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), 1056 env, obj, content::WebContents::FromJavaWebContents(content_web_contents),
1053 reinterpret_cast<ui::WindowAndroid*>(content_window_android), 1057 reinterpret_cast<ui::WindowAndroid*>(content_window_android),
1054 content::WebContents::FromJavaWebContents(ui_web_contents), 1058 content::WebContents::FromJavaWebContents(ui_web_contents),
1055 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); 1059 reinterpret_cast<ui::WindowAndroid*>(ui_window_android)));
1056 } 1060 }
1057 1061
1058 } // namespace vr_shell 1062 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.h ('k') | chrome/browser/android/vr_shell/vr_shell_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698