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 int64 offset_; | 67 int64 offset_; |
68 int64 numerator_; | 68 int64 numerator_; |
69 int64 denominator_; | 69 int64 denominator_; |
70 | 70 |
71 int64 remote_lower_bound_; | 71 int64 remote_lower_bound_; |
72 int64 remote_upper_bound_; | 72 int64 remote_upper_bound_; |
73 }; | 73 }; |
74 | 74 |
75 class CONTENT_EXPORT LocalTimeDelta { | 75 class CONTENT_EXPORT LocalTimeDelta { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 friend class InterProcessTimeTicksConverter; | 136 friend class InterProcessTimeTicksConverter; |
137 | 137 |
138 RemoteTimeTicks(int64 value) : value_(value) {} | 138 RemoteTimeTicks(int64 value) : value_(value) {} |
139 | 139 |
140 int64 value_; | 140 int64 value_; |
141 }; | 141 }; |
142 | 142 |
143 } // namespace content | 143 } // namespace content |
144 | 144 |
145 #endif // CONTENT_COMMON_INTER_PROCESS_TIME_TICKS_CONVERTER_H_ | 145 #endif // CONTENT_COMMON_INTER_PROCESS_TIME_TICKS_CONVERTER_H_ |
OLD | NEW |