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..1df330deafaa421af40c0bd45c7ad705bce6b629 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 "cc/trees/frame_rate_counter.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" |
| @@ -84,6 +85,9 @@ static constexpr unsigned kPoseRingBufferSize = 8; |
| // controller movement as a gesture. |
| static constexpr float kMinAppButtonGestureAngleRad = 0.25; |
| +// UI has no "impl" (i.e., separate compositor) thread. |
| +static constexpr bool kHasImplThread = false; |
| + |
| // Generate a quaternion representing the rotation from the negative Z axis |
| // (0, 0, -1) to a specified vector. This is an optimized version of a more |
| // general vector-to-vector calculation. |
| @@ -147,6 +151,7 @@ VrShellGl::VrShellGl( |
| binding_(this), |
| weak_vr_shell_(weak_vr_shell), |
| main_thread_task_runner_(std::move(main_thread_task_runner)), |
| + frame_rate_counter_(cc::FrameRateCounter::Create(kHasImplThread)), |
| weak_ptr_factory_(this) { |
| GvrInit(gvr_api); |
| } |
| @@ -836,6 +841,15 @@ void VrShellGl::DrawFrame(int16_t frame_index) { |
| TRACE_EVENT0("gpu", "VrShellGl::SwapBuffers"); |
| surface_->SwapBuffers(); |
| } |
| + |
| + // This is an unused parameter when we do not have a compositor thread. |
| + bool unused_is_a_software_compositor = false; |
| + |
| + // After saving the timestamp, a reliable framerate should be available via |
| + // GetAverageFPS(). |
| + // TODO(vollick): enable rendering of this framerate in a HUD. |
| + frame_rate_counter_->SaveTimeStamp(current_time, |
|
mthiesse
2017/04/07 15:36:33
I know this is fairly lightweight, but we should p
|
| + unused_is_a_software_compositor); |
|
mthiesse
2017/04/07 15:36:33
nit: Definitely personal preference, but I think t
|
| } |
| void VrShellGl::DrawWorldElements(const gvr::Mat4f& head_pose) { |