| 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/time.h" | 8 #include "base/time/time.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) const; | 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) const; | 62 LocalTimeDelta ToLocalTimeDelta(const RemoteTimeDelta& remote_delta) const; |
| 63 | 63 |
| 64 // Returns true iff the TimeTicks are converted by adding a constant, without |
| 65 // scaling. This is the case whenever the remote timespan is smaller than the |
| 66 // local timespan, which should be the majority of cases due to IPC overhead. |
| 67 bool IsSkewAdditiveForMetrics() const; |
| 68 |
| 69 // Returns the (remote time) - (local time) difference estimated by the |
| 70 // converter. This is the constant that is subtracted from remote TimeTicks to |
| 71 // get local TimeTicks when no scaling is applied. |
| 72 base::TimeDelta GetSkewForMetrics() const; |
| 73 |
| 64 private: | 74 private: |
| 65 int64 Convert(int64 value) const; | 75 int64 Convert(int64 value) const; |
| 66 | 76 |
| 67 // The local time which |remote_lower_bound_| is mapped to. | 77 // The local time which |remote_lower_bound_| is mapped to. |
| 68 int64 local_base_time_; | 78 int64 local_base_time_; |
| 69 | 79 |
| 70 int64 numerator_; | 80 int64 numerator_; |
| 71 int64 denominator_; | 81 int64 denominator_; |
| 72 | 82 |
| 73 int64 remote_lower_bound_; | 83 int64 remote_lower_bound_; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 friend class InterProcessTimeTicksConverter; | 148 friend class InterProcessTimeTicksConverter; |
| 139 | 149 |
| 140 RemoteTimeTicks(int64 value) : value_(value) {} | 150 RemoteTimeTicks(int64 value) : value_(value) {} |
| 141 | 151 |
| 142 int64 value_; | 152 int64 value_; |
| 143 }; | 153 }; |
| 144 | 154 |
| 145 } // namespace content | 155 } // namespace content |
| 146 | 156 |
| 147 #endif // CONTENT_COMMON_INTER_PROCESS_TIME_TICKS_CONVERTER_H_ | 157 #endif // CONTENT_COMMON_INTER_PROCESS_TIME_TICKS_CONVERTER_H_ |
| OLD | NEW |