Chromium Code Reviews| Index: chrome/browser/android/vr_shell/vr_shell_gl.cc |
| diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc |
| index 2f6ca1858794f98ba5b079eec8914441c31f2b4f..97ea6e102a121c70915958e5d7bac9d8d6024f6e 100644 |
| --- a/chrome/browser/android/vr_shell/vr_shell_gl.cc |
| +++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc |
| @@ -13,6 +13,7 @@ |
| #include "base/memory/ptr_util.h" |
| #include "base/metrics/histogram_macros.h" |
| #include "base/threading/thread_task_runner_handle.h" |
| +#include "chrome/browser/android/vr_shell/fps_meter.h" |
| #include "chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h" |
| #include "chrome/browser/android/vr_shell/ui_elements.h" |
| #include "chrome/browser/android/vr_shell/ui_interface.h" |
| @@ -147,6 +148,9 @@ VrShellGl::VrShellGl( |
| binding_(this), |
| weak_vr_shell_(weak_vr_shell), |
| main_thread_task_runner_(std::move(main_thread_task_runner)), |
| +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
|
mthiesse
2017/04/12 02:39:00
Oops, I meant to suggest DCHECK_IS_ON. Then you do
|
| + fps_meter_(new FPSMeter()), |
| +#endif |
| weak_ptr_factory_(this) { |
| GvrInit(gvr_api); |
| } |
| @@ -836,6 +840,13 @@ void VrShellGl::DrawFrame(int16_t frame_index) { |
| TRACE_EVENT0("gpu", "VrShellGl::SwapBuffers"); |
| surface_->SwapBuffers(); |
| } |
| + |
| +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
| + // After saving the timestamp, fps will be available via GetFPS(). |
| + // TODO(vollick): enable rendering of this framerate in a HUD. |
| + fps_meter_->AddFrame(current_time); |
| + LOG(ERROR) << "fps: " << fps_meter_->GetFPS(); |
| +#endif |
| } |
| void VrShellGl::DrawWorldElements(const gvr::Mat4f& head_pose) { |