| 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 BASE_PROFILER_TRACKED_TIME_H_ | 5 #ifndef BASE_PROFILER_TRACKED_TIME_H_ |
| 6 #define BASE_PROFILER_TRACKED_TIME_H_ | 6 #define BASE_PROFILER_TRACKED_TIME_H_ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "base/base_export.h" | 9 #include "base/base_export.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 class BASE_EXPORT TrackedTime { // Similar to base::TimeTicks. | 55 class BASE_EXPORT TrackedTime { // Similar to base::TimeTicks. |
| 56 public: | 56 public: |
| 57 TrackedTime(); | 57 TrackedTime(); |
| 58 explicit TrackedTime(const base::TimeTicks& time); | 58 explicit TrackedTime(const base::TimeTicks& time); |
| 59 | 59 |
| 60 static TrackedTime Now(); | 60 static TrackedTime Now(); |
| 61 Duration operator-(const TrackedTime& other) const; | 61 Duration operator-(const TrackedTime& other) const; |
| 62 TrackedTime operator+(const Duration& other) const; | 62 TrackedTime operator+(const Duration& other) const; |
| 63 bool is_null() const; | 63 bool is_null() const; |
| 64 | 64 |
| 65 static TrackedTime FromMilliseconds(int32 ms) { return TrackedTime(ms); } |
| 66 |
| 65 private: | 67 private: |
| 66 friend class Duration; | 68 friend class Duration; |
| 67 explicit TrackedTime(int32 ms); | 69 explicit TrackedTime(int32 ms); |
| 68 | 70 |
| 69 // Internal duration is stored directly in milliseconds. | 71 // Internal duration is stored directly in milliseconds. |
| 70 uint32 ms_; | 72 uint32 ms_; |
| 71 }; | 73 }; |
| 72 | 74 |
| 73 #else | 75 #else |
| 74 | 76 |
| 75 // Just use full 64 bit time calculations, and the slower TimeTicks::Now(). | 77 // Just use full 64 bit time calculations, and the slower TimeTicks::Now(). |
| 76 // This allows us (as an alternative) to test with larger ranges of times, and | 78 // This allows us (as an alternative) to test with larger ranges of times, and |
| 77 // with a more thoroughly tested class. | 79 // with a more thoroughly tested class. |
| 78 | 80 |
| 79 typedef base::TimeTicks TrackedTime; | 81 typedef base::TimeTicks TrackedTime; |
| 80 typedef base::TimeDelta Duration; | 82 typedef base::TimeDelta Duration; |
| 81 | 83 |
| 82 #endif // USE_FAST_TIME_CLASS_FOR_DURATION_CALCULATIONS | 84 #endif // USE_FAST_TIME_CLASS_FOR_DURATION_CALCULATIONS |
| 83 | 85 |
| 84 } // namespace tracked_objects | 86 } // namespace tracked_objects |
| 85 | 87 |
| 86 #endif // BASE_PROFILER_TRACKED_TIME_H_ | 88 #endif // BASE_PROFILER_TRACKED_TIME_H_ |
| OLD | NEW |