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

Side by Side Diff: base/time.h

Issue 11453012: Fix black background when locking with fullscreen window: (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rename undo/stop to cancel Created 8 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 the Windows epoch (1601-01-01 00:00:00 UTC) 6 // microseconds (s/1,000,000) since the Windows epoch (1601-01-01 00:00:00 UTC)
7 // (See http://crbug.com/14734). System-dependent clock interface routines are 7 // (See http://crbug.com/14734). System-dependent clock interface routines are
8 // defined in time_PLATFORM.cc. 8 // 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
11 // microseconds. 11 // microseconds.
12 // 12 //
13 // TimeTicks represents an abstract time that is most of the time incrementing 13 // TimeTicks represents an abstract time that is most of the time incrementing
14 // for use in measuring time durations. It is internally represented in 14 // for use in measuring time durations. It is internally represented in
15 // microseconds. It can not be converted to a human-readable time, but is 15 // microseconds. It can not be converted to a human-readable time, but is
16 // guaranteed not to decrease (if the user changes the computer clock, 16 // guaranteed not to decrease (if the user changes the computer clock,
17 // Time::Now() may actually decrease or jump). But note that TimeTicks may 17 // Time::Now() may actually decrease or jump). But note that TimeTicks may
18 // "stand still", for example if the computer suspended. 18 // "stand still", for example if the computer suspended.
19 // 19 //
20 // TimeFactory can be used to override values returned by Time::Now and
21 // TimeTicks::Now for test purposes.
22 //
20 // These classes are represented as only a 64-bit value, so they can be 23 // These classes are represented as only a 64-bit value, so they can be
21 // efficiently passed by value. 24 // efficiently passed by value.
22 25
23 #ifndef BASE_TIME_H_ 26 #ifndef BASE_TIME_H_
24 #define BASE_TIME_H_ 27 #define BASE_TIME_H_
25 28
26 #include <time.h> 29 #include <time.h>
27 30
28 #include "base/atomicops.h" 31 #include "base/atomicops.h"
29 #include "base/base_export.h" 32 #include "base/base_export.h"
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 #if defined(OS_WIN) 634 #if defined(OS_WIN)
632 typedef DWORD (*TickFunctionType)(void); 635 typedef DWORD (*TickFunctionType)(void);
633 static TickFunctionType SetMockTickFunction(TickFunctionType ticker); 636 static TickFunctionType SetMockTickFunction(TickFunctionType ticker);
634 #endif 637 #endif
635 }; 638 };
636 639
637 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { 640 inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
638 return TimeTicks(t.ticks_ + delta_); 641 return TimeTicks(t.ticks_ + delta_);
639 } 642 }
640 643
644 // TimeFactory ----------------------------------------------------------------
645
646 // This class should be subclassed to provide test values for Time::Now and
647 // TimeTicks::Now. Subclass instance should register itself by setting
648 // |instance_| fields.
649 class BASE_EXPORT TimeFactory {
650 public:
651 // Substitutes value for Time::Now().
652 virtual Time TimeNow() = 0;
653 // Substitutes value for TimeTicks::Now()
654 virtual TimeTicks TimeTicksNow() = 0;
655
656 // Returns instance of |TimeFactory|. If null, system time routines are used.
657 static TimeFactory* instance() { return instance_; }
658 protected:
659 // Implementation of TimeFactory (set by implementing subclasses).
660 static TimeFactory* instance_;
661 };
662
641 } // namespace base 663 } // namespace base
642 664
643 #endif // BASE_TIME_H_ 665 #endif // BASE_TIME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698