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

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

Issue 2893623002: VR: Make sure GL thread is started before binding callbacks to it. (Closed)
Patch Set: 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
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/android/vr_shell/vr_shell.h" 5 #include "chrome/browser/android/vr_shell/vr_shell.h"
6 6
7 #include <android/native_window_jni.h> 7 #include <android/native_window_jni.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // that IO is allowed to prevent jank, but there shouldn't be any concerns 212 // that IO is allowed to prevent jank, but there shouldn't be any concerns
213 // regarding jank in this case, because we're switching from 3D to 2D, 213 // regarding jank in this case, because we're switching from 3D to 2D,
214 // adding/removing a bunch of Java views, and probably changing device 214 // adding/removing a bunch of Java views, and probably changing device
215 // orientation here. 215 // orientation here.
216 base::ThreadRestrictions::ScopedAllowIO allow_io; 216 base::ThreadRestrictions::ScopedAllowIO allow_io;
217 gl_thread_.reset(); 217 gl_thread_.reset();
218 } 218 }
219 g_instance = nullptr; 219 g_instance = nullptr;
220 } 220 }
221 221
222 void VrShell::PostToGlThreadWhenReady(const base::Closure& task) { 222 void VrShell::WaitForGlThread() {
223 if (thread_started_)
224 return;
225 gl_thread_->WaitUntilThreadStarted();
226 thread_started_ = true;
227 }
228
229 void VrShell::PostToGlThread(const base::Closure& task) {
230 DCHECK(thread_started_);
223 // TODO(mthiesse): Remove this blocking wait. Queue up events if thread isn't 231 // TODO(mthiesse): Remove this blocking wait. Queue up events if thread isn't
224 // finished starting? 232 // finished starting?
225 gl_thread_->WaitUntilThreadStarted();
226 gl_thread_->task_runner()->PostTask(FROM_HERE, task); 233 gl_thread_->task_runner()->PostTask(FROM_HERE, task);
227 } 234 }
228 235
229 void VrShell::OnContentPaused(bool paused) { 236 void VrShell::OnContentPaused(bool paused) {
230 if (!vr_shell_enabled_) 237 if (!vr_shell_enabled_)
231 return; 238 return;
232 239
233 if (!delegate_provider_->device_provider()) 240 if (!delegate_provider_->device_provider())
234 return; 241 return;
235 242
236 // TODO(mthiesse): The page is no longer visible when in menu mode. We 243 // TODO(mthiesse): The page is no longer visible when in menu mode. We
237 // should unfocus or otherwise let it know it's hidden. 244 // should unfocus or otherwise let it know it's hidden.
238 if (paused) 245 if (paused)
239 delegate_provider_->device_provider()->Device()->OnBlur(); 246 delegate_provider_->device_provider()->Device()->OnBlur();
240 else 247 else
241 delegate_provider_->device_provider()->Device()->OnFocus(); 248 delegate_provider_->device_provider()->Device()->OnFocus();
242 } 249 }
243 250
244 void VrShell::NavigateBack() { 251 void VrShell::NavigateBack() {
245 JNIEnv* env = base::android::AttachCurrentThread(); 252 JNIEnv* env = base::android::AttachCurrentThread();
246 Java_VrShellImpl_navigateBack(env, j_vr_shell_.obj()); 253 Java_VrShellImpl_navigateBack(env, j_vr_shell_.obj());
247 } 254 }
248 255
249 void VrShell::OnTriggerEvent(JNIEnv* env, const JavaParamRef<jobject>& obj) { 256 void VrShell::OnTriggerEvent(JNIEnv* env, const JavaParamRef<jobject>& obj) {
250 gl_thread_->task_runner()->PostTask( 257 WaitForGlThread();
251 FROM_HERE, 258 PostToGlThread(
Ian Vollick 2017/05/17 15:27:58 With this helper, won't the FROM_HERE in PostToGlT
mthiesse 2017/05/17 15:37:08 Can't do as you ask, but as discussed offline, I'v
252 base::Bind(&VrShellGl::OnTriggerEvent, gl_thread_->GetVrShellGl())); 259 base::Bind(&VrShellGl::OnTriggerEvent, gl_thread_->GetVrShellGl()));
253 } 260 }
254 261
255 void VrShell::OnPause(JNIEnv* env, const JavaParamRef<jobject>& obj) { 262 void VrShell::OnPause(JNIEnv* env, const JavaParamRef<jobject>& obj) {
256 gl_thread_->task_runner()->PostTask( 263 WaitForGlThread();
257 FROM_HERE, base::Bind(&VrShellGl::OnPause, gl_thread_->GetVrShellGl())); 264 PostToGlThread(base::Bind(&VrShellGl::OnPause, gl_thread_->GetVrShellGl()));
258 265
259 // exit vr session 266 // exit vr session
260 if (metrics_helper_) 267 if (metrics_helper_)
261 metrics_helper_->SetVRActive(false); 268 metrics_helper_->SetVRActive(false);
262 SetIsInVR(web_contents_, false); 269 SetIsInVR(web_contents_, false);
263 } 270 }
264 271
265 void VrShell::OnResume(JNIEnv* env, const JavaParamRef<jobject>& obj) { 272 void VrShell::OnResume(JNIEnv* env, const JavaParamRef<jobject>& obj) {
266 gl_thread_->task_runner()->PostTask( 273 WaitForGlThread();
267 FROM_HERE, base::Bind(&VrShellGl::OnResume, gl_thread_->GetVrShellGl())); 274 PostToGlThread(base::Bind(&VrShellGl::OnResume, gl_thread_->GetVrShellGl()));
268 275
269 if (metrics_helper_) 276 if (metrics_helper_)
270 metrics_helper_->SetVRActive(true); 277 metrics_helper_->SetVRActive(true);
271 SetIsInVR(web_contents_, true); 278 SetIsInVR(web_contents_, true);
272 } 279 }
273 280
274 void VrShell::SetSurface(JNIEnv* env, 281 void VrShell::SetSurface(JNIEnv* env,
275 const JavaParamRef<jobject>& obj, 282 const JavaParamRef<jobject>& obj,
276 const JavaParamRef<jobject>& surface) { 283 const JavaParamRef<jobject>& surface) {
277 CHECK(!reprojected_rendering_); 284 CHECK(!reprojected_rendering_);
278 gfx::AcceleratedWidget window = 285 gfx::AcceleratedWidget window =
279 ANativeWindow_fromSurface(base::android::AttachCurrentThread(), surface); 286 ANativeWindow_fromSurface(base::android::AttachCurrentThread(), surface);
280 PostToGlThreadWhenReady(base::Bind(&VrShellGl::InitializeGl, 287 WaitForGlThread();
281 gl_thread_->GetVrShellGl(), 288 PostToGlThread(base::Bind(&VrShellGl::InitializeGl,
282 base::Unretained(window))); 289 gl_thread_->GetVrShellGl(),
290 base::Unretained(window)));
283 } 291 }
284 292
285 void VrShell::SetWebVrMode(JNIEnv* env, 293 void VrShell::SetWebVrMode(JNIEnv* env,
286 const JavaParamRef<jobject>& obj, 294 const JavaParamRef<jobject>& obj,
287 bool enabled) { 295 bool enabled) {
288 webvr_mode_ = enabled; 296 webvr_mode_ = enabled;
289 if (metrics_helper_) 297 if (metrics_helper_)
290 metrics_helper_->SetWebVREnabled(enabled); 298 metrics_helper_->SetWebVREnabled(enabled);
291 PostToGlThreadWhenReady(base::Bind(&VrShellGl::SetWebVrMode, 299 WaitForGlThread();
292 gl_thread_->GetVrShellGl(), enabled)); 300 PostToGlThread(base::Bind(&VrShellGl::SetWebVrMode,
301 gl_thread_->GetVrShellGl(), enabled));
293 ui_->SetWebVrMode(enabled); 302 ui_->SetWebVrMode(enabled);
294 } 303 }
295 304
296 void VrShell::OnFullscreenChanged(bool enabled) { 305 void VrShell::OnFullscreenChanged(bool enabled) {
297 JNIEnv* env = base::android::AttachCurrentThread(); 306 JNIEnv* env = base::android::AttachCurrentThread();
298 Java_VrShellImpl_onFullscreenChanged(env, j_vr_shell_.obj(), enabled); 307 Java_VrShellImpl_onFullscreenChanged(env, j_vr_shell_.obj(), enabled);
299 ui_->SetFullscreen(enabled); 308 ui_->SetFullscreen(enabled);
300 } 309 }
301 310
302 bool VrShell::GetWebVrMode(JNIEnv* env, const JavaParamRef<jobject>& obj) { 311 bool VrShell::GetWebVrMode(JNIEnv* env, const JavaParamRef<jobject>& obj) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 ui_->RemoveTab(incognito, id); 354 ui_->RemoveTab(incognito, id);
346 } 355 }
347 356
348 void VrShell::SetWebVRSecureOrigin(bool secure_origin) { 357 void VrShell::SetWebVRSecureOrigin(bool secure_origin) {
349 ui_->SetWebVrSecureOrigin(secure_origin); 358 ui_->SetWebVrSecureOrigin(secure_origin);
350 } 359 }
351 360
352 void VrShell::SubmitWebVRFrame(int16_t frame_index, 361 void VrShell::SubmitWebVRFrame(int16_t frame_index,
353 const gpu::MailboxHolder& mailbox) { 362 const gpu::MailboxHolder& mailbox) {
354 TRACE_EVENT1("gpu", "SubmitWebVRFrame", "frame", frame_index); 363 TRACE_EVENT1("gpu", "SubmitWebVRFrame", "frame", frame_index);
355 364 WaitForGlThread();
356 PostToGlThreadWhenReady(base::Bind(&VrShellGl::SubmitWebVRFrame, 365 PostToGlThread(base::Bind(&VrShellGl::SubmitWebVRFrame,
357 gl_thread_->GetVrShellGl(), frame_index, 366 gl_thread_->GetVrShellGl(), frame_index, mailbox));
358 mailbox));
359 } 367 }
360 368
361 void VrShell::SubmitControllerModel(std::unique_ptr<VrControllerModel> model) { 369 void VrShell::SubmitControllerModel(std::unique_ptr<VrControllerModel> model) {
362 PostToGlThreadWhenReady(base::Bind(&VrShellGl::SetControllerModel, 370 WaitForGlThread();
363 gl_thread_->GetVrShellGl(), 371 PostToGlThread(base::Bind(&VrShellGl::SetControllerModel,
364 base::Passed(&model))); 372 gl_thread_->GetVrShellGl(), base::Passed(&model)));
365 } 373 }
366 374
367 void VrShell::UpdateWebVRTextureBounds(int16_t frame_index, 375 void VrShell::UpdateWebVRTextureBounds(int16_t frame_index,
368 const gfx::RectF& left_bounds, 376 const gfx::RectF& left_bounds,
369 const gfx::RectF& right_bounds, 377 const gfx::RectF& right_bounds,
370 const gfx::Size& source_size) { 378 const gfx::Size& source_size) {
371 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateWebVRTextureBounds, 379 WaitForGlThread();
372 gl_thread_->GetVrShellGl(), frame_index, 380 PostToGlThread(base::Bind(&VrShellGl::UpdateWebVRTextureBounds,
373 left_bounds, right_bounds, source_size)); 381 gl_thread_->GetVrShellGl(), frame_index,
382 left_bounds, right_bounds, source_size));
374 } 383 }
375 384
376 void VrShell::CreateVRDisplayInfo( 385 void VrShell::CreateVRDisplayInfo(
377 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, 386 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
378 uint32_t device_id) { 387 uint32_t device_id) {
379 PostToGlThreadWhenReady(base::Bind(&VrShellGl::CreateVRDisplayInfo, 388 WaitForGlThread();
380 gl_thread_->GetVrShellGl(), callback, 389 PostToGlThread(base::Bind(&VrShellGl::CreateVRDisplayInfo,
381 device_id)); 390 gl_thread_->GetVrShellGl(), callback, device_id));
382 } 391 }
383 392
384 void VrShell::SetSubmitClient( 393 void VrShell::SetSubmitClient(
385 device::mojom::VRSubmitFrameClientPtr submit_client) { 394 device::mojom::VRSubmitFrameClientPtr submit_client) {
386 PostToGlThreadWhenReady( 395 WaitForGlThread();
387 base::Bind(&VrShellGl::SetSubmitClient, gl_thread_->GetVrShellGl(), 396 PostToGlThread(base::Bind(&VrShellGl::SetSubmitClient,
388 base::Passed(submit_client.PassInterface()))); 397 gl_thread_->GetVrShellGl(),
398 base::Passed(submit_client.PassInterface())));
389 } 399 }
390 400
391 base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface( 401 base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface(
392 JNIEnv* env, 402 JNIEnv* env,
393 const JavaParamRef<jobject>& obj) { 403 const JavaParamRef<jobject>& obj) {
394 compositor_->SurfaceChanged(nullptr); 404 compositor_->SurfaceChanged(nullptr);
395 base::android::ScopedJavaGlobalRef<jobject> surface(env, content_surface_); 405 base::android::ScopedJavaGlobalRef<jobject> surface(env, content_surface_);
396 content_surface_ = nullptr; 406 content_surface_ = nullptr;
397 return surface; 407 return surface;
398 } 408 }
399 409
400 void VrShell::RestoreContentSurface(JNIEnv* env, 410 void VrShell::RestoreContentSurface(JNIEnv* env,
401 const JavaParamRef<jobject>& obj) { 411 const JavaParamRef<jobject>& obj) {
402 PostToGlThreadWhenReady( 412 WaitForGlThread();
413 PostToGlThread(
403 base::Bind(&VrShellGl::CreateContentSurface, gl_thread_->GetVrShellGl())); 414 base::Bind(&VrShellGl::CreateContentSurface, gl_thread_->GetVrShellGl()));
404 } 415 }
405 416
406 void VrShell::SetHistoryButtonsEnabled(JNIEnv* env, 417 void VrShell::SetHistoryButtonsEnabled(JNIEnv* env,
407 const JavaParamRef<jobject>& obj, 418 const JavaParamRef<jobject>& obj,
408 jboolean can_go_back, 419 jboolean can_go_back,
409 jboolean can_go_forward) { 420 jboolean can_go_forward) {
410 ui_->SetHistoryButtonsEnabled(can_go_back, can_go_forward); 421 ui_->SetHistoryButtonsEnabled(can_go_back, can_go_forward);
411 } 422 }
412 423
(...skipping 19 matching lines...) Expand all
432 gfx::Size size(width, height); 443 gfx::Size size(width, height);
433 web_contents->GetNativeView()->OnPhysicalBackingSizeChanged(size); 444 web_contents->GetNativeView()->OnPhysicalBackingSizeChanged(size);
434 } 445 }
435 446
436 void VrShell::ContentPhysicalBoundsChanged(JNIEnv* env, 447 void VrShell::ContentPhysicalBoundsChanged(JNIEnv* env,
437 const JavaParamRef<jobject>& object, 448 const JavaParamRef<jobject>& object,
438 jint width, 449 jint width,
439 jint height, 450 jint height,
440 jfloat dpr) { 451 jfloat dpr) {
441 TRACE_EVENT0("gpu", "VrShell::ContentPhysicalBoundsChanged"); 452 TRACE_EVENT0("gpu", "VrShell::ContentPhysicalBoundsChanged");
453 WaitForGlThread();
442 // TODO(acondor): Set the device scale factor for font rendering on the 454 // TODO(acondor): Set the device scale factor for font rendering on the
443 // VR Shell textures. 455 // VR Shell textures.
444 PostToGlThreadWhenReady(base::Bind(&VrShellGl::ContentPhysicalBoundsChanged, 456 PostToGlThread(base::Bind(&VrShellGl::ContentPhysicalBoundsChanged,
445 gl_thread_->GetVrShellGl(), width, 457 gl_thread_->GetVrShellGl(), width, height));
446 height));
447 compositor_->SetWindowBounds(gfx::Size(width, height)); 458 compositor_->SetWindowBounds(gfx::Size(width, height));
448 } 459 }
449 460
450 // Note that the following code is obsolete and is here as reference for the 461 // Note that the following code is obsolete and is here as reference for the
451 // actions that need to be implemented natively. 462 // actions that need to be implemented natively.
452 void VrShell::DoUiAction(const UiAction action, 463 void VrShell::DoUiAction(const UiAction action,
453 const base::DictionaryValue* arguments) { 464 const base::DictionaryValue* arguments) {
454 // Actions that can be handled natively. 465 // Actions that can be handled natively.
455 switch (action) { 466 switch (action) {
456 default: 467 default:
(...skipping 21 matching lines...) Expand all
478 Java_VrShellImpl_reload(env, j_vr_shell_.obj()); 489 Java_VrShellImpl_reload(env, j_vr_shell_.obj());
479 break; 490 break;
480 default: 491 default:
481 NOTREACHED(); 492 NOTREACHED();
482 } 493 }
483 } 494 }
484 495
485 void VrShell::ContentFrameWasResized(bool width_changed) { 496 void VrShell::ContentFrameWasResized(bool width_changed) {
486 display::Display display = 497 display::Display display =
487 display::Screen::GetScreen()->GetDisplayNearestWindow(window_); 498 display::Screen::GetScreen()->GetDisplayNearestWindow(window_);
488 PostToGlThreadWhenReady( 499 WaitForGlThread();
489 base::Bind(&VrShellGl::ContentBoundsChanged, gl_thread_->GetVrShellGl(), 500 PostToGlThread(base::Bind(&VrShellGl::ContentBoundsChanged,
490 display.size().width(), display.size().height())); 501 gl_thread_->GetVrShellGl(), display.size().width(),
502 display.size().height()));
491 } 503 }
492 504
493 void VrShell::ContentWebContentsDestroyed() { 505 void VrShell::ContentWebContentsDestroyed() {
494 input_manager_.reset(); 506 input_manager_.reset();
495 web_contents_ = nullptr; 507 web_contents_ = nullptr;
496 // TODO(mthiesse): Handle web contents being destroyed. 508 // TODO(mthiesse): Handle web contents being destroyed.
497 ForceExitVr(); 509 ForceExitVr();
498 } 510 }
499 511
500 void VrShell::ContentWasHidden() { 512 void VrShell::ContentWasHidden() {
(...skipping 16 matching lines...) Expand all
517 } 529 }
518 530
519 void VrShell::ExitFullscreen() { 531 void VrShell::ExitFullscreen() {
520 if (web_contents_ && web_contents_->IsFullscreen()) { 532 if (web_contents_ && web_contents_->IsFullscreen()) {
521 web_contents_->ExitFullscreen(false); 533 web_contents_->ExitFullscreen(false);
522 } 534 }
523 } 535 }
524 536
525 void VrShell::OnVRVsyncProviderRequest( 537 void VrShell::OnVRVsyncProviderRequest(
526 device::mojom::VRVSyncProviderRequest request) { 538 device::mojom::VRVSyncProviderRequest request) {
527 PostToGlThreadWhenReady(base::Bind(&VrShellGl::OnRequest, 539 WaitForGlThread();
528 gl_thread_->GetVrShellGl(), 540 PostToGlThread(base::Bind(&VrShellGl::OnRequest, gl_thread_->GetVrShellGl(),
529 base::Passed(&request))); 541 base::Passed(&request)));
530 } 542 }
531 543
532 void VrShell::UpdateVSyncInterval(int64_t timebase_nanos, 544 void VrShell::UpdateVSyncInterval(int64_t timebase_nanos,
533 double interval_seconds) { 545 double interval_seconds) {
534 PollMediaAccessFlag(); 546 PollMediaAccessFlag();
535 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateVSyncInterval, 547 WaitForGlThread();
536 gl_thread_->GetVrShellGl(), timebase_nanos, 548 PostToGlThread(base::Bind(&VrShellGl::UpdateVSyncInterval,
537 interval_seconds)); 549 gl_thread_->GetVrShellGl(), timebase_nanos,
550 interval_seconds));
538 } 551 }
539 552
540 void VrShell::PollMediaAccessFlag() { 553 void VrShell::PollMediaAccessFlag() {
541 poll_capturing_media_task_.Cancel(); 554 poll_capturing_media_task_.Cancel();
542 555
543 poll_capturing_media_task_.Reset( 556 poll_capturing_media_task_.Reset(
544 base::Bind(&VrShell::PollMediaAccessFlag, base::Unretained(this))); 557 base::Bind(&VrShell::PollMediaAccessFlag, base::Unretained(this)));
545 main_thread_task_runner_->PostDelayedTask( 558 main_thread_task_runner_->PostDelayedTask(
546 FROM_HERE, poll_capturing_media_task_.callback(), 559 FROM_HERE, poll_capturing_media_task_.callback(),
547 poll_media_access_interval_); 560 poll_media_access_interval_);
548 561
549 scoped_refptr<MediaStreamCaptureIndicator> indicator = 562 scoped_refptr<MediaStreamCaptureIndicator> indicator =
550 MediaCaptureDevicesDispatcher::GetInstance() 563 MediaCaptureDevicesDispatcher::GetInstance()
551 ->GetMediaStreamCaptureIndicator(); 564 ->GetMediaStreamCaptureIndicator();
552 bool is_capturing_audio = indicator->IsCapturingAudio(web_contents_); 565 bool is_capturing_audio = indicator->IsCapturingAudio(web_contents_);
553 if (is_capturing_audio != is_capturing_audio_) 566 if (is_capturing_audio != is_capturing_audio_) {
554 PostToGlThreadWhenReady(base::Bind(&VrShellGl::SetAudioCapturingWarning, 567 WaitForGlThread();
555 gl_thread_->GetVrShellGl(), 568 PostToGlThread(base::Bind(&VrShellGl::SetAudioCapturingWarning,
556 is_capturing_audio)); 569 gl_thread_->GetVrShellGl(), is_capturing_audio));
570 }
557 is_capturing_audio_ = is_capturing_audio; 571 is_capturing_audio_ = is_capturing_audio;
558 572
559 bool is_capturing_video = indicator->IsCapturingVideo(web_contents_); 573 bool is_capturing_video = indicator->IsCapturingVideo(web_contents_);
560 if (is_capturing_video != is_capturing_video_) 574 if (is_capturing_video != is_capturing_video_) {
561 PostToGlThreadWhenReady(base::Bind(&VrShellGl::SetVideoCapturingWarning, 575 WaitForGlThread();
562 gl_thread_->GetVrShellGl(), 576 PostToGlThread(base::Bind(&VrShellGl::SetVideoCapturingWarning,
563 is_capturing_video)); 577 gl_thread_->GetVrShellGl(), is_capturing_video));
578 }
564 is_capturing_video_ = is_capturing_video; 579 is_capturing_video_ = is_capturing_video;
565 580
566 bool is_capturing_screen = indicator->IsBeingMirrored(web_contents_); 581 bool is_capturing_screen = indicator->IsBeingMirrored(web_contents_);
567 if (is_capturing_screen != is_capturing_screen_) 582 if (is_capturing_screen != is_capturing_screen_) {
568 PostToGlThreadWhenReady(base::Bind(&VrShellGl::SetScreenCapturingWarning, 583 WaitForGlThread();
569 gl_thread_->GetVrShellGl(), 584 PostToGlThread(base::Bind(&VrShellGl::SetScreenCapturingWarning,
570 is_capturing_screen)); 585 gl_thread_->GetVrShellGl(), is_capturing_screen));
586 }
571 is_capturing_screen_ = is_capturing_screen; 587 is_capturing_screen_ = is_capturing_screen;
572 } 588 }
573 589
574 void VrShell::SetContentCssSize(float width, float height, float dpr) { 590 void VrShell::SetContentCssSize(float width, float height, float dpr) {
575 JNIEnv* env = base::android::AttachCurrentThread(); 591 JNIEnv* env = base::android::AttachCurrentThread();
576 Java_VrShellImpl_setContentCssSize(env, j_vr_shell_.obj(), width, height, 592 Java_VrShellImpl_setContentCssSize(env, j_vr_shell_.obj(), width, height,
577 dpr); 593 dpr);
578 } 594 }
579 595
580 void VrShell::ProcessContentGesture( 596 void VrShell::ProcessContentGesture(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 jlong gvr_api, 637 jlong gvr_api,
622 jboolean reprojected_rendering) { 638 jboolean reprojected_rendering) {
623 return reinterpret_cast<intptr_t>(new VrShell( 639 return reinterpret_cast<intptr_t>(new VrShell(
624 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), 640 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android),
625 for_web_vr, in_cct, 641 for_web_vr, in_cct,
626 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), 642 VrShellDelegate::GetNativeVrShellDelegate(env, delegate),
627 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); 643 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
628 } 644 }
629 645
630 } // namespace vr_shell 646 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698