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

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

Issue 2471433002: Implement WebVR presentation pausing for VR Shell Menu Mode (Closed)
Patch Set: rebase Created 4 years, 1 month 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_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/android/jni_weak_ref.h" 12 #include "base/android/jni_weak_ref.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/single_thread_task_runner.h"
15 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
16 #include "chrome/browser/android/vr_shell/vr_math.h" 17 #include "chrome/browser/android/vr_shell/vr_math.h"
17 #include "content/public/browser/web_contents_observer.h" 18 #include "content/public/browser/web_contents_observer.h"
18 #include "device/vr/android/gvr/gvr_delegate.h" 19 #include "device/vr/android/gvr/gvr_delegate.h"
19 #include "third_party/WebKit/public/web/WebInputEvent.h" 20 #include "third_party/WebKit/public/web/WebInputEvent.h"
20 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr.h" 21 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr.h"
21 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_ty pes.h" 22 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_ty pes.h"
22 23
23 using blink::WebInputEvent; 24 using blink::WebInputEvent;
24 25
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 void QueueTask(base::Callback<void()>& callback); 115 void QueueTask(base::Callback<void()>& callback);
115 116
116 // Perform a UI action triggered by the javascript API. 117 // Perform a UI action triggered by the javascript API.
117 void DoUiAction(const UiAction action); 118 void DoUiAction(const UiAction action);
118 119
119 private: 120 private:
120 ~VrShell() override; 121 ~VrShell() override;
121 void LoadUIContent(); 122 void LoadUIContent();
122 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame); 123 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame);
123 void DrawUiView(const gvr::Mat4f* head_pose, 124 void DrawUiView(const gvr::Mat4f* head_pose,
124 const std::vector<const ContentRectangle*>& elements); 125 const std::vector<const ContentRectangle*>& elements,
126 bool clear);
125 void DrawElements(const gvr::Mat4f& render_matrix, 127 void DrawElements(const gvr::Mat4f& render_matrix,
126 const std::vector<const ContentRectangle*>& elements); 128 const std::vector<const ContentRectangle*>& elements);
127 void DrawCursor(const gvr::Mat4f& render_matrix); 129 void DrawCursor(const gvr::Mat4f& render_matrix);
128 void DrawWebVr(); 130 void DrawWebVr();
129 131
130 void UpdateController(const gvr::Vec3f& forward_vector); 132 void UpdateController(const gvr::Vec3f& forward_vector);
131 void SendEventsToTarget(VrInputManager* input_target, 133 void SendEventsToTarget(VrInputManager* input_target,
132 int pixel_x, 134 int pixel_x,
133 int pixel_y); 135 int pixel_y);
134 136
(...skipping 15 matching lines...) Expand all
150 std::unique_ptr<gvr::BufferViewportList> buffer_viewport_list_; 152 std::unique_ptr<gvr::BufferViewportList> buffer_viewport_list_;
151 std::unique_ptr<gvr::BufferViewport> buffer_viewport_; 153 std::unique_ptr<gvr::BufferViewport> buffer_viewport_;
152 std::unique_ptr<gvr::BufferViewport> headlocked_left_viewport_; 154 std::unique_ptr<gvr::BufferViewport> headlocked_left_viewport_;
153 std::unique_ptr<gvr::BufferViewport> headlocked_right_viewport_; 155 std::unique_ptr<gvr::BufferViewport> headlocked_right_viewport_;
154 std::unique_ptr<gvr::SwapChain> swap_chain_; 156 std::unique_ptr<gvr::SwapChain> swap_chain_;
155 157
156 gvr::Sizei render_size_; 158 gvr::Sizei render_size_;
157 159
158 std::queue<base::Callback<void()>> task_queue_; 160 std::queue<base::Callback<void()>> task_queue_;
159 base::Lock task_queue_lock_; 161 base::Lock task_queue_lock_;
162 base::Lock gvr_init_lock_;
160 163
161 std::unique_ptr<VrCompositor> content_compositor_; 164 std::unique_ptr<VrCompositor> content_compositor_;
162 content::WebContents* main_contents_; 165 content::WebContents* main_contents_;
163 std::unique_ptr<VrCompositor> ui_compositor_; 166 std::unique_ptr<VrCompositor> ui_compositor_;
164 content::WebContents* ui_contents_; 167 content::WebContents* ui_contents_;
165 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_; 168 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_;
166 169
167 VrShellDelegate* delegate_ = nullptr; 170 VrShellDelegate* delegate_ = nullptr;
168 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; 171 std::unique_ptr<VrShellRenderer> vr_shell_renderer_;
169 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_; 172 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_;
(...skipping 14 matching lines...) Expand all
184 // The pose ring buffer size must be a power of two to avoid glitches when 187 // The pose ring buffer size must be a power of two to avoid glitches when
185 // the pose index wraps around. It should be large enough to handle the 188 // the pose index wraps around. It should be large enough to handle the
186 // current backlog of poses which is 2-3 frames. 189 // current backlog of poses which is 2-3 frames.
187 static constexpr int kPoseRingBufferSize = 8; 190 static constexpr int kPoseRingBufferSize = 8;
188 std::vector<gvr::Mat4f> webvr_head_pose_; 191 std::vector<gvr::Mat4f> webvr_head_pose_;
189 192
190 std::unique_ptr<VrController> controller_; 193 std::unique_ptr<VrController> controller_;
191 scoped_refptr<VrInputManager> content_input_manager_; 194 scoped_refptr<VrInputManager> content_input_manager_;
192 scoped_refptr<VrInputManager> ui_input_manager_; 195 scoped_refptr<VrInputManager> ui_input_manager_;
193 196
197 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
198
194 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 199 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
195 200
196 DISALLOW_COPY_AND_ASSIGN(VrShell); 201 DISALLOW_COPY_AND_ASSIGN(VrShell);
197 }; 202 };
198 203
199 bool RegisterVrShell(JNIEnv* env); 204 bool RegisterVrShell(JNIEnv* env);
200 205
201 } // namespace vr_shell 206 } // namespace vr_shell
202 207
203 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 208 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_interface.cc ('k') | chrome/browser/android/vr_shell/vr_shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698