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

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

Issue 2748293002: WebVR: process animations from posted task to yield for other events (Closed)
Patch Set: Throw shade at WaitForIncomingMethodCall in comment. 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 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" 5 #include "chrome/browser/android/vr_shell/vr_shell_gl.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 main_thread_task_runner_->PostTask( 1228 main_thread_task_runner_->PostTask(
1229 FROM_HERE, base::Bind(&VrShell::ForceExitVr, weak_vr_shell_)); 1229 FROM_HERE, base::Bind(&VrShell::ForceExitVr, weak_vr_shell_));
1230 } 1230 }
1231 1231
1232 void VrShellGl::UpdateScene(std::unique_ptr<base::ListValue> commands) { 1232 void VrShellGl::UpdateScene(std::unique_ptr<base::ListValue> commands) {
1233 scene_->HandleCommands(std::move(commands), TimeInMicroseconds()); 1233 scene_->HandleCommands(std::move(commands), TimeInMicroseconds());
1234 } 1234 }
1235 1235
1236 void VrShellGl::SendVSync(base::TimeDelta time, 1236 void VrShellGl::SendVSync(base::TimeDelta time,
1237 const GetVSyncCallback& callback) { 1237 const GetVSyncCallback& callback) {
1238 TRACE_EVENT0("input", "VrShellGl::SendVSync"); 1238 uint8_t frame_index = frame_index_++;
1239 1239
1240 uint8_t frame_index = frame_index_++; 1240 TRACE_EVENT1("input", "VrShellGl::SendVSync", "frame", frame_index);
1241 1241
1242 gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow(); 1242 gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow();
1243 target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos; 1243 target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos;
1244 1244
1245 gvr::Mat4f head_mat = 1245 gvr::Mat4f head_mat =
1246 gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time); 1246 gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time);
1247 head_mat = gvr_api_->ApplyNeckModel(head_mat, 1.0f); 1247 head_mat = gvr_api_->ApplyNeckModel(head_mat, 1.0f);
1248 1248
1249 webvr_head_pose_[frame_index % kPoseRingBufferSize] = head_mat; 1249 webvr_head_pose_[frame_index % kPoseRingBufferSize] = head_mat;
1250 1250
(...skipping 15 matching lines...) Expand all
1266 // appropriate recommended render resolution as the default size during 1266 // appropriate recommended render resolution as the default size during
1267 // InitializeGl. Revisit if the initialization order changes. 1267 // InitializeGl. Revisit if the initialization order changes.
1268 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( 1268 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo(
1269 gvr_api_.get(), webvr_surface_size_, device_id); 1269 gvr_api_.get(), webvr_surface_size_, device_id);
1270 main_thread_task_runner_->PostTask( 1270 main_thread_task_runner_->PostTask(
1271 FROM_HERE, 1271 FROM_HERE,
1272 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); 1272 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info)));
1273 } 1273 }
1274 1274
1275 } // namespace vr_shell 1275 } // namespace vr_shell
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/vr/VRDisplay.h » ('j') | third_party/WebKit/Source/modules/vr/VRDisplay.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698