1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 #ifndef DEVICE_VR_WINDOWS_MIXED_REALITY_WRAPPERS_WMR_TIMESTAMP_H_ 5 #define DEVICE_VR_WINDOWS_MIXED_REALITY_WRAPPERS_WMR_TIMESTAMP_H_ 6 7 #include <windows.perception.h> 8 #include <wrl.h> 9 10 #include "base/macros.h" 11 12 namespace device { 13 class WMRTimestamp { 14 public: 15 virtual ~WMRTimestamp() = default; 16 17 virtual ABI::Windows::Foundation::DateTime TargetTime() const = 0; 18 virtual ABI::Windows::Foundation::TimeSpan PredictionAmount() const = 0; 19 // No default implementation w/ a NOTREACHED like other GetRawPtr()s because 20 // this is expected to be called on both the real and mock implementations in 21 // MixedRealityInputHelper::GetInputState(). 22 virtual ABI::Windows::Perception::IPerceptionTimestamp* GetRawPtr() const = 0; 23 }; 24 25 class WMRTimestampImpl : public WMRTimestamp { 26 public: 27 explicit WMRTimestampImpl( 28 Microsoft::WRL::ComPtr<ABI::Windows::Perception::IPerceptionTimestamp> 29 timestamp); 30 ~WMRTimestampImpl() override; 31 32 ABI::Windows::Foundation::DateTime TargetTime() const override; 33 ABI::Windows::Foundation::TimeSpan PredictionAmount() const override; 34 ABI::Windows::Perception::IPerceptionTimestamp* GetRawPtr() const override; 35 36 private: 37 Microsoft::WRL::ComPtr<ABI::Windows::Perception::IPerceptionTimestamp> 38 timestamp_; 39 40 DISALLOW_COPY_AND_ASSIGN(WMRTimestampImpl); 41 }; 42 43 } // namespace device 44 #endif // DEVICE_VR_WINDOWS_MIXED_REALITY_WRAPPERS_WMR_TIMESTAMP_H_ 45