Index: src/inspector/v8-console.cc |
diff --git a/src/inspector/v8-console.cc b/src/inspector/v8-console.cc |
index 69e58dfabd03fd64fb8d4bd741bee9e62c36e5ab..358b45358519a2268bd1c0f16b567516f80825eb 100644 |
--- a/src/inspector/v8-console.cc |
+++ b/src/inspector/v8-console.cc |
@@ -25,11 +25,11 @@ namespace { |
class ConsoleHelper { |
public: |
- explicit ConsoleHelper(const v8::FunctionCallbackInfo<v8::Value>& info, |
- V8InspectorImpl* inspector) |
+ ConsoleHelper(const v8::debug::ConsoleCallArguments& info, |
+ V8InspectorImpl* inspector) |
: m_info(info), |
- m_isolate(info.GetIsolate()), |
- m_context(info.GetIsolate()->GetCurrentContext()), |
+ m_isolate(inspector->isolate()), |
+ m_context(m_isolate->GetCurrentContext()), |
m_inspector(inspector), |
m_contextId(InspectedContext::contextId(m_context)), |
m_groupId(m_inspector->contextGroupId(m_contextId)) {} |
@@ -145,7 +145,7 @@ class ConsoleHelper { |
} |
private: |
- const v8::FunctionCallbackInfo<v8::Value>& m_info; |
+ const v8::debug::ConsoleCallArguments& m_info; |
v8::Isolate* m_isolate; |
v8::Local<v8::Context> m_context; |
V8InspectorImpl* m_inspector = nullptr; |
@@ -190,66 +190,63 @@ void createBoundFunctionProperty(v8::Local<v8::Context> context, |
V8Console::V8Console(V8InspectorImpl* inspector) : m_inspector(inspector) {} |
-void V8Console::debugCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Debug(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector).reportCall(ConsoleAPIType::kDebug); |
} |
-void V8Console::errorCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Error(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector).reportCall(ConsoleAPIType::kError); |
} |
-void V8Console::infoCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Info(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector).reportCall(ConsoleAPIType::kInfo); |
} |
-void V8Console::logCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Log(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector).reportCall(ConsoleAPIType::kLog); |
} |
-void V8Console::warnCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Warn(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector).reportCall(ConsoleAPIType::kWarning); |
} |
-void V8Console::dirCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Dir(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector).reportCall(ConsoleAPIType::kDir); |
} |
-void V8Console::dirxmlCallback( |
- const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::DirXml(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector).reportCall(ConsoleAPIType::kDirXML); |
} |
-void V8Console::tableCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Table(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector).reportCall(ConsoleAPIType::kTable); |
} |
-void V8Console::traceCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Trace(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector) |
.reportCallWithDefaultArgument(ConsoleAPIType::kTrace, |
String16("console.trace")); |
} |
-void V8Console::groupCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Group(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector) |
.reportCallWithDefaultArgument(ConsoleAPIType::kStartGroup, |
String16("console.group")); |
} |
-void V8Console::groupCollapsedCallback( |
- const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::GroupCollapsed(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector) |
.reportCallWithDefaultArgument(ConsoleAPIType::kStartGroupCollapsed, |
String16("console.groupCollapsed")); |
} |
-void V8Console::groupEndCallback( |
- const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::GroupEnd(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector) |
.reportCallWithDefaultArgument(ConsoleAPIType::kEndGroup, |
String16("console.groupEnd")); |
} |
-void V8Console::clearCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Clear(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper helper(info, m_inspector); |
if (!helper.groupId()) return; |
m_inspector->client()->consoleClear(helper.groupId()); |
@@ -257,7 +254,7 @@ void V8Console::clearCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
String16("console.clear")); |
} |
-void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Count(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper helper(info, m_inspector); |
String16 title = helper.firstArgToString(String16()); |
String16 identifier; |
@@ -280,8 +277,7 @@ void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
title.isEmpty() ? countString : (title + ": " + countString)); |
} |
-void V8Console::assertCallback( |
- const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Assert(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper helper(info, m_inspector); |
if (helper.firstArgToBoolean(false)) return; |
@@ -289,7 +285,7 @@ void V8Console::assertCallback( |
for (int i = 1; i < info.Length(); ++i) arguments.push_back(info[i]); |
if (info.Length() < 2) |
arguments.push_back( |
- toV8String(info.GetIsolate(), String16("console.assert"))); |
+ toV8String(m_inspector->isolate(), String16("console.assert"))); |
helper.reportCall(ConsoleAPIType::kAssert, arguments); |
if (V8DebuggerAgentImpl* debuggerAgent = helper.debuggerAgent()) |
@@ -297,31 +293,28 @@ void V8Console::assertCallback( |
protocol::Debugger::Paused::ReasonEnum::Assert, nullptr); |
} |
-void V8Console::markTimelineCallback( |
- const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::MarkTimeline(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector) |
.reportDeprecatedCall("V8Console#markTimelineDeprecated", |
"'console.markTimeline' is " |
"deprecated. Please use " |
"'console.timeStamp' instead."); |
- timeStampCallback(info); |
+ TimeStamp(info); |
} |
-void V8Console::profileCallback( |
- const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Profile(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper helper(info, m_inspector); |
if (V8ProfilerAgentImpl* profilerAgent = helper.profilerAgent()) |
profilerAgent->consoleProfile(helper.firstArgToString(String16())); |
} |
-void V8Console::profileEndCallback( |
- const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::ProfileEnd(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper helper(info, m_inspector); |
if (V8ProfilerAgentImpl* profilerAgent = helper.profilerAgent()) |
profilerAgent->consoleProfileEnd(helper.firstArgToString(String16())); |
} |
-static void timeFunction(const v8::FunctionCallbackInfo<v8::Value>& info, |
+static void timeFunction(const v8::debug::ConsoleCallArguments& info, |
bool timelinePrefix, V8InspectorImpl* inspector) { |
ConsoleHelper helper(info, inspector); |
String16 protocolTitle = helper.firstArgToString("default"); |
@@ -330,7 +323,7 @@ static void timeFunction(const v8::FunctionCallbackInfo<v8::Value>& info, |
helper.consoleMessageStorage()->time(helper.contextId(), protocolTitle); |
} |
-static void timeEndFunction(const v8::FunctionCallbackInfo<v8::Value>& info, |
+static void timeEndFunction(const v8::debug::ConsoleCallArguments& info, |
bool timelinePrefix, V8InspectorImpl* inspector) { |
ConsoleHelper helper(info, inspector); |
String16 protocolTitle = helper.firstArgToString("default"); |
@@ -343,8 +336,7 @@ static void timeEndFunction(const v8::FunctionCallbackInfo<v8::Value>& info, |
helper.reportCallWithArgument(ConsoleAPIType::kTimeEnd, message); |
} |
-void V8Console::timelineCallback( |
- const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Timeline(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector) |
.reportDeprecatedCall("V8Console#timeline", |
"'console.timeline' is deprecated. Please use " |
@@ -352,8 +344,7 @@ void V8Console::timelineCallback( |
timeFunction(info, true, m_inspector); |
} |
-void V8Console::timelineEndCallback( |
- const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::TimelineEnd(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper(info, m_inspector) |
.reportDeprecatedCall("V8Console#timelineEnd", |
"'console.timelineEnd' is " |
@@ -362,17 +353,15 @@ void V8Console::timelineEndCallback( |
timeEndFunction(info, true, m_inspector); |
} |
-void V8Console::timeCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::Time(const v8::debug::ConsoleCallArguments& info) { |
timeFunction(info, false, m_inspector); |
} |
-void V8Console::timeEndCallback( |
- const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::TimeEnd(const v8::debug::ConsoleCallArguments& info) { |
timeEndFunction(info, false, m_inspector); |
} |
-void V8Console::timeStampCallback( |
- const v8::FunctionCallbackInfo<v8::Value>& info) { |
+void V8Console::TimeStamp(const v8::debug::ConsoleCallArguments& info) { |
ConsoleHelper helper(info, m_inspector); |
String16 title = helper.firstArgToString(String16()); |
m_inspector->client()->consoleTimeStamp(toStringView(title)); |
@@ -400,7 +389,8 @@ void V8Console::keysCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
v8::Isolate* isolate = info.GetIsolate(); |
info.GetReturnValue().Set(v8::Array::New(isolate)); |
- ConsoleHelper helper(info, m_inspector); |
+ v8::debug::ConsoleCallArguments args(info); |
+ ConsoleHelper helper(args, m_inspector); |
v8::Local<v8::Object> obj; |
if (!helper.firstArgAsObject().ToLocal(&obj)) return; |
v8::Local<v8::Array> names; |
@@ -414,7 +404,8 @@ void V8Console::valuesCallback( |
v8::Isolate* isolate = info.GetIsolate(); |
info.GetReturnValue().Set(v8::Array::New(isolate)); |
- ConsoleHelper helper(info, m_inspector); |
+ v8::debug::ConsoleCallArguments args(info); |
+ ConsoleHelper helper(args, m_inspector); |
v8::Local<v8::Object> obj; |
if (!helper.firstArgAsObject().ToLocal(&obj)) return; |
v8::Local<v8::Array> names; |
@@ -453,7 +444,8 @@ static void setFunctionBreakpoint(ConsoleHelper& helper, |
void V8Console::debugFunctionCallback( |
const v8::FunctionCallbackInfo<v8::Value>& info) { |
- ConsoleHelper helper(info, m_inspector); |
+ v8::debug::ConsoleCallArguments args(info); |
+ ConsoleHelper helper(args, m_inspector); |
v8::Local<v8::Function> function; |
if (!helper.firstArgAsFunction().ToLocal(&function)) return; |
setFunctionBreakpoint(helper, function, |
@@ -463,7 +455,8 @@ void V8Console::debugFunctionCallback( |
void V8Console::undebugFunctionCallback( |
const v8::FunctionCallbackInfo<v8::Value>& info) { |
- ConsoleHelper helper(info, m_inspector); |
+ v8::debug::ConsoleCallArguments args(info); |
+ ConsoleHelper helper(args, m_inspector); |
v8::Local<v8::Function> function; |
if (!helper.firstArgAsFunction().ToLocal(&function)) return; |
setFunctionBreakpoint(helper, function, |
@@ -473,7 +466,8 @@ void V8Console::undebugFunctionCallback( |
void V8Console::monitorFunctionCallback( |
const v8::FunctionCallbackInfo<v8::Value>& info) { |
- ConsoleHelper helper(info, m_inspector); |
+ v8::debug::ConsoleCallArguments args(info); |
+ ConsoleHelper helper(args, m_inspector); |
v8::Local<v8::Function> function; |
if (!helper.firstArgAsFunction().ToLocal(&function)) return; |
v8::Local<v8::Value> name = function->GetName(); |
@@ -496,7 +490,8 @@ void V8Console::monitorFunctionCallback( |
void V8Console::unmonitorFunctionCallback( |
const v8::FunctionCallbackInfo<v8::Value>& info) { |
- ConsoleHelper helper(info, m_inspector); |
+ v8::debug::ConsoleCallArguments args(info); |
+ ConsoleHelper helper(args, m_inspector); |
v8::Local<v8::Function> function; |
if (!helper.firstArgAsFunction().ToLocal(&function)) return; |
setFunctionBreakpoint(helper, function, |
@@ -506,7 +501,8 @@ void V8Console::unmonitorFunctionCallback( |
void V8Console::lastEvaluationResultCallback( |
const v8::FunctionCallbackInfo<v8::Value>& info) { |
- ConsoleHelper helper(info, m_inspector); |
+ v8::debug::ConsoleCallArguments args(info); |
+ ConsoleHelper helper(args, m_inspector); |
InjectedScript* injectedScript = helper.injectedScript(); |
if (!injectedScript) return; |
info.GetReturnValue().Set(injectedScript->lastEvaluationResult()); |
@@ -517,7 +513,8 @@ static void inspectImpl(const v8::FunctionCallbackInfo<v8::Value>& info, |
if (info.Length() < 1) return; |
if (!copyToClipboard) info.GetReturnValue().Set(info[0]); |
- ConsoleHelper helper(info, inspector); |
+ v8::debug::ConsoleCallArguments args(info); |
+ ConsoleHelper helper(args, inspector); |
InjectedScript* injectedScript = helper.injectedScript(); |
if (!injectedScript) return; |
std::unique_ptr<protocol::Runtime::RemoteObject> wrappedObject; |
@@ -547,7 +544,8 @@ void V8Console::copyCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
void V8Console::inspectedObject(const v8::FunctionCallbackInfo<v8::Value>& info, |
unsigned num) { |
DCHECK(num < V8InspectorSessionImpl::kInspectedObjectBufferSize); |
- ConsoleHelper helper(info, m_inspector); |
+ v8::debug::ConsoleCallArguments args(info); |
+ ConsoleHelper helper(args, m_inspector); |
if (V8InspectorSessionImpl* session = helper.currentSession()) { |
V8InspectorSession::Inspectable* object = session->inspectedObject(num); |
v8::Isolate* isolate = info.GetIsolate(); |
@@ -558,71 +556,6 @@ void V8Console::inspectedObject(const v8::FunctionCallbackInfo<v8::Value>& info, |
} |
} |
-v8::Local<v8::Object> V8Console::createConsole(v8::Local<v8::Context> context) { |
- v8::Context::Scope contextScope(context); |
- v8::Isolate* isolate = context->GetIsolate(); |
- v8::MicrotasksScope microtasksScope(isolate, |
- v8::MicrotasksScope::kDoNotRunMicrotasks); |
- |
- v8::Local<v8::Object> console = v8::Object::New(isolate); |
- bool success = |
- console->SetPrototype(context, v8::Object::New(isolate)).FromMaybe(false); |
- DCHECK(success); |
- USE(success); |
- |
- v8::Local<v8::External> data = v8::External::New(isolate, this); |
- createBoundFunctionProperty(context, console, data, "debug", |
- &V8Console::call<&V8Console::debugCallback>); |
- createBoundFunctionProperty(context, console, data, "error", |
- &V8Console::call<&V8Console::errorCallback>); |
- createBoundFunctionProperty(context, console, data, "info", |
- &V8Console::call<&V8Console::infoCallback>); |
- createBoundFunctionProperty(context, console, data, "log", |
- &V8Console::call<&V8Console::logCallback>); |
- createBoundFunctionProperty(context, console, data, "warn", |
- &V8Console::call<&V8Console::warnCallback>); |
- createBoundFunctionProperty(context, console, data, "dir", |
- &V8Console::call<&V8Console::dirCallback>); |
- createBoundFunctionProperty(context, console, data, "dirxml", |
- &V8Console::call<&V8Console::dirxmlCallback>); |
- createBoundFunctionProperty(context, console, data, "table", |
- &V8Console::call<&V8Console::tableCallback>); |
- createBoundFunctionProperty(context, console, data, "trace", |
- &V8Console::call<&V8Console::traceCallback>); |
- createBoundFunctionProperty(context, console, data, "group", |
- &V8Console::call<&V8Console::groupCallback>); |
- createBoundFunctionProperty( |
- context, console, data, "groupCollapsed", |
- &V8Console::call<&V8Console::groupCollapsedCallback>); |
- createBoundFunctionProperty(context, console, data, "groupEnd", |
- &V8Console::call<&V8Console::groupEndCallback>); |
- createBoundFunctionProperty(context, console, data, "clear", |
- &V8Console::call<&V8Console::clearCallback>); |
- createBoundFunctionProperty(context, console, data, "count", |
- &V8Console::call<&V8Console::countCallback>); |
- createBoundFunctionProperty(context, console, data, "assert", |
- &V8Console::call<&V8Console::assertCallback>); |
- createBoundFunctionProperty( |
- context, console, data, "markTimeline", |
- &V8Console::call<&V8Console::markTimelineCallback>); |
- createBoundFunctionProperty(context, console, data, "profile", |
- &V8Console::call<&V8Console::profileCallback>); |
- createBoundFunctionProperty(context, console, data, "profileEnd", |
- &V8Console::call<&V8Console::profileEndCallback>); |
- createBoundFunctionProperty(context, console, data, "timeline", |
- &V8Console::call<&V8Console::timelineCallback>); |
- createBoundFunctionProperty( |
- context, console, data, "timelineEnd", |
- &V8Console::call<&V8Console::timelineEndCallback>); |
- createBoundFunctionProperty(context, console, data, "time", |
- &V8Console::call<&V8Console::timeCallback>); |
- createBoundFunctionProperty(context, console, data, "timeEnd", |
- &V8Console::call<&V8Console::timeEndCallback>); |
- createBoundFunctionProperty(context, console, data, "timeStamp", |
- &V8Console::call<&V8Console::timeStampCallback>); |
- return console; |
-} |
- |
void V8Console::installMemoryGetter(v8::Local<v8::Context> context, |
v8::Local<v8::Object> console) { |
v8::Isolate* isolate = context->GetIsolate(); |
@@ -654,24 +587,24 @@ v8::Local<v8::Object> V8Console::createCommandLineAPI( |
v8::Local<v8::External> data = v8::External::New(isolate, this); |
createBoundFunctionProperty(context, commandLineAPI, data, "dir", |
- &V8Console::call<&V8Console::dirCallback>, |
+ &V8Console::call<&V8Console::Dir>, |
"function dir(value) { [Command Line API] }"); |
createBoundFunctionProperty(context, commandLineAPI, data, "dirxml", |
- &V8Console::call<&V8Console::dirxmlCallback>, |
+ &V8Console::call<&V8Console::DirXml>, |
"function dirxml(value) { [Command Line API] }"); |
createBoundFunctionProperty(context, commandLineAPI, data, "profile", |
- &V8Console::call<&V8Console::profileCallback>, |
+ &V8Console::call<&V8Console::Profile>, |
"function profile(title) { [Command Line API] }"); |
createBoundFunctionProperty( |
context, commandLineAPI, data, "profileEnd", |
- &V8Console::call<&V8Console::profileEndCallback>, |
+ &V8Console::call<&V8Console::ProfileEnd>, |
"function profileEnd(title) { [Command Line API] }"); |
createBoundFunctionProperty(context, commandLineAPI, data, "clear", |
- &V8Console::call<&V8Console::clearCallback>, |
+ &V8Console::call<&V8Console::Clear>, |
"function clear() { [Command Line API] }"); |
createBoundFunctionProperty( |
context, commandLineAPI, data, "table", |
- &V8Console::call<&V8Console::tableCallback>, |
+ &V8Console::call<&V8Console::Table>, |
"function table(data, [columns]) { [Command Line API] }"); |
createBoundFunctionProperty(context, commandLineAPI, data, "keys", |