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

Side by Side Diff: third_party/WebKit/Source/wtf/CurrentTime.h

Issue 1936853002: Assert event timestamp to be monotonic and not from future Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change to histogram Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2008 Google Inc. All rights reserved. 3 * Copyright (C) 2008 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 WTF_EXPORT double monotonicallyIncreasingTime(); 52 WTF_EXPORT double monotonicallyIncreasingTime();
53 53
54 // Same thing, in milliseconds. 54 // Same thing, in milliseconds.
55 inline double monotonicallyIncreasingTimeMS() 55 inline double monotonicallyIncreasingTimeMS()
56 { 56 {
57 return monotonicallyIncreasingTime() * 1000.0; 57 return monotonicallyIncreasingTime() * 1000.0;
58 } 58 }
59 59
60 using TimeFunction = double (*)(); 60 using TimeFunction = double (*)();
61 61
62 // Make all the time functions (currentTime(), monotonicallyIncreasingTime(), sy stemTraceTime()) return the result 62 // Make |currentTime()| function return the result of the supplied function.
63 // of the supplied function. Returns the pointer to the old time function. For b oth setting and getting, nullptr means 63 // Returns the pointer to the old time function. For both setting and getting,
64 // using the default timing function returning the actual time. 64 // nullptr means using the default timing function returning the actual time.
65 WTF_EXPORT TimeFunction setTimeFunctionsForTesting(TimeFunction); 65 WTF_EXPORT TimeFunction setCurrentTimeFunctionForTesting(TimeFunction);
66
67 // Make |monotonicallyIncreasingTime()| function return the result of the
68 // supplied function.
69 // Returns the pointer to the old time function. For both setting and getting,
70 // nullptr means using the default timing function returning the actual time.
71 WTF_EXPORT TimeFunction setMonotonicallyIncreasingTimeFunctionForTesting(TimeFun ction);
72
66 73
67 } // namespace WTF 74 } // namespace WTF
68 75
69 using WTF::currentTime; 76 using WTF::currentTime;
70 using WTF::currentTimeMS; 77 using WTF::currentTimeMS;
71 using WTF::monotonicallyIncreasingTime; 78 using WTF::monotonicallyIncreasingTime;
72 using WTF::monotonicallyIncreasingTimeMS; 79 using WTF::monotonicallyIncreasingTimeMS;
73 using WTF::TimeFunction; 80 using WTF::TimeFunction;
74 using WTF::setTimeFunctionsForTesting; 81 using WTF::setCurrentTimeFunctionForTesting;
82 using WTF::setMonotonicallyIncreasingTimeFunctionForTesting;
75 83
76 #endif // CurrentTime_h 84 #endif // CurrentTime_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/TextFinderTest.cpp ('k') | third_party/WebKit/Source/wtf/CurrentTime.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698