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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp

Issue 2035653006: [DevTools] Move Console to v8 inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: all tests pass 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/platform/v8_inspector/V8Console.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
index d10b326d151f67c8b24f229a19c8a2f28911dad6..4c00068bed043f8f364828fe2a7a0564adf8b723 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
@@ -9,6 +9,7 @@
#include "platform/v8_inspector/InjectedScript.h"
#include "platform/v8_inspector/InspectedContext.h"
#include "platform/v8_inspector/V8Compat.h"
+#include "platform/v8_inspector/V8ConsoleMessage.h"
#include "platform/v8_inspector/V8DebuggerAgentImpl.h"
#include "platform/v8_inspector/V8DebuggerImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
@@ -16,8 +17,6 @@
#include "platform/v8_inspector/V8RuntimeAgentImpl.h"
#include "platform/v8_inspector/V8StackTraceImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
-#include "platform/v8_inspector/public/ConsoleAPITypes.h"
-#include "platform/v8_inspector/public/ConsoleTypes.h"
#include "platform/v8_inspector/public/V8DebuggerClient.h"
namespace blink {
@@ -77,26 +76,42 @@ public:
return m_debuggerClient;
}
+ void reportMessageToConsole(v8::Local<v8::Context> context, MessageType type, MessageLevel level, const String16& message, const v8::FunctionCallbackInfo<v8::Value>* arguments, unsigned skipArgumentCount)
+ {
+ InspectedContext* inspectedContext = ensureInspectedContext();
+ if (!inspectedContext)
+ return;
+ V8DebuggerImpl* debugger = inspectedContext->debugger();
+
+ std::unique_ptr<V8ConsoleMessage> consoleMessage = nullptr;
kozy 2016/06/23 22:28:43 Maybe refactoring it? protocol::Vector<v8:
dgozman 2016/06/28 01:43:48 I prefer to pass nullptr when there are not argume
+ if (arguments) {
+ protocol::Vector<v8::Local<v8::Value>> messageArguments;
+ for (int i = skipArgumentCount; i < arguments->Length(); ++i)
+ messageArguments.append((*arguments)[i]);
+ consoleMessage = V8ConsoleMessage::createForConsoleAPI(debugger->client()->currentTimeMS(), type, level, message, &messageArguments, debugger->captureStackTrace(false), inspectedContext);
+ } else {
+ consoleMessage = V8ConsoleMessage::createForConsoleAPI(debugger->client()->currentTimeMS(), type, level, message, nullptr, debugger->captureStackTrace(false), inspectedContext);
+ }
+ debugger->ensureConsoleMessageStorage(inspectedContext->contextGroupId())->addMessage(std::move(consoleMessage));
+ }
+
void addMessage(MessageType type, MessageLevel level, String16 emptyText, int skipArgumentCount)
{
if (emptyText.isEmpty() && !m_info.Length())
return;
- if (V8DebuggerClient* debuggerClient = ensureDebuggerClient())
- debuggerClient->reportMessageToConsole(m_context, type, level, m_info.Length() <= skipArgumentCount ? emptyText : String16(), &m_info, skipArgumentCount);
+ reportMessageToConsole(m_context, type, level, m_info.Length() <= skipArgumentCount ? emptyText : String16(), &m_info, skipArgumentCount);
}
void addMessage(MessageType type, MessageLevel level, const String16& message)
{
- if (V8DebuggerClient* debuggerClient = ensureDebuggerClient())
- debuggerClient->reportMessageToConsole(m_context, type, level, message, nullptr, 0 /* skipArgumentsCount */);
+ reportMessageToConsole(m_context, type, level, message, nullptr, 0 /* skipArgumentsCount */);
}
void addDeprecationMessage(const char* id, const String16& message)
{
if (checkAndSetPrivateFlagOnConsole(id, false))
return;
- if (V8DebuggerClient* debuggerClient = ensureDebuggerClient())
- debuggerClient->reportMessageToConsole(m_context, LogMessageType, WarningMessageLevel, message, nullptr, 0 /* skipArgumentsCount */);
+ reportMessageToConsole(m_context, LogMessageType, WarningMessageLevel, message, nullptr, 0 /* skipArgumentsCount */);
}
bool firstArgToBoolean(bool defaultValue)

Powered by Google App Engine
This is Rietveld 408576698