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

Side by Side Diff: base/time.h

Issue 7740070: Add metrics to measure time elapsed between form load and form submission with or without Autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile Created 9 years, 3 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 // Time represents an absolute point in time, internally represented as 5 // Time represents an absolute point in time, internally represented as
6 // microseconds (s/1,000,000) since a platform-dependent epoch. Each 6 // microseconds (s/1,000,000) since a platform-dependent epoch. Each
7 // platform's epoch, along with other system-dependent clock interface 7 // platform's epoch, along with other system-dependent clock interface
8 // routines, is defined in time_PLATFORM.cc. 8 // routines, is defined in time_PLATFORM.cc.
9 // 9 //
10 // TimeDelta represents a duration of time, internally represented in 10 // TimeDelta represents a duration of time, internally represented in
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 54
55 // Converts units of time to TimeDeltas. 55 // Converts units of time to TimeDeltas.
56 static TimeDelta FromDays(int64 days); 56 static TimeDelta FromDays(int64 days);
57 static TimeDelta FromHours(int64 hours); 57 static TimeDelta FromHours(int64 hours);
58 static TimeDelta FromMinutes(int64 minutes); 58 static TimeDelta FromMinutes(int64 minutes);
59 static TimeDelta FromSeconds(int64 secs); 59 static TimeDelta FromSeconds(int64 secs);
60 static TimeDelta FromMilliseconds(int64 ms); 60 static TimeDelta FromMilliseconds(int64 ms);
61 static TimeDelta FromMicroseconds(int64 us); 61 static TimeDelta FromMicroseconds(int64 us);
62 62
63 // Converts an integer value representing TimeDelta to a class. This is used
64 // when deserializing a |TimeDelta| structure, using a value known to be
65 // compatible. It is not provided as a constructor because the integer type
66 // may be unclear from the perspective of a caller.
67 static TimeDelta FromInternalValue(int64 delta) {
68 return TimeDelta(delta);
69 }
70
63 // Returns the internal numeric value of the TimeDelta object. Please don't 71 // Returns the internal numeric value of the TimeDelta object. Please don't
64 // use this and do arithmetic on it, as it is more error prone than using the 72 // use this and do arithmetic on it, as it is more error prone than using the
65 // provided operators. 73 // provided operators.
74 // For serializing, use FromInternalValue to reconstitute.
66 int64 ToInternalValue() const { 75 int64 ToInternalValue() const {
67 return delta_; 76 return delta_;
68 } 77 }
69 78
70 #if defined(OS_POSIX) 79 #if defined(OS_POSIX)
71 struct timespec ToTimeSpec() const; 80 struct timespec ToTimeSpec() const;
72 #endif 81 #endif
73 82
74 // Returns the time delta in some unit. The F versions return a floating 83 // Returns the time delta in some unit. The F versions return a floating
75 // point value, the "regular" versions return a rounded-down value. 84 // point value, the "regular" versions return a rounded-down value.
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // Returns true if the high resolution clock is working on this system. 489 // Returns true if the high resolution clock is working on this system.
481 // This is only for testing. 490 // This is only for testing.
482 static bool IsHighResClockWorking(); 491 static bool IsHighResClockWorking();
483 #endif 492 #endif
484 493
485 // Returns true if this object has not been initialized. 494 // Returns true if this object has not been initialized.
486 bool is_null() const { 495 bool is_null() const {
487 return ticks_ == 0; 496 return ticks_ == 0;
488 } 497 }
489 498
499 // Converts an integer value representing TimeTicks to a class. This is used
500 // when deserializing a |TimeTicks| structure, using a value known to be
501 // compatible. It is not provided as a constructor because the integer type
502 // may be unclear from the perspective of a caller.
503 static TimeTicks FromInternalValue(int64 ticks) {
504 return TimeTicks(ticks);
505 }
506
490 // Returns the internal numeric value of the TimeTicks object. 507 // Returns the internal numeric value of the TimeTicks object.
508 // For serializing, use FromInternalValue to reconstitute.
491 int64 ToInternalValue() const { 509 int64 ToInternalValue() const {
492 return ticks_; 510 return ticks_;
493 } 511 }
494 512
495 TimeTicks& operator=(TimeTicks other) { 513 TimeTicks& operator=(TimeTicks other) {
496 ticks_ = other.ticks_; 514 ticks_ = other.ticks_;
497 return *this; 515 return *this;
498 } 516 }
499 517
500 // Compute the difference between two times. 518 // Compute the difference between two times.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 #endif 575 #endif
558 }; 576 };
559 577
560 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { 578 inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
561 return TimeTicks(t.ticks_ + delta_); 579 return TimeTicks(t.ticks_ + delta_);
562 } 580 }
563 581
564 } // namespace base 582 } // namespace base
565 583
566 #endif // BASE_TIME_H_ 584 #endif // BASE_TIME_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_manager.h » ('j') | chrome/browser/autofill/autofill_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698