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

Unified Diff: chrome/browser/android/vr_shell/vr_shell_gl.cc

Issue 2683953007: Support rendering Android Native Pages in VR Shell. (Closed)
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell_gl.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc
index 4564af0162f5c35aab779ce0b28045de7f093c98..ebad9609b13279e95d7d7fa6ed4ec067045798a4 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -242,24 +242,16 @@ void VrShellGl::InitializeGl(gfx::AcceleratedWidget window) {
content_texture_id_ = textures[1];
ui_surface_texture_ = gl::SurfaceTexture::Create(ui_texture_id_);
content_surface_texture_ = gl::SurfaceTexture::Create(content_texture_id_);
- ui_surface_.reset(new gl::ScopedJavaSurface(ui_surface_texture_.get()));
- content_surface_.reset(new gl::ScopedJavaSurface(
- content_surface_texture_.get()));
+ CreateUiSurface();
+ CreateContentSurface();
ui_surface_texture_->SetFrameAvailableCallback(base::Bind(
- &VrShellGl::OnUIFrameAvailable, weak_ptr_factory_.GetWeakPtr()));
+ &VrShellGl::OnUIFrameAvailable, weak_ptr_factory_.GetWeakPtr()));
content_surface_texture_->SetFrameAvailableCallback(base::Bind(
&VrShellGl::OnContentFrameAvailable, weak_ptr_factory_.GetWeakPtr()));
-
content_surface_texture_->SetDefaultBufferSize(
content_tex_physical_size_.width, content_tex_physical_size_.height);
ui_surface_texture_->SetDefaultBufferSize(ui_tex_physical_size_.width,
ui_tex_physical_size_.height);
-
- main_thread_task_runner_->PostTask(FROM_HERE, base::Bind(
- &VrShell::SurfacesChanged, weak_vr_shell_,
- content_surface_->j_surface().obj(),
- ui_surface_->j_surface().obj()));
-
InitializeRenderer();
vsync_task_.Reset(base::Bind(&VrShellGl::OnVSync, base::Unretained(this)));
@@ -268,6 +260,22 @@ void VrShellGl::InitializeGl(gfx::AcceleratedWidget window) {
ready_to_draw_ = true;
}
+void VrShellGl::CreateContentSurface() {
+ content_surface_ =
+ base::MakeUnique<gl::ScopedJavaSurface>(content_surface_texture_.get());
+ main_thread_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&VrShell::ContentSurfaceChanged, weak_vr_shell_,
+ content_surface_->j_surface().obj()));
+}
+
+void VrShellGl::CreateUiSurface() {
+ ui_surface_ =
+ base::MakeUnique<gl::ScopedJavaSurface>(ui_surface_texture_.get());
+ main_thread_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&VrShell::UiSurfaceChanged, weak_vr_shell_,
+ ui_surface_->j_surface().obj()));
+}
+
void VrShellGl::OnUIFrameAvailable() {
ui_surface_texture_->UpdateTexImage();
}
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698