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

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell_gl.h

Issue 2574313002: Clean up threading around VR Scene updates. (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 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 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "device/vr/android/gvr/gvr_delegate.h" 15 #include "device/vr/android/gvr/gvr_delegate.h"
16 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr.h" 16 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr.h"
17 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_ty pes.h" 17 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_ty pes.h"
18 #include "ui/gfx/native_widget_types.h" 18 #include "ui/gfx/native_widget_types.h"
19 19
20 namespace base {
21 class ListValue;
22 }
23
20 namespace blink { 24 namespace blink {
21 class WebInputEvent; 25 class WebInputEvent;
22 } 26 }
23 27
24 namespace gl { 28 namespace gl {
25 class GLContext; 29 class GLContext;
26 class GLSurface; 30 class GLSurface;
27 class ScopedJavaSurface; 31 class ScopedJavaSurface;
28 class SurfaceTexture; 32 class SurfaceTexture;
29 } 33 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void UIBoundsChanged(int width, int height); 74 void UIBoundsChanged(int width, int height);
71 void UIPhysicalBoundsChanged(int width, int height); 75 void UIPhysicalBoundsChanged(int width, int height);
72 base::WeakPtr<VrShellGl> GetWeakPtr(); 76 base::WeakPtr<VrShellGl> GetWeakPtr();
73 77
74 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds, 78 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds,
75 const gvr::Rectf& right_bounds); 79 const gvr::Rectf& right_bounds);
76 gvr::GvrApi* gvr_api(); 80 gvr::GvrApi* gvr_api();
77 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num); 81 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num);
78 gvr::Sizei GetWebVRCompositorSurfaceSize(); 82 gvr::Sizei GetWebVRCompositorSurfaceSize();
79 83
80 UiScene* GetScene() { return scene_.get(); } 84 void UpdateScene(std::unique_ptr<base::ListValue> commands);
81 85
82 private: 86 private:
83 bool InitializeGl(); 87 bool InitializeGl();
84 void GvrInit(gvr_context* gvr_api); 88 void GvrInit(gvr_context* gvr_api);
85 void InitializeRenderer(); 89 void InitializeRenderer();
86 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame); 90 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame);
87 void DrawUiView(const gvr::Mat4f* head_pose, 91 void DrawUiView(const gvr::Mat4f* head_pose,
88 const std::vector<const ContentRectangle*>& elements, 92 const std::vector<const ContentRectangle*>& elements,
89 const gvr::Sizei& render_size, int viewport_offset); 93 const gvr::Sizei& render_size, int viewport_offset);
90 void DrawElements(const gvr::Mat4f& render_matrix, 94 void DrawElements(const gvr::Mat4f& render_matrix,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 178 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
175 179
176 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; 180 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_;
177 181
178 DISALLOW_COPY_AND_ASSIGN(VrShellGl); 182 DISALLOW_COPY_AND_ASSIGN(VrShellGl);
179 }; 183 };
180 184
181 } // namespace vr_shell 185 } // namespace vr_shell
182 186
183 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ 187 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.cc ('k') | chrome/browser/android/vr_shell/vr_shell_gl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698