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

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: Revert FrameView.cpp change, re-enable typemap workaround. 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 ForceExitVr(); 163 void ForceExitVr();
164 164
165 void ProcessUIGesture(std::unique_ptr<blink::WebInputEvent> event); 165 void ProcessUIGesture(std::unique_ptr<blink::WebInputEvent> event);
166 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event); 166 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event);
167 167
168 // TODO(mthiesse): Find a better place for these functions to live. 168 // TODO(mthiesse): Find a better place for these functions to live.
169 static device::mojom::VRPosePtr VRPosePtrFromGvrPose(gvr::Mat4f head_mat); 169 static device::mojom::VRPosePtr VRPosePtrFromGvrPose(gvr::Mat4f head_mat);
170 static device::mojom::VRDisplayInfoPtr CreateVRDisplayInfo( 170 static device::mojom::VRDisplayInfoPtr CreateVRDisplayInfo(
171 gvr::GvrApi* gvr_api, 171 gvr::GvrApi* gvr_api,
172 gvr::Sizei compositor_size, 172 gvr::Sizei recommended_size,
173 uint32_t device_id); 173 uint32_t device_id);
174 void OnSubmitWebVRFrameTransferred(int frame_index);
175 void OnSubmitWebVRFrameRendered(int frame_index);
174 176
175 private: 177 private:
176 ~VrShell() override; 178 ~VrShell() override;
177 void PostToGlThreadWhenReady(const base::Closure& task); 179 void PostToGlThreadWhenReady(const base::Closure& task);
178 void SetContentPaused(bool paused); 180 void SetContentPaused(bool paused);
179 void SetUiState(); 181 void SetUiState();
180 182
181 // content::WebContentsObserver implementation. 183 // content::WebContentsObserver implementation.
182 void RenderViewHostChanged(content::RenderViewHost* old_host, 184 void RenderViewHostChanged(content::RenderViewHost* old_host,
183 content::RenderViewHost* new_host) override; 185 content::RenderViewHost* new_host) override;
184 void MainFrameWasResized(bool width_changed) override; 186 void MainFrameWasResized(bool width_changed) override;
185 void WebContentsDestroyed() override; 187 void WebContentsDestroyed() override;
186 188
187 // device::GvrDelegate implementation 189 // device::GvrDelegate implementation
188 void SetWebVRSecureOrigin(bool secure_origin) override; 190 void SetWebVRSecureOrigin(bool secure_origin) override;
189 void SubmitWebVRFrame() override; 191 void SubmitWebVRFrame(
192 int16_t frame_index,
193 const gpu::Mailbox& mailbox,
194 const gpu::SyncToken& sync_token,
195 device::mojom::VRSubmitFrameClientPtr submit_client) override;
190 void UpdateWebVRTextureBounds(int16_t frame_index, 196 void UpdateWebVRTextureBounds(int16_t frame_index,
191 const gvr::Rectf& left_bounds, 197 const gvr::Rectf& left_bounds,
192 const gvr::Rectf& right_bounds) override; 198 const gvr::Rectf& right_bounds,
199 const gvr::Sizei& source_size) override;
193 void OnVRVsyncProviderRequest( 200 void OnVRVsyncProviderRequest(
194 device::mojom::VRVSyncProviderRequest request) override; 201 device::mojom::VRVSyncProviderRequest request) override;
195 void UpdateVSyncInterval(int64_t timebase_nanos, 202 void UpdateVSyncInterval(int64_t timebase_nanos,
196 double interval_seconds) override; 203 double interval_seconds) override;
197 bool SupportsPresentation() override; 204 bool SupportsPresentation() override;
198 void ResetPose() override; 205 void ResetPose() override;
199 void CreateVRDisplayInfo( 206 void CreateVRDisplayInfo(
200 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, 207 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
201 uint32_t device_id) override; 208 uint32_t device_id) override;
202 209
203 void ProcessTabArray(JNIEnv* env, jobjectArray tabs, bool incognito); 210 void ProcessTabArray(JNIEnv* env, jobjectArray tabs, bool incognito);
204 211
205 bool vr_shell_enabled_; 212 bool vr_shell_enabled_;
206 213
207 std::unique_ptr<UiInterface> html_interface_; 214 std::unique_ptr<UiInterface> html_interface_;
208 bool content_paused_ = false; 215 bool content_paused_ = false;
209 bool webvr_mode_ = false; 216 bool webvr_mode_ = false;
217 int webvr_surface_handle_;
218 int webvr_frames_in_surface_queue_ = 0;
219 std::map<int, device::mojom::VRSubmitFrameClientPtr> webvr_submit_clients_;
220 std::map<int, bool> webvr_submit_client_transferring_;
221 std::map<int, bool> webvr_submit_client_rendering_;
210 222
211 content::WebContents* main_contents_ = nullptr; 223 content::WebContents* main_contents_ = nullptr;
212 base::android::ScopedJavaGlobalRef<jobject> j_motion_event_synthesizer_; 224 base::android::ScopedJavaGlobalRef<jobject> j_motion_event_synthesizer_;
213 ui::WindowAndroid* content_window_; 225 ui::WindowAndroid* content_window_;
214 std::unique_ptr<VrCompositor> content_compositor_; 226 std::unique_ptr<VrCompositor> content_compositor_;
215 content::WebContents* ui_contents_; 227 content::WebContents* ui_contents_;
216 std::unique_ptr<VrCompositor> ui_compositor_; 228 std::unique_ptr<VrCompositor> ui_compositor_;
217 229
218 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_; 230 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_;
219 231
(...skipping 18 matching lines...) Expand all
238 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 250 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
239 251
240 DISALLOW_COPY_AND_ASSIGN(VrShell); 252 DISALLOW_COPY_AND_ASSIGN(VrShell);
241 }; 253 };
242 254
243 bool RegisterVrShell(JNIEnv* env); 255 bool RegisterVrShell(JNIEnv* env);
244 256
245 } // namespace vr_shell 257 } // namespace vr_shell
246 258
247 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 259 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698