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

Side by Side Diff: include/v8-platform.h

Issue 97073004: Make Time functions go through the Platform layer. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: Created 7 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
« no previous file with comments | « no previous file | src/default-platform.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 virtual void CallOnBackgroundThread(Task* task, 70 virtual void CallOnBackgroundThread(Task* task,
71 ExpectedRuntime expected_runtime) = 0; 71 ExpectedRuntime expected_runtime) = 0;
72 72
73 /** 73 /**
74 * Schedules a task to be invoked on a foreground thread wrt a specific 74 * Schedules a task to be invoked on a foreground thread wrt a specific
75 * |isolate|. Tasks posted for the same isolate should be execute in order of 75 * |isolate|. Tasks posted for the same isolate should be execute in order of
76 * scheduling. The definition of "foreground" is opaque to V8. 76 * scheduling. The definition of "foreground" is opaque to V8.
77 */ 77 */
78 virtual void CallOnForegroundThread(Isolate* isolate, Task* task) = 0; 78 virtual void CallOnForegroundThread(Isolate* isolate, Task* task) = 0;
79 79
80 /**
81 * The current time, represented as microseconds (s/1,000,000) since
82 * 00:00:00 UTC, January 1, 1970.
83 *
84 * This value can go backwards, if the system adjusts its clock.
85 */
86 virtual int64_t CurrentTime();
87
88 /**
89 * The current time, represented as microseconds (s/1,000,000) since
90 * 00:00:00 UTC, January 1, 1970.
91 *
92 * This function always uses system time so that there are no discrepancies
93 * between the returned time and system time even on virtual environments,
94 * including our test bot.
95 *
96 * This value can go backwards, if the system adjusts its clock.
97 *
98 * This function is used for timing sensitive unittests.
99 */
100 virtual int64_t CurrentTimeFromSystemTime();
101
102 /**
103 * An abstract time intended for use in measuring time durations, represented
104 * as microseconds.
105 *
106 * This is guaranteed not to decrease even if the computer clock goes
107 * backwards, but it may "stand still", for example if the computer is
108 * suspended.
109 *
110 * The resolution of this clock can be as low as 15ms, and it varies
111 * depending on hardware/operating system.
112 *
113 * This method never returns 0.
114 */
115 virtual int64_t TimeTicksNow();
116
117 /**
118 * An abstract time intended for use in measuring time durations, represented
119 * as microseconds.
120 *
121 * This is guaranteed not to decrease even if the computer clock goes
122 * backwards, but it may "stand still", for example if the computer is
123 * suspended.
124 *
125 * The implementation is hardware dependent and its return values may or may
126 * not have sub-millisecond resolution. THIS CALL IS GENERALLY MUCH MORE
127 * EXPENSIVE THAN TimeTicksNow() AND SHOULD ONLY BE USED WHEN IT IS REALLY
128 * NEEDED.
129 *
130 * This method never returns 0.
131 */
132 virtual int64_t TimeTicksHighResNow();
133
134 /**
135 * True if the TimeTicksHighResNow() returns values with high resolution.
136 */
137 virtual bool TimeTicksHasHighRes();
138
80 protected: 139 protected:
81 virtual ~Platform() {} 140 virtual ~Platform() {}
82 }; 141 };
83 142
84 } // namespace v8 143 } // namespace v8
85 144
86 #endif // V8_V8_PLATFORM_H_ 145 #endif // V8_V8_PLATFORM_H_
OLDNEW
« no previous file with comments | « no previous file | src/default-platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698