Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: base/profiler/tracked_time.cc

Issue 9818004: Cleanup: Replace 'DurationInt' with int32, and always use 32-bit integers for tracking time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "base/profiler/tracked_time.h" 5 #include "base/profiler/tracked_time.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <mmsystem.h> // Declare timeGetTime()... after including build_config. 10 #include <mmsystem.h> // Declare timeGetTime()... after including build_config.
11 #endif 11 #endif
12 12
13 namespace tracked_objects { 13 namespace tracked_objects {
14 14
15 #if defined(USE_FAST_TIME_CLASS_FOR_DURATION_CALCULATIONS)
16
17 Duration::Duration() : ms_(0) {} 15 Duration::Duration() : ms_(0) {}
18 Duration::Duration(int32 duration) : ms_(duration) {} 16 Duration::Duration(int32 duration) : ms_(duration) {}
19 17
20 Duration& Duration::operator+=(const Duration& other) { 18 Duration& Duration::operator+=(const Duration& other) {
21 ms_ += other.ms_; 19 ms_ += other.ms_;
22 return *this; 20 return *this;
23 } 21 }
24 22
25 Duration Duration::operator+(const Duration& other) const { 23 Duration Duration::operator+(const Duration& other) const {
26 return Duration(ms_ + other.ms_); 24 return Duration(ms_ + other.ms_);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 Duration TrackedTime::operator-(const TrackedTime& other) const { 66 Duration TrackedTime::operator-(const TrackedTime& other) const {
69 return Duration(ms_ - other.ms_); 67 return Duration(ms_ - other.ms_);
70 } 68 }
71 69
72 TrackedTime TrackedTime::operator+(const Duration& other) const { 70 TrackedTime TrackedTime::operator+(const Duration& other) const {
73 return TrackedTime(ms_ + other.ms_); 71 return TrackedTime(ms_ + other.ms_);
74 } 72 }
75 73
76 bool TrackedTime::is_null() const { return ms_ == 0; } 74 bool TrackedTime::is_null() const { return ms_ == 0; }
77 75
78 #endif // USE_FAST_TIME_CLASS_FOR_DURATION_CALCULATIONS
79
80 } // namespace tracked_objects 76 } // namespace tracked_objects
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698