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

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

Issue 2729523002: Re-land^2 WebVR compositor bypass via BrowserMain context + mailbox (Closed)
Patch Set: Further cleanups Created 3 years, 9 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_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>
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 void ProcessUIGesture(std::unique_ptr<blink::WebInputEvent> event); 163 void ProcessUIGesture(std::unique_ptr<blink::WebInputEvent> event);
164 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event); 164 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event);
165 165
166 // TODO(mthiesse): Find a better place for these functions to live. 166 // TODO(mthiesse): Find a better place for these functions to live.
167 static device::mojom::VRPosePtr VRPosePtrFromGvrPose(gvr::Mat4f head_mat); 167 static device::mojom::VRPosePtr VRPosePtrFromGvrPose(gvr::Mat4f head_mat);
168 static device::mojom::VRDisplayInfoPtr CreateVRDisplayInfo( 168 static device::mojom::VRDisplayInfoPtr CreateVRDisplayInfo(
169 gvr::GvrApi* gvr_api, 169 gvr::GvrApi* gvr_api,
170 gvr::Sizei compositor_size, 170 gvr::Sizei compositor_size,
171 uint32_t device_id); 171 uint32_t device_id);
172 void OnSubmitWebVRFrameTransferred(int frame_index);
173 void OnSubmitWebVRFrameRendered(int frame_index);
172 174
173 private: 175 private:
174 ~VrShell() override; 176 ~VrShell() override;
175 void PostToGlThreadWhenReady(const base::Closure& task); 177 void PostToGlThreadWhenReady(const base::Closure& task);
176 void SetContentPaused(bool paused); 178 void SetContentPaused(bool paused);
177 void SetUiState(); 179 void SetUiState();
178 180
179 // content::WebContentsObserver implementation. 181 // content::WebContentsObserver implementation.
180 void RenderViewHostChanged(content::RenderViewHost* old_host, 182 void RenderViewHostChanged(content::RenderViewHost* old_host,
181 content::RenderViewHost* new_host) override; 183 content::RenderViewHost* new_host) override;
182 void MainFrameWasResized(bool width_changed) override; 184 void MainFrameWasResized(bool width_changed) override;
183 void WebContentsDestroyed() override; 185 void WebContentsDestroyed() override;
184 186
185 // device::GvrDelegate implementation 187 // device::GvrDelegate implementation
186 void SetWebVRSecureOrigin(bool secure_origin) override; 188 void SetWebVRSecureOrigin(bool secure_origin) override;
187 void SubmitWebVRFrame() override; 189 void SubmitWebVRFrame(
190 int frame_index, const gpu::Mailbox& mailbox,
191 device::mojom::VRSubmitFrameClientPtr submit_client) override;
188 void UpdateWebVRTextureBounds(int16_t frame_index, 192 void UpdateWebVRTextureBounds(int16_t frame_index,
189 const gvr::Rectf& left_bounds, 193 const gvr::Rectf& left_bounds,
190 const gvr::Rectf& right_bounds) override; 194 const gvr::Rectf& right_bounds) override;
191 void OnVRVsyncProviderRequest( 195 void OnVRVsyncProviderRequest(
192 device::mojom::VRVSyncProviderRequest request) override; 196 device::mojom::VRVSyncProviderRequest request) override;
193 void UpdateVSyncInterval(int64_t timebase_nanos, 197 void UpdateVSyncInterval(int64_t timebase_nanos,
194 double interval_seconds) override; 198 double interval_seconds) override;
195 bool SupportsPresentation() override; 199 bool SupportsPresentation() override;
196 void ResetPose() override; 200 void ResetPose() override;
197 void CreateVRDisplayInfo( 201 void CreateVRDisplayInfo(
198 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, 202 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
199 uint32_t device_id) override; 203 uint32_t device_id) override;
200 204
201 void ProcessTabArray(JNIEnv* env, jobjectArray tabs, bool incognito); 205 void ProcessTabArray(JNIEnv* env, jobjectArray tabs, bool incognito);
202 206
203 bool vr_shell_enabled_; 207 bool vr_shell_enabled_;
204 208
205 std::unique_ptr<UiInterface> html_interface_; 209 std::unique_ptr<UiInterface> html_interface_;
206 bool content_paused_ = false; 210 bool content_paused_ = false;
207 bool webvr_mode_ = false; 211 bool webvr_mode_ = false;
212 int webvr_surface_handle_;
213 int webvr_frames_in_surface_queue_ = 0;
214 device::mojom::VRSubmitFrameClientPtr webvr_submit_client_transferring_;
215 device::mojom::VRSubmitFrameClientPtr webvr_submit_client_rendering_;
208 216
209 content::WebContents* main_contents_ = nullptr; 217 content::WebContents* main_contents_ = nullptr;
210 base::android::ScopedJavaGlobalRef<jobject> j_motion_event_synthesizer_; 218 base::android::ScopedJavaGlobalRef<jobject> j_motion_event_synthesizer_;
211 ui::WindowAndroid* content_window_; 219 ui::WindowAndroid* content_window_;
212 std::unique_ptr<VrCompositor> content_compositor_; 220 std::unique_ptr<VrCompositor> content_compositor_;
213 content::WebContents* ui_contents_; 221 content::WebContents* ui_contents_;
214 std::unique_ptr<VrCompositor> ui_compositor_; 222 std::unique_ptr<VrCompositor> ui_compositor_;
215 223
216 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_; 224 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_;
217 225
(...skipping 18 matching lines...) Expand all
236 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 244 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
237 245
238 DISALLOW_COPY_AND_ASSIGN(VrShell); 246 DISALLOW_COPY_AND_ASSIGN(VrShell);
239 }; 247 };
240 248
241 bool RegisterVrShell(JNIEnv* env); 249 bool RegisterVrShell(JNIEnv* env);
242 250
243 } // namespace vr_shell 251 } // namespace vr_shell
244 252
245 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 253 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698