libv8 3.16.14.19-universal-darwin-17 → 6.2.414.42.1-universal-darwin-17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/libv8/arch.rb +10 -33
- data/ext/libv8/location.rb +15 -7
- data/ext/libv8/paths.rb +3 -3
- data/lib/libv8/version.rb +1 -1
- data/vendor/v8/include/libplatform/libplatform-export.h +29 -0
- data/vendor/v8/include/libplatform/libplatform.h +83 -0
- data/vendor/v8/include/libplatform/v8-tracing.h +284 -0
- data/vendor/v8/include/v8-debug.h +104 -257
- data/vendor/v8/include/v8-inspector-protocol.h +13 -0
- data/vendor/v8/include/v8-inspector.h +267 -0
- data/vendor/v8/include/v8-platform.h +241 -0
- data/vendor/v8/include/v8-profiler.h +514 -185
- data/vendor/v8/include/v8-testing.h +5 -62
- data/vendor/v8/include/v8-util.h +655 -0
- data/vendor/v8/include/v8-value-serializer-version.h +24 -0
- data/vendor/v8/include/v8-version-string.h +33 -0
- data/vendor/v8/include/v8-version.h +20 -0
- data/vendor/v8/include/v8.h +8944 -3504
- data/vendor/v8/include/v8config.h +417 -0
- data/vendor/v8/out/x64.release/libv8_base.a +0 -0
- data/vendor/v8/out/x64.release/libv8_builtins_generators.a +0 -0
- data/vendor/v8/out/x64.release/libv8_builtins_setup.a +0 -0
- data/vendor/v8/out/x64.release/libv8_libbase.a +0 -0
- data/vendor/v8/out/x64.release/libv8_libplatform.a +0 -0
- data/vendor/v8/out/x64.release/libv8_libsampler.a +0 -0
- data/vendor/v8/out/x64.release/libv8_nosnapshot.a +0 -0
- data/vendor/v8/out/x64.release/libv8_snapshot.a +0 -0
- metadata +22 -23
- data/vendor/v8/include/v8-preparser.h +0 -118
- data/vendor/v8/include/v8stdint.h +0 -54
- data/vendor/v8/out/x64.release/libpreparser_lib.a +0 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
// Copyright 2016 the V8 project authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
#ifndef V8_V8_INSPECTOR_PROTOCOL_H_
|
6
|
+
#define V8_V8_INSPECTOR_PROTOCOL_H_
|
7
|
+
|
8
|
+
#include "inspector/Debugger.h" // NOLINT(build/include)
|
9
|
+
#include "inspector/Runtime.h" // NOLINT(build/include)
|
10
|
+
#include "inspector/Schema.h" // NOLINT(build/include)
|
11
|
+
#include "v8-inspector.h" // NOLINT(build/include)
|
12
|
+
|
13
|
+
#endif // V8_V8_INSPECTOR_PROTOCOL_H_
|
@@ -0,0 +1,267 @@
|
|
1
|
+
// Copyright 2016 the V8 project authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
#ifndef V8_V8_INSPECTOR_H_
|
6
|
+
#define V8_V8_INSPECTOR_H_
|
7
|
+
|
8
|
+
#include <stdint.h>
|
9
|
+
#include <cctype>
|
10
|
+
|
11
|
+
#include <memory>
|
12
|
+
|
13
|
+
#include "v8.h" // NOLINT(build/include)
|
14
|
+
|
15
|
+
namespace v8_inspector {
|
16
|
+
|
17
|
+
namespace protocol {
|
18
|
+
namespace Debugger {
|
19
|
+
namespace API {
|
20
|
+
class SearchMatch;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
namespace Runtime {
|
24
|
+
namespace API {
|
25
|
+
class RemoteObject;
|
26
|
+
class StackTrace;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
namespace Schema {
|
30
|
+
namespace API {
|
31
|
+
class Domain;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
} // namespace protocol
|
35
|
+
|
36
|
+
class V8_EXPORT StringView {
|
37
|
+
public:
|
38
|
+
StringView() : m_is8Bit(true), m_length(0), m_characters8(nullptr) {}
|
39
|
+
|
40
|
+
StringView(const uint8_t* characters, size_t length)
|
41
|
+
: m_is8Bit(true), m_length(length), m_characters8(characters) {}
|
42
|
+
|
43
|
+
StringView(const uint16_t* characters, size_t length)
|
44
|
+
: m_is8Bit(false), m_length(length), m_characters16(characters) {}
|
45
|
+
|
46
|
+
bool is8Bit() const { return m_is8Bit; }
|
47
|
+
size_t length() const { return m_length; }
|
48
|
+
|
49
|
+
// TODO(dgozman): add DCHECK(m_is8Bit) to accessors once platform can be used
|
50
|
+
// here.
|
51
|
+
const uint8_t* characters8() const { return m_characters8; }
|
52
|
+
const uint16_t* characters16() const { return m_characters16; }
|
53
|
+
|
54
|
+
private:
|
55
|
+
bool m_is8Bit;
|
56
|
+
size_t m_length;
|
57
|
+
union {
|
58
|
+
const uint8_t* m_characters8;
|
59
|
+
const uint16_t* m_characters16;
|
60
|
+
};
|
61
|
+
};
|
62
|
+
|
63
|
+
class V8_EXPORT StringBuffer {
|
64
|
+
public:
|
65
|
+
virtual ~StringBuffer() {}
|
66
|
+
virtual const StringView& string() = 0;
|
67
|
+
// This method copies contents.
|
68
|
+
static std::unique_ptr<StringBuffer> create(const StringView&);
|
69
|
+
};
|
70
|
+
|
71
|
+
class V8_EXPORT V8ContextInfo {
|
72
|
+
public:
|
73
|
+
V8ContextInfo(v8::Local<v8::Context> context, int contextGroupId,
|
74
|
+
const StringView& humanReadableName)
|
75
|
+
: context(context),
|
76
|
+
contextGroupId(contextGroupId),
|
77
|
+
humanReadableName(humanReadableName),
|
78
|
+
hasMemoryOnConsole(false) {}
|
79
|
+
|
80
|
+
v8::Local<v8::Context> context;
|
81
|
+
// Each v8::Context is a part of a group. The group id must be non-zero.
|
82
|
+
int contextGroupId;
|
83
|
+
StringView humanReadableName;
|
84
|
+
StringView origin;
|
85
|
+
StringView auxData;
|
86
|
+
bool hasMemoryOnConsole;
|
87
|
+
|
88
|
+
static int executionContextId(v8::Local<v8::Context> context);
|
89
|
+
|
90
|
+
private:
|
91
|
+
// Disallow copying and allocating this one.
|
92
|
+
enum NotNullTagEnum { NotNullLiteral };
|
93
|
+
void* operator new(size_t) = delete;
|
94
|
+
void* operator new(size_t, NotNullTagEnum, void*) = delete;
|
95
|
+
void* operator new(size_t, void*) = delete;
|
96
|
+
V8ContextInfo(const V8ContextInfo&) = delete;
|
97
|
+
V8ContextInfo& operator=(const V8ContextInfo&) = delete;
|
98
|
+
};
|
99
|
+
|
100
|
+
class V8_EXPORT V8StackTrace {
|
101
|
+
public:
|
102
|
+
virtual bool isEmpty() const = 0;
|
103
|
+
virtual StringView topSourceURL() const = 0;
|
104
|
+
virtual int topLineNumber() const = 0;
|
105
|
+
virtual int topColumnNumber() const = 0;
|
106
|
+
virtual StringView topScriptId() const = 0;
|
107
|
+
virtual StringView topFunctionName() const = 0;
|
108
|
+
|
109
|
+
virtual ~V8StackTrace() {}
|
110
|
+
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
111
|
+
buildInspectorObject() const = 0;
|
112
|
+
virtual std::unique_ptr<StringBuffer> toString() const = 0;
|
113
|
+
|
114
|
+
// Safe to pass between threads, drops async chain.
|
115
|
+
virtual std::unique_ptr<V8StackTrace> clone() = 0;
|
116
|
+
};
|
117
|
+
|
118
|
+
class V8_EXPORT V8InspectorSession {
|
119
|
+
public:
|
120
|
+
virtual ~V8InspectorSession() {}
|
121
|
+
|
122
|
+
// Cross-context inspectable values (DOM nodes in different worlds, etc.).
|
123
|
+
class V8_EXPORT Inspectable {
|
124
|
+
public:
|
125
|
+
virtual v8::Local<v8::Value> get(v8::Local<v8::Context>) = 0;
|
126
|
+
virtual ~Inspectable() {}
|
127
|
+
};
|
128
|
+
virtual void addInspectedObject(std::unique_ptr<Inspectable>) = 0;
|
129
|
+
|
130
|
+
// Dispatching protocol messages.
|
131
|
+
static bool canDispatchMethod(const StringView& method);
|
132
|
+
virtual void dispatchProtocolMessage(const StringView& message) = 0;
|
133
|
+
virtual std::unique_ptr<StringBuffer> stateJSON() = 0;
|
134
|
+
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
135
|
+
supportedDomains() = 0;
|
136
|
+
|
137
|
+
// Debugger actions.
|
138
|
+
virtual void schedulePauseOnNextStatement(const StringView& breakReason,
|
139
|
+
const StringView& breakDetails) = 0;
|
140
|
+
virtual void cancelPauseOnNextStatement() = 0;
|
141
|
+
virtual void breakProgram(const StringView& breakReason,
|
142
|
+
const StringView& breakDetails) = 0;
|
143
|
+
virtual void setSkipAllPauses(bool) = 0;
|
144
|
+
virtual void resume() = 0;
|
145
|
+
virtual void stepOver() = 0;
|
146
|
+
virtual std::vector<std::unique_ptr<protocol::Debugger::API::SearchMatch>>
|
147
|
+
searchInTextByLines(const StringView& text, const StringView& query,
|
148
|
+
bool caseSensitive, bool isRegex) = 0;
|
149
|
+
|
150
|
+
// Remote objects.
|
151
|
+
virtual std::unique_ptr<protocol::Runtime::API::RemoteObject> wrapObject(
|
152
|
+
v8::Local<v8::Context>, v8::Local<v8::Value>,
|
153
|
+
const StringView& groupName) = 0;
|
154
|
+
virtual bool unwrapObject(std::unique_ptr<StringBuffer>* error,
|
155
|
+
const StringView& objectId, v8::Local<v8::Value>*,
|
156
|
+
v8::Local<v8::Context>*,
|
157
|
+
std::unique_ptr<StringBuffer>* objectGroup) = 0;
|
158
|
+
virtual void releaseObjectGroup(const StringView&) = 0;
|
159
|
+
};
|
160
|
+
|
161
|
+
class V8_EXPORT V8InspectorClient {
|
162
|
+
public:
|
163
|
+
virtual ~V8InspectorClient() {}
|
164
|
+
|
165
|
+
virtual void runMessageLoopOnPause(int contextGroupId) {}
|
166
|
+
virtual void quitMessageLoopOnPause() {}
|
167
|
+
virtual void runIfWaitingForDebugger(int contextGroupId) {}
|
168
|
+
|
169
|
+
virtual void muteMetrics(int contextGroupId) {}
|
170
|
+
virtual void unmuteMetrics(int contextGroupId) {}
|
171
|
+
|
172
|
+
virtual void beginUserGesture() {}
|
173
|
+
virtual void endUserGesture() {}
|
174
|
+
|
175
|
+
virtual std::unique_ptr<StringBuffer> valueSubtype(v8::Local<v8::Value>) {
|
176
|
+
return nullptr;
|
177
|
+
}
|
178
|
+
virtual bool formatAccessorsAsProperties(v8::Local<v8::Value>) {
|
179
|
+
return false;
|
180
|
+
}
|
181
|
+
virtual bool isInspectableHeapObject(v8::Local<v8::Object>) { return true; }
|
182
|
+
|
183
|
+
virtual v8::Local<v8::Context> ensureDefaultContextInGroup(
|
184
|
+
int contextGroupId) {
|
185
|
+
return v8::Local<v8::Context>();
|
186
|
+
}
|
187
|
+
virtual void beginEnsureAllContextsInGroup(int contextGroupId) {}
|
188
|
+
virtual void endEnsureAllContextsInGroup(int contextGroupId) {}
|
189
|
+
|
190
|
+
virtual void installAdditionalCommandLineAPI(v8::Local<v8::Context>,
|
191
|
+
v8::Local<v8::Object>) {}
|
192
|
+
virtual void consoleAPIMessage(int contextGroupId,
|
193
|
+
v8::Isolate::MessageErrorLevel level,
|
194
|
+
const StringView& message,
|
195
|
+
const StringView& url, unsigned lineNumber,
|
196
|
+
unsigned columnNumber, V8StackTrace*) {}
|
197
|
+
virtual v8::MaybeLocal<v8::Value> memoryInfo(v8::Isolate*,
|
198
|
+
v8::Local<v8::Context>) {
|
199
|
+
return v8::MaybeLocal<v8::Value>();
|
200
|
+
}
|
201
|
+
|
202
|
+
virtual void consoleTime(const StringView& title) {}
|
203
|
+
virtual void consoleTimeEnd(const StringView& title) {}
|
204
|
+
virtual void consoleTimeStamp(const StringView& title) {}
|
205
|
+
virtual void consoleClear(int contextGroupId) {}
|
206
|
+
virtual double currentTimeMS() { return 0; }
|
207
|
+
typedef void (*TimerCallback)(void*);
|
208
|
+
virtual void startRepeatingTimer(double, TimerCallback, void* data) {}
|
209
|
+
virtual void cancelTimer(void* data) {}
|
210
|
+
|
211
|
+
// TODO(dgozman): this was added to support service worker shadow page. We
|
212
|
+
// should not connect at all.
|
213
|
+
virtual bool canExecuteScripts(int contextGroupId) { return true; }
|
214
|
+
};
|
215
|
+
|
216
|
+
class V8_EXPORT V8Inspector {
|
217
|
+
public:
|
218
|
+
static std::unique_ptr<V8Inspector> create(v8::Isolate*, V8InspectorClient*);
|
219
|
+
virtual ~V8Inspector() {}
|
220
|
+
|
221
|
+
// Contexts instrumentation.
|
222
|
+
virtual void contextCreated(const V8ContextInfo&) = 0;
|
223
|
+
virtual void contextDestroyed(v8::Local<v8::Context>) = 0;
|
224
|
+
virtual void resetContextGroup(int contextGroupId) = 0;
|
225
|
+
|
226
|
+
// Various instrumentation.
|
227
|
+
virtual void idleStarted() = 0;
|
228
|
+
virtual void idleFinished() = 0;
|
229
|
+
|
230
|
+
// Async stack traces instrumentation.
|
231
|
+
virtual void asyncTaskScheduled(const StringView& taskName, void* task,
|
232
|
+
bool recurring) = 0;
|
233
|
+
virtual void asyncTaskCanceled(void* task) = 0;
|
234
|
+
virtual void asyncTaskStarted(void* task) = 0;
|
235
|
+
virtual void asyncTaskFinished(void* task) = 0;
|
236
|
+
virtual void allAsyncTasksCanceled() = 0;
|
237
|
+
|
238
|
+
// Exceptions instrumentation.
|
239
|
+
virtual unsigned exceptionThrown(
|
240
|
+
v8::Local<v8::Context>, const StringView& message,
|
241
|
+
v8::Local<v8::Value> exception, const StringView& detailedMessage,
|
242
|
+
const StringView& url, unsigned lineNumber, unsigned columnNumber,
|
243
|
+
std::unique_ptr<V8StackTrace>, int scriptId) = 0;
|
244
|
+
virtual void exceptionRevoked(v8::Local<v8::Context>, unsigned exceptionId,
|
245
|
+
const StringView& message) = 0;
|
246
|
+
|
247
|
+
// Connection.
|
248
|
+
class V8_EXPORT Channel {
|
249
|
+
public:
|
250
|
+
virtual ~Channel() {}
|
251
|
+
virtual void sendResponse(int callId,
|
252
|
+
std::unique_ptr<StringBuffer> message) = 0;
|
253
|
+
virtual void sendNotification(std::unique_ptr<StringBuffer> message) = 0;
|
254
|
+
virtual void flushProtocolNotifications() = 0;
|
255
|
+
};
|
256
|
+
virtual std::unique_ptr<V8InspectorSession> connect(
|
257
|
+
int contextGroupId, Channel*, const StringView& state) = 0;
|
258
|
+
|
259
|
+
// API methods.
|
260
|
+
virtual std::unique_ptr<V8StackTrace> createStackTrace(
|
261
|
+
v8::Local<v8::StackTrace>) = 0;
|
262
|
+
virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
|
263
|
+
};
|
264
|
+
|
265
|
+
} // namespace v8_inspector
|
266
|
+
|
267
|
+
#endif // V8_V8_INSPECTOR_H_
|
@@ -0,0 +1,241 @@
|
|
1
|
+
// Copyright 2013 the V8 project authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
#ifndef V8_V8_PLATFORM_H_
|
6
|
+
#define V8_V8_PLATFORM_H_
|
7
|
+
|
8
|
+
#include <stddef.h>
|
9
|
+
#include <stdint.h>
|
10
|
+
#include <memory>
|
11
|
+
#include <string>
|
12
|
+
|
13
|
+
namespace v8 {
|
14
|
+
|
15
|
+
class Isolate;
|
16
|
+
|
17
|
+
/**
|
18
|
+
* A Task represents a unit of work.
|
19
|
+
*/
|
20
|
+
class Task {
|
21
|
+
public:
|
22
|
+
virtual ~Task() = default;
|
23
|
+
|
24
|
+
virtual void Run() = 0;
|
25
|
+
};
|
26
|
+
|
27
|
+
/**
|
28
|
+
* An IdleTask represents a unit of work to be performed in idle time.
|
29
|
+
* The Run method is invoked with an argument that specifies the deadline in
|
30
|
+
* seconds returned by MonotonicallyIncreasingTime().
|
31
|
+
* The idle task is expected to complete by this deadline.
|
32
|
+
*/
|
33
|
+
class IdleTask {
|
34
|
+
public:
|
35
|
+
virtual ~IdleTask() = default;
|
36
|
+
virtual void Run(double deadline_in_seconds) = 0;
|
37
|
+
};
|
38
|
+
|
39
|
+
/**
|
40
|
+
* The interface represents complex arguments to trace events.
|
41
|
+
*/
|
42
|
+
class ConvertableToTraceFormat {
|
43
|
+
public:
|
44
|
+
virtual ~ConvertableToTraceFormat() = default;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Append the class info to the provided |out| string. The appended
|
48
|
+
* data must be a valid JSON object. Strings must be properly quoted, and
|
49
|
+
* escaped. There is no processing applied to the content after it is
|
50
|
+
* appended.
|
51
|
+
*/
|
52
|
+
virtual void AppendAsTraceFormat(std::string* out) const = 0;
|
53
|
+
};
|
54
|
+
|
55
|
+
/**
|
56
|
+
* V8 Tracing controller.
|
57
|
+
*
|
58
|
+
* Can be implemented by an embedder to record trace events from V8.
|
59
|
+
*/
|
60
|
+
class TracingController {
|
61
|
+
public:
|
62
|
+
virtual ~TracingController() = default;
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Called by TRACE_EVENT* macros, don't call this directly.
|
66
|
+
* The name parameter is a category group for example:
|
67
|
+
* TRACE_EVENT0("v8,parse", "V8.Parse")
|
68
|
+
* The pointer returned points to a value with zero or more of the bits
|
69
|
+
* defined in CategoryGroupEnabledFlags.
|
70
|
+
**/
|
71
|
+
virtual const uint8_t* GetCategoryGroupEnabled(const char* name) {
|
72
|
+
static uint8_t no = 0;
|
73
|
+
return &no;
|
74
|
+
}
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Adds a trace event to the platform tracing system. This function call is
|
78
|
+
* usually the result of a TRACE_* macro from trace_event_common.h when
|
79
|
+
* tracing and the category of the particular trace are enabled. It is not
|
80
|
+
* advisable to call this function on its own; it is really only meant to be
|
81
|
+
* used by the trace macros. The returned handle can be used by
|
82
|
+
* UpdateTraceEventDuration to update the duration of COMPLETE events.
|
83
|
+
*/
|
84
|
+
virtual uint64_t AddTraceEvent(
|
85
|
+
char phase, const uint8_t* category_enabled_flag, const char* name,
|
86
|
+
const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
|
87
|
+
const char** arg_names, const uint8_t* arg_types,
|
88
|
+
const uint64_t* arg_values,
|
89
|
+
std::unique_ptr<ConvertableToTraceFormat>* arg_convertables,
|
90
|
+
unsigned int flags) {
|
91
|
+
return 0;
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Sets the duration field of a COMPLETE trace event. It must be called with
|
96
|
+
* the handle returned from AddTraceEvent().
|
97
|
+
**/
|
98
|
+
virtual void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
|
99
|
+
const char* name, uint64_t handle) {}
|
100
|
+
|
101
|
+
class TraceStateObserver {
|
102
|
+
public:
|
103
|
+
virtual ~TraceStateObserver() = default;
|
104
|
+
virtual void OnTraceEnabled() = 0;
|
105
|
+
virtual void OnTraceDisabled() = 0;
|
106
|
+
};
|
107
|
+
|
108
|
+
/** Adds tracing state change observer. */
|
109
|
+
virtual void AddTraceStateObserver(TraceStateObserver*) {}
|
110
|
+
|
111
|
+
/** Removes tracing state change observer. */
|
112
|
+
virtual void RemoveTraceStateObserver(TraceStateObserver*) {}
|
113
|
+
};
|
114
|
+
|
115
|
+
/**
|
116
|
+
* V8 Platform abstraction layer.
|
117
|
+
*
|
118
|
+
* The embedder has to provide an implementation of this interface before
|
119
|
+
* initializing the rest of V8.
|
120
|
+
*/
|
121
|
+
class Platform {
|
122
|
+
public:
|
123
|
+
/**
|
124
|
+
* This enum is used to indicate whether a task is potentially long running,
|
125
|
+
* or causes a long wait. The embedder might want to use this hint to decide
|
126
|
+
* whether to execute the task on a dedicated thread.
|
127
|
+
*/
|
128
|
+
enum ExpectedRuntime {
|
129
|
+
kShortRunningTask,
|
130
|
+
kLongRunningTask
|
131
|
+
};
|
132
|
+
|
133
|
+
virtual ~Platform() = default;
|
134
|
+
|
135
|
+
/**
|
136
|
+
* Enables the embedder to respond in cases where V8 can't allocate large
|
137
|
+
* blocks of memory. V8 retries the failed allocation once after calling this
|
138
|
+
* method. On success, execution continues; otherwise V8 exits with a fatal
|
139
|
+
* error.
|
140
|
+
* Embedder overrides of this function must NOT call back into V8.
|
141
|
+
*/
|
142
|
+
virtual void OnCriticalMemoryPressure() {}
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Gets the number of threads that are used to execute background tasks. Is
|
146
|
+
* used to estimate the number of tasks a work package should be split into.
|
147
|
+
* A return value of 0 means that there are no background threads available.
|
148
|
+
* Note that a value of 0 won't prohibit V8 from posting tasks using
|
149
|
+
* |CallOnBackgroundThread|.
|
150
|
+
*/
|
151
|
+
virtual size_t NumberOfAvailableBackgroundThreads() { return 0; }
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Schedules a task to be invoked on a background thread. |expected_runtime|
|
155
|
+
* indicates that the task will run a long time. The Platform implementation
|
156
|
+
* takes ownership of |task|. There is no guarantee about order of execution
|
157
|
+
* of tasks wrt order of scheduling, nor is there a guarantee about the
|
158
|
+
* thread the task will be run on.
|
159
|
+
*/
|
160
|
+
virtual void CallOnBackgroundThread(Task* task,
|
161
|
+
ExpectedRuntime expected_runtime) = 0;
|
162
|
+
|
163
|
+
/**
|
164
|
+
* Schedules a task to be invoked on a foreground thread wrt a specific
|
165
|
+
* |isolate|. Tasks posted for the same isolate should be execute in order of
|
166
|
+
* scheduling. The definition of "foreground" is opaque to V8.
|
167
|
+
*/
|
168
|
+
virtual void CallOnForegroundThread(Isolate* isolate, Task* task) = 0;
|
169
|
+
|
170
|
+
/**
|
171
|
+
* Schedules a task to be invoked on a foreground thread wrt a specific
|
172
|
+
* |isolate| after the given number of seconds |delay_in_seconds|.
|
173
|
+
* Tasks posted for the same isolate should be execute in order of
|
174
|
+
* scheduling. The definition of "foreground" is opaque to V8.
|
175
|
+
*/
|
176
|
+
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
177
|
+
double delay_in_seconds) = 0;
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Schedules a task to be invoked on a foreground thread wrt a specific
|
181
|
+
* |isolate| when the embedder is idle.
|
182
|
+
* Requires that SupportsIdleTasks(isolate) is true.
|
183
|
+
* Idle tasks may be reordered relative to other task types and may be
|
184
|
+
* starved for an arbitrarily long time if no idle time is available.
|
185
|
+
* The definition of "foreground" is opaque to V8.
|
186
|
+
*/
|
187
|
+
virtual void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) {
|
188
|
+
// TODO(ulan): Make this function abstract after V8 roll in Chromium.
|
189
|
+
}
|
190
|
+
|
191
|
+
/**
|
192
|
+
* Returns true if idle tasks are enabled for the given |isolate|.
|
193
|
+
*/
|
194
|
+
virtual bool IdleTasksEnabled(Isolate* isolate) {
|
195
|
+
// TODO(ulan): Make this function abstract after V8 roll in Chromium.
|
196
|
+
return false;
|
197
|
+
}
|
198
|
+
|
199
|
+
/**
|
200
|
+
* Monotonically increasing time in seconds from an arbitrary fixed point in
|
201
|
+
* the past. This function is expected to return at least
|
202
|
+
* millisecond-precision values. For this reason,
|
203
|
+
* it is recommended that the fixed point be no further in the past than
|
204
|
+
* the epoch.
|
205
|
+
**/
|
206
|
+
virtual double MonotonicallyIncreasingTime() = 0;
|
207
|
+
|
208
|
+
/**
|
209
|
+
* Current wall-clock time in milliseconds since epoch.
|
210
|
+
* This function is expected to return at least millisecond-precision values.
|
211
|
+
*/
|
212
|
+
virtual double CurrentClockTimeMillis() {
|
213
|
+
// TODO(dats): Make pure virtual after V8 roll in Chromium.
|
214
|
+
return 0.0;
|
215
|
+
}
|
216
|
+
|
217
|
+
typedef void (*StackTracePrinter)();
|
218
|
+
|
219
|
+
/**
|
220
|
+
* Returns a function pointer that print a stack trace of the current stack
|
221
|
+
* on invocation. Disables printing of the stack trace if nullptr.
|
222
|
+
*/
|
223
|
+
virtual StackTracePrinter GetStackTracePrinter() { return nullptr; }
|
224
|
+
|
225
|
+
/**
|
226
|
+
* Returns an instance of a v8::TracingController. This must be non-nullptr.
|
227
|
+
*/
|
228
|
+
virtual TracingController* GetTracingController() = 0;
|
229
|
+
|
230
|
+
protected:
|
231
|
+
/**
|
232
|
+
* Default implementation of current wall-clock time in milliseconds
|
233
|
+
* since epoch. Useful for implementing |CurrentClockTimeMillis| if
|
234
|
+
* nothing special needed.
|
235
|
+
*/
|
236
|
+
static double SystemClockTimeMillis();
|
237
|
+
};
|
238
|
+
|
239
|
+
} // namespace v8
|
240
|
+
|
241
|
+
#endif // V8_V8_PLATFORM_H_
|