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

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

Issue 2833773005: Pause drawing webvr when the App button is pressed (Closed)
Patch Set: Add unittest + cleanup Created 3 years, 7 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 #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 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
(...skipping 26 matching lines...) Expand all
37 namespace gpu { 37 namespace gpu {
38 struct MailboxHolder; 38 struct MailboxHolder;
39 } 39 }
40 40
41 namespace vr_shell { 41 namespace vr_shell {
42 42
43 class FPSMeter; 43 class FPSMeter;
44 class MailboxToSurfaceBridge; 44 class MailboxToSurfaceBridge;
45 class UiScene; 45 class UiScene;
46 class VrController; 46 class VrController;
47 class VrGLThread;
47 class VrShell; 48 class VrShell;
48 class VrShellRenderer; 49 class VrShellRenderer;
49 struct UiElement; 50 struct UiElement;
50 51
51 struct WebVrBounds { 52 struct WebVrBounds {
52 WebVrBounds(const gfx::RectF& left, 53 WebVrBounds(const gfx::RectF& left,
53 const gfx::RectF& right, 54 const gfx::RectF& right,
54 const gfx::Size& size) 55 const gfx::Size& size)
55 : left_bounds(left), right_bounds(right), source_size(size) {} 56 : left_bounds(left), right_bounds(right), source_size(size) {}
56 gfx::RectF left_bounds; 57 gfx::RectF left_bounds;
57 gfx::RectF right_bounds; 58 gfx::RectF right_bounds;
58 gfx::Size source_size; 59 gfx::Size source_size;
59 }; 60 };
60 61
61 // This class manages all GLThread owned objects and GL rendering for VrShell. 62 // This class manages all GLThread owned objects and GL rendering for VrShell.
62 // It is not threadsafe and must only be used on the GL thread. 63 // It is not threadsafe and must only be used on the GL thread.
63 class VrShellGl : public device::mojom::VRVSyncProvider { 64 class VrShellGl : public device::mojom::VRVSyncProvider {
64 public: 65 public:
65 enum class InputTarget { 66 enum class InputTarget {
66 NONE = 0, 67 NONE = 0,
67 CONTENT, 68 CONTENT,
68 }; 69 };
69 70
70 VrShellGl(const base::WeakPtr<VrShell>& weak_vr_shell, 71 VrShellGl(const base::WeakPtr<VrGLThread>& weak_vr_gl_thread,
71 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner,
72 gvr_context* gvr_api, 72 gvr_context* gvr_api,
73 bool initially_web_vr, 73 bool initially_web_vr,
74 bool reprojected_rendering, 74 bool reprojected_rendering,
75 UiScene* scene); 75 UiScene* scene);
76 ~VrShellGl() override; 76 ~VrShellGl() override;
77 77
78 void Initialize(); 78 void Initialize();
79 void InitializeGl(gfx::AcceleratedWidget window); 79 void InitializeGl(gfx::AcceleratedWidget window);
80 80
81 void OnTriggerEvent(); 81 void OnTriggerEvent();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 base::TimeTicks vsync_timebase_; 218 base::TimeTicks vsync_timebase_;
219 base::TimeDelta vsync_interval_; 219 base::TimeDelta vsync_interval_;
220 220
221 base::TimeDelta pending_time_; 221 base::TimeDelta pending_time_;
222 bool pending_vsync_ = false; 222 bool pending_vsync_ = false;
223 GetVSyncCallback callback_; 223 GetVSyncCallback callback_;
224 bool received_frame_ = false; 224 bool received_frame_ = false;
225 mojo::Binding<device::mojom::VRVSyncProvider> binding_; 225 mojo::Binding<device::mojom::VRVSyncProvider> binding_;
226 device::mojom::VRSubmitFrameClientPtr submit_client_; 226 device::mojom::VRSubmitFrameClientPtr submit_client_;
227 227
228 base::WeakPtr<VrShell> weak_vr_shell_; 228 base::WeakPtr<VrGLThread> weak_vr_gl_thread_;
229 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
230 229
231 UiScene* scene_ = nullptr; 230 UiScene* scene_ = nullptr;
232 231
233 uint8_t frame_index_ = 0; 232 uint8_t frame_index_ = 0;
234 // Larger than frame_index_ so it can be initialized out-of-band. 233 // Larger than frame_index_ so it can be initialized out-of-band.
235 uint16_t last_frame_index_ = -1; 234 uint16_t last_frame_index_ = -1;
236 235
237 // Attributes for gesture detection while holding app button. 236 // Attributes for gesture detection while holding app button.
238 gfx::Vector3dF controller_start_direction_; 237 gfx::Vector3dF controller_start_direction_;
239 238
240 std::unique_ptr<FPSMeter> fps_meter_; 239 std::unique_ptr<FPSMeter> fps_meter_;
241 240
242 gfx::Point3F pointer_start_; 241 gfx::Point3F pointer_start_;
243 242
244 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; 243 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_;
245 244
246 DISALLOW_COPY_AND_ASSIGN(VrShellGl); 245 DISALLOW_COPY_AND_ASSIGN(VrShellGl);
247 }; 246 };
248 247
249 } // namespace vr_shell 248 } // namespace vr_shell
250 249
251 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ 250 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698