| Index: chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h
|
| diff --git a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7e40607e50965db5308c180b6b5908d3ee4835ad
|
| --- /dev/null
|
| +++ b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h
|
| @@ -0,0 +1,72 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_
|
| +#define CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_
|
| +
|
| +#include <jni.h>
|
| +
|
| +#include "base/cancelable_callback.h"
|
| +#include "base/macros.h"
|
| +#include "device/vr/android/gvr/gvr_delegate.h"
|
| +#include "device/vr/vr_service.mojom.h"
|
| +#include "mojo/public/cpp/bindings/binding.h"
|
| +
|
| +namespace vr_shell {
|
| +
|
| +// A non presenting delegate for magic window mode.
|
| +class NonPresentingGvrDelegate : public device::GvrDelegate,
|
| + public device::mojom::VRVSyncProvider {
|
| + public:
|
| + explicit NonPresentingGvrDelegate(long context);
|
| +
|
| + ~NonPresentingGvrDelegate() override;
|
| +
|
| + // GvrDelegate implementation
|
| + void SetWebVRSecureOrigin(bool secure_origin) override {}
|
| + void SubmitWebVRFrame() override {}
|
| + void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds,
|
| + const gvr::Rectf& right_bounds) override {}
|
| + void SetWebVRRenderSurfaceSize(int width, int height) override {}
|
| + gvr::Sizei GetWebVRCompositorSurfaceSize() override;
|
| + gvr::GvrApi* gvr_api() override;
|
| + void OnVRVsyncProviderRequest(
|
| + device::mojom::VRVSyncProviderRequest request) override;
|
| + void UpdateVSyncInterval(long timebase_nanos,
|
| + double interval_seconds) override;
|
| +
|
| + void Pause();
|
| + void Resume();
|
| + device::mojom::VRVSyncProviderRequest OnSwitchToPresentingDelegate();
|
| +
|
| + private:
|
| + void StopVSyncLoop();
|
| + void StartVSyncLoop();
|
| + void OnVSync();
|
| + device::mojom::VRPosePtr GetPose();
|
| +
|
| + // VRVSyncProvider
|
| + void GetVSync(const GetVSyncCallback& callback) override;
|
| +
|
| + std::unique_ptr<gvr::GvrApi> gvr_api_;
|
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
|
| + base::CancelableClosure vsync_task_;
|
| + base::TimeTicks vsync_timebase_;
|
| + base::TimeDelta vsync_interval_;
|
| +
|
| + // Whether the vsync loop is paused, but not stopped.
|
| + bool vsync_paused_ = false;
|
| + base::TimeDelta pending_time_;
|
| + bool pending_vsync_ = false;
|
| + GetVSyncCallback callback_;
|
| + uint32_t pose_index_ = 1;
|
| + mojo::Binding<device::mojom::VRVSyncProvider> binding_;
|
| + base::WeakPtrFactory<NonPresentingGvrDelegate> weak_ptr_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(NonPresentingGvrDelegate);
|
| +};
|
| +
|
| +} // namespace vr_shell
|
| +
|
| +#endif // CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_
|
|
|