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

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

Issue 1859293002: [DevTools] Move Console to v8_inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/MainThreadDebugger.cpp
diff --git a/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp b/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp
index c678024f937f1386e4cad445083542b8df493987..1d9f8b18f9f372d7e6132c18dda03a452a9e589b 100644
--- a/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp
+++ b/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp
@@ -42,6 +42,7 @@
#include "core/inspector/IdentifiersFactory.h"
#include "core/inspector/InspectedFrames.h"
#include "core/inspector/InspectorTaskRunner.h"
+#include "core/timing/MemoryInfo.h"
#include "core/workers/MainThreadWorkletGlobalScope.h"
#include "platform/UserGestureIndicator.h"
#include "platform/v8_inspector/public/V8Debugger.h"
@@ -193,4 +194,37 @@ bool MainThreadDebugger::callingContextCanAccessContext(v8::Local<v8::Context> c
return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMWindow(toDOMWindow(calling)), window, DoNotReportSecurityError);
}
+void MainThreadDebugger::reportMessageToConsole(v8::Local<v8::Context> context, ConsoleMessage* consoleMessage)
+{
+ ExecutionContext* executionContext = toExecutionContext(context);
+ ASSERT(executionContext);
+ if (executionContext->isWorkletGlobalScope()) {
+ executionContext->addConsoleMessage(consoleMessage);
+ return;
+ }
+
+ DOMWindow* window = toDOMWindow(context);
+ if (!window)
+ return;
+ LocalDOMWindow* localDomWindow = toLocalDOMWindow(window);
+ if (!localDomWindow)
+ return;
+ LocalFrame* frame = localDomWindow->frame();
+ if (!frame)
+ return;
+ frame->console().addMessage(consoleMessage);
+}
+
+bool MainThreadDebugger::hasMemoryOnConsole(v8::Local<v8::Context> context)
+{
+ ExecutionContext* executionContext = toExecutionContext(context);
+ ASSERT(executionContext);
+ return executionContext->isDocument();
+}
+
+v8::MaybeLocal<v8::Value> MainThreadDebugger::memoryInfo(v8::Isolate* isolate, v8::Local<v8::Context> context, v8::Local<v8::Object> creationContext)
+{
+ return hasMemoryOnConsole(context) ? toV8(MemoryInfo::create(), creationContext, isolate) : v8::MaybeLocal<v8::Value>();
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698