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

Side by Side Diff: device/vr/openvr/openvr_device.cc

Issue 2929733002: Fix build break when building with enable_openvr=true on Windows (Closed)
Patch Set: Created 3 years, 6 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 | « device/vr/openvr/openvr_device.h ('k') | third_party/openvr/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 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 #define _USE_MATH_DEFINES // for M_PI 5 #define _USE_MATH_DEFINES // for M_PI
6 #include "device/vr/openvr/openvr_device.h" 6 #include "device/vr/openvr/openvr_device.h"
7 #include <math.h> 7 #include <math.h>
8 #include "third_party/openvr/src/headers/openvr.h" 8 #include "third_party/openvr/src/headers/openvr.h"
9 9
10 namespace { 10 namespace {
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 return; 289 return;
290 290
291 on_polling_events_ = onPollingEvents; 291 on_polling_events_ = onPollingEvents;
292 } 292 }
293 293
294 void OpenVRDevice::OpenVRRenderLoop::UnregisterPollingEventCallback() { 294 void OpenVRDevice::OpenVRRenderLoop::UnregisterPollingEventCallback() {
295 on_polling_events_.Reset(); 295 on_polling_events_.Reset();
296 } 296 }
297 297
298 void OpenVRDevice::OpenVRRenderLoop::GetVSync( 298 void OpenVRDevice::OpenVRRenderLoop::GetVSync(
299 const mojom::VRVSyncProvider::GetVSyncCallback& callback) { 299 mojom::VRVSyncProvider::GetVSyncCallback callback) {
300 static int16_t next_frame = 0; 300 static int16_t next_frame = 0;
301 int16_t frame = next_frame++; 301 int16_t frame = next_frame++;
302 302
303 // VSync could be used as a signal to poll events. 303 // VSync could be used as a signal to poll events.
304 if (!on_polling_events_.is_null()) { 304 if (!on_polling_events_.is_null()) {
305 main_thread_task_runner_->PostTask(FROM_HERE, on_polling_events_); 305 main_thread_task_runner_->PostTask(FROM_HERE, on_polling_events_);
306 } 306 }
307 307
308 // TODO(BillOrr): Give real values when VSync loop is hooked up. This is the 308 // TODO(BillOrr): Give real values when VSync loop is hooked up. This is the
309 // presentation time for the frame. Just returning a default value for now 309 // presentation time for the frame. Just returning a default value for now
310 // since we don't have VSync hooked up. 310 // since we don't have VSync hooked up.
311 base::TimeDelta time = base::TimeDelta::FromSecondsD(2.0); 311 base::TimeDelta time = base::TimeDelta::FromSecondsD(2.0);
312 312
313 device::mojom::VRPosePtr pose = getPose(); 313 device::mojom::VRPosePtr pose = getPose();
314 Sleep(11); // TODO (billorr): Use real vsync timing instead of a sleep (this 314 Sleep(11); // TODO (billorr): Use real vsync timing instead of a sleep (this
315 // sleep just throttles vsyncs so we don't fill message queues). 315 // sleep just throttles vsyncs so we don't fill message queues).
316 callback.Run(std::move(pose), time, frame, 316 std::move(callback).Run(std::move(pose), time, frame,
317 device::mojom::VRVSyncProvider::Status::SUCCESS); 317 device::mojom::VRVSyncProvider::Status::SUCCESS);
318 } 318 }
319 319
320 } // namespace device 320 } // namespace device
OLDNEW
« no previous file with comments | « device/vr/openvr/openvr_device.h ('k') | third_party/openvr/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698