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

Unified Diff: third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp

Issue 2035653006: [DevTools] Move Console to v8 inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improved api a bit Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
diff --git a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
index 960006d86c5204983de123686ca098ed3064dc53..f76be3e609b34071a764e1d7556f8de95ecc3009 100644
--- a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
+++ b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
@@ -19,7 +19,6 @@
#include "core/inspector/ConsoleMessage.h"
#include "core/inspector/InspectorDOMDebuggerAgent.h"
#include "core/inspector/InspectorTraceEvents.h"
-#include "core/inspector/ScriptArguments.h"
#include "platform/ScriptForbiddenScope.h"
#include "wtf/CurrentTime.h"
#include "wtf/PtrUtil.h"
@@ -236,17 +235,7 @@ void ThreadDebugger::logCallback(const v8::FunctionCallbackInfo<v8::Value>& info
Event* event = V8Event::toImplWithTypeCheck(info.GetIsolate(), info[0]);
if (!event)
return;
-
- v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
- ScriptState* scriptState = ScriptState::from(context);
- DCHECK(scriptState->contextIsValid());
- Vector<ScriptValue> arguments = Vector<ScriptValue>({
- ScriptValue(scriptState, v8String(info.GetIsolate(), event->type())),
- ScriptValue(scriptState, info[0])
- });
-
- ConsoleMessage* consoleMessage = ConsoleMessage::createForConsoleAPI(LogMessageLevel, LogMessageType, event->type(), ScriptArguments::create(scriptState, arguments));
- debugger->reportMessageToConsole(context, consoleMessage);
+ debugger->debugger()->logToConsole(info.GetIsolate()->GetCurrentContext(), event->type(), v8String(info.GetIsolate(), event->type()), info[0]);
}
v8::Local<v8::Function> ThreadDebugger::eventLogFunction()
@@ -309,7 +298,9 @@ void ThreadDebugger::getEventListenersCallback(const v8::FunctionCallbackInfo<v8
V8EventListenerInfoList listenerInfo;
// eventListeners call can produce message on ErrorEvent during lazy event listener compilation.
debugger->muteWarningsAndDeprecations();
+ debugger->debugger()->muteConsole();
InspectorDOMDebuggerAgent::eventListenersInfoForTarget(isolate, info[0], listenerInfo);
+ debugger->debugger()->unmuteConsole();
debugger->unmuteWarningsAndDeprecations();
v8::Local<v8::Object> result = v8::Object::New(isolate);
@@ -337,19 +328,6 @@ void ThreadDebugger::getEventListenersCallback(const v8::FunctionCallbackInfo<v8
info.GetReturnValue().Set(result);
}
-void ThreadDebugger::reportMessageToConsole(v8::Local<v8::Context> context, MessageType type, MessageLevel level, const String16& message, const v8::FunctionCallbackInfo<v8::Value>* arguments, unsigned skipArgumentCount)
-{
- ScriptState* scriptState = ScriptState::from(context);
- ScriptArguments* scriptArguments = nullptr;
- if (arguments && scriptState->contextIsValid())
- scriptArguments = ScriptArguments::create(scriptState, *arguments, skipArgumentCount);
- String messageText = message;
- if (messageText.isEmpty() && scriptArguments)
- scriptArguments->getFirstArgumentAsString(messageText);
-
- reportMessageToConsole(context, ConsoleMessage::createForConsoleAPI(level, type, messageText, scriptArguments));
-}
-
void ThreadDebugger::consoleTime(const String16& title)
{
TRACE_EVENT_COPY_ASYNC_BEGIN0("blink.console", String(title).utf8().data(), this);

Powered by Google App Engine
This is Rietveld 408576698