OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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 | |
5 #ifndef REMOTING_PROTOCOL_INPUT_EVENT_TIMESTAMPS_H_ | |
6 #define REMOTING_PROTOCOL_INPUT_EVENT_TIMESTAMPS_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "base/time/time.h" | |
10 | |
11 namespace remoting { | |
12 namespace protocol { | |
13 | |
14 // Used on the host side to track timestamps for input events. | |
15 struct InputEventTimestamps { | |
16 // Client-side timestamps. This value comesfrom the client clock, so it should | |
Jamie
2016/10/12 21:41:23
Nit: missing space "comesfrom"
Sergey Ulanov
2016/10/14 19:34:26
Done.
| |
17 // not be used for any calculations on the host side (except in tests). | |
18 base::TimeTicks client_timestamp; | |
19 | |
20 // Time when the event was received by the host. | |
21 base::TimeTicks host_timestamp; | |
22 | |
23 bool is_null() { return client_timestamp.is_null(); } | |
24 }; | |
25 | |
26 // InputEventTimestampSource is used by VideoStream implementations to get event | |
27 // timestamps that are sent back to the client as part of VideoStats message. | |
28 class InputEventTimestampSource | |
29 : public base::RefCountedThreadSafe<InputEventTimestampSource> { | |
30 public: | |
31 InputEventTimestampSource() {} | |
32 | |
33 virtual InputEventTimestamps GetLastEventTimestamps() = 0; | |
34 | |
35 protected: | |
36 friend base::RefCountedThreadSafe<InputEventTimestampSource>; | |
37 virtual ~InputEventTimestampSource() {} | |
38 }; | |
39 | |
40 // Simple implementations of InputEventTimestampSource that just stores the | |
41 // value provided to OnEventReceived(). | |
42 class InputEventTimestampSourceImpl : public InputEventTimestampSource { | |
43 public: | |
44 InputEventTimestampSourceImpl(); | |
45 | |
46 void OnEventReceived(InputEventTimestamps timestamps); | |
47 | |
48 // InputEventTimestampSource implementation. | |
49 InputEventTimestamps GetLastEventTimestamps() override; | |
50 | |
51 protected: | |
52 ~InputEventTimestampSourceImpl() override; | |
53 | |
54 private: | |
55 InputEventTimestamps last_timestamps_; | |
56 }; | |
57 | |
58 } // namespace protocol | |
59 } // namespace remoting | |
60 | |
61 #endif // REMOTING_PROTOCOL_INPUT_EVENT_TIMESTAMPS_H_ | |
OLD | NEW |