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 |