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

Unified Diff: device/vr/android/gvr/gvr_device.h

Issue 2584343002: WIP: working copy-no-compositor path
Patch Set: StatTracker destructor, delete old magic numbers, mojo export Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: device/vr/android/gvr/gvr_device.h
diff --git a/device/vr/android/gvr/gvr_device.h b/device/vr/android/gvr/gvr_device.h
index 4d57f581a64d2dab47c4978a4c6601f2379634eb..23707c41d80b0350b3e4657bd943862e1ba3c6fb 100644
--- a/device/vr/android/gvr/gvr_device.h
+++ b/device/vr/android/gvr/gvr_device.h
@@ -5,6 +5,8 @@
#ifndef DEVICE_VR_ANDROID_GVR_DEVICE_H
#define DEVICE_VR_ANDROID_GVR_DEVICE_H
+#include <list>
+
#include "base/macros.h"
#include "device/vr/vr_device.h"
@@ -17,6 +19,19 @@ namespace device {
class GvrDeviceProvider;
class GvrDelegate;
+class StatTracker final {
+ public:
+ StatTracker(unsigned int capacity);
+ ~StatTracker();
+ bool hasPrediction();
+ double getPrediction();
+ void add(double value);
+ void clear();
+ private:
+ unsigned int m_capacity;
+ std::list<double> m_items;
+};
+
class GvrDevice : public VRDevice {
public:
GvrDevice(GvrDeviceProvider* provider, GvrDelegate* delegate);
@@ -31,9 +46,13 @@ class GvrDevice : public VRDevice {
void SetSecureOrigin(bool secure_origin) override;
void ExitPresent() override;
- void SubmitFrame(mojom::VRPosePtr pose) override;
+ void SubmitFrame(int32_t surface_handle,
+ mojom::VRPosePtr pose,
+ const mojom::VRDisplay::SubmitFrameCallback& callback) override;
+ void OnFrameSubmitted(int32_t surface_handle, uint32_t frame_index, double elapsed);
void UpdateLayerBounds(mojom::VRLayerBoundsPtr left_bounds,
mojom::VRLayerBoundsPtr right_bounds) override;
+ void GetSurfaceHandle(int32_t width, int32_t height, const mojom::VRDisplay::GetSurfaceHandleCallback& callback) override;
void SetDelegate(GvrDelegate* delegate);
@@ -43,6 +62,12 @@ class GvrDevice : public VRDevice {
GvrDelegate* delegate_;
GvrDeviceProvider* gvr_provider_;
bool secure_origin_ = false;
+
+ // Map takes ownership of callbacks.
+ std::map<uint32_t, device::mojom::VRDisplay::SubmitFrameCallback> callback_map_;
+ StatTracker last_processing_ms_{5};
+ StatTracker last_render_ms_{5};
+
uint32_t pose_index_ = 1;
DISALLOW_COPY_AND_ASSIGN(GvrDevice);

Powered by Google App Engine
This is Rietveld 408576698