OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_COMMON_INTER_PROCESS_TIME_TICKS_CONVERTER_H_ | 5 #ifndef CONTENT_COMMON_INTER_PROCESS_TIME_TICKS_CONVERTER_H_ |
6 #define CONTENT_COMMON_INTER_PROCESS_TIME_TICKS_CONVERTER_H_ | 6 #define CONTENT_COMMON_INTER_PROCESS_TIME_TICKS_CONVERTER_H_ |
7 | 7 |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // local's range. Any values converted will be shifted the same amount. | 48 // local's range. Any values converted will be shifted the same amount. |
49 class CONTENT_EXPORT InterProcessTimeTicksConverter { | 49 class CONTENT_EXPORT InterProcessTimeTicksConverter { |
50 public: | 50 public: |
51 InterProcessTimeTicksConverter(const LocalTimeTicks& local_lower_bound, | 51 InterProcessTimeTicksConverter(const LocalTimeTicks& local_lower_bound, |
52 const LocalTimeTicks& local_upper_bound, | 52 const LocalTimeTicks& local_upper_bound, |
53 const RemoteTimeTicks& remote_lower_bound, | 53 const RemoteTimeTicks& remote_lower_bound, |
54 const RemoteTimeTicks& remote_upper_bound); | 54 const RemoteTimeTicks& remote_upper_bound); |
55 | 55 |
56 // Returns the value within the local's bounds that correlates to | 56 // Returns the value within the local's bounds that correlates to |
57 // |remote_ms|. | 57 // |remote_ms|. |
58 LocalTimeTicks ToLocalTimeTicks(const RemoteTimeTicks& remote_ms); | 58 LocalTimeTicks ToLocalTimeTicks(const RemoteTimeTicks& remote_ms) const; |
59 | 59 |
60 // Returns the equivalent delta after applying remote-to-local scaling to | 60 // Returns the equivalent delta after applying remote-to-local scaling to |
61 // |remote_delta|. | 61 // |remote_delta|. |
62 LocalTimeDelta ToLocalTimeDelta(const RemoteTimeDelta& remote_delta); | 62 LocalTimeDelta ToLocalTimeDelta(const RemoteTimeDelta& remote_delta) const; |
63 | 63 |
64 private: | 64 private: |
65 int64 Convert(int64 value); | 65 int64 Convert(int64 value) const; |
66 | 66 |
67 // The local time which |remote_lower_bound_| is mapped to. | 67 // The local time which |remote_lower_bound_| is mapped to. |
68 int64 local_base_time_; | 68 int64 local_base_time_; |
69 | 69 |
70 int64 numerator_; | 70 int64 numerator_; |
71 int64 denominator_; | 71 int64 denominator_; |
72 | 72 |
73 int64 remote_lower_bound_; | 73 int64 remote_lower_bound_; |
74 int64 remote_upper_bound_; | 74 int64 remote_upper_bound_; |
75 }; | 75 }; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 friend class InterProcessTimeTicksConverter; | 138 friend class InterProcessTimeTicksConverter; |
139 | 139 |
140 RemoteTimeTicks(int64 value) : value_(value) {} | 140 RemoteTimeTicks(int64 value) : value_(value) {} |
141 | 141 |
142 int64 value_; | 142 int64 value_; |
143 }; | 143 }; |
144 | 144 |
145 } // namespace content | 145 } // namespace content |
146 | 146 |
147 #endif // CONTENT_COMMON_INTER_PROCESS_TIME_TICKS_CONVERTER_H_ | 147 #endif // CONTENT_COMMON_INTER_PROCESS_TIME_TICKS_CONVERTER_H_ |
OLD | NEW |