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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 Google Inc. All rights reserved. 2 * Copyright (c) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 24 matching lines...) Expand all
35 #include "bindings/core/v8/ScriptController.h" 35 #include "bindings/core/v8/ScriptController.h"
36 #include "bindings/core/v8/V8Window.h" 36 #include "bindings/core/v8/V8Window.h"
37 #include "core/dom/ExecutionContext.h" 37 #include "core/dom/ExecutionContext.h"
38 #include "core/frame/FrameConsole.h" 38 #include "core/frame/FrameConsole.h"
39 #include "core/frame/LocalDOMWindow.h" 39 #include "core/frame/LocalDOMWindow.h"
40 #include "core/frame/LocalFrame.h" 40 #include "core/frame/LocalFrame.h"
41 #include "core/frame/UseCounter.h" 41 #include "core/frame/UseCounter.h"
42 #include "core/inspector/IdentifiersFactory.h" 42 #include "core/inspector/IdentifiersFactory.h"
43 #include "core/inspector/InspectedFrames.h" 43 #include "core/inspector/InspectedFrames.h"
44 #include "core/inspector/InspectorTaskRunner.h" 44 #include "core/inspector/InspectorTaskRunner.h"
45 #include "core/timing/MemoryInfo.h"
45 #include "core/workers/MainThreadWorkletGlobalScope.h" 46 #include "core/workers/MainThreadWorkletGlobalScope.h"
46 #include "platform/UserGestureIndicator.h" 47 #include "platform/UserGestureIndicator.h"
47 #include "platform/v8_inspector/public/V8Debugger.h" 48 #include "platform/v8_inspector/public/V8Debugger.h"
48 #include "public/platform/Platform.h" 49 #include "public/platform/Platform.h"
49 #include "wtf/OwnPtr.h" 50 #include "wtf/OwnPtr.h"
50 #include "wtf/PassOwnPtr.h" 51 #include "wtf/PassOwnPtr.h"
51 #include "wtf/ThreadingPrimitives.h" 52 #include "wtf/ThreadingPrimitives.h"
52 53
53 namespace blink { 54 namespace blink {
54 55
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 187
187 if (executionContext->isWorkletGlobalScope()) { 188 if (executionContext->isWorkletGlobalScope()) {
188 MainThreadWorkletGlobalScope* globalScope = toMainThreadWorkletGlobalSco pe(executionContext); 189 MainThreadWorkletGlobalScope* globalScope = toMainThreadWorkletGlobalSco pe(executionContext);
189 return globalScope && BindingSecurity::shouldAllowAccessTo(m_isolate, to LocalDOMWindow(toDOMWindow(calling)), globalScope, DoNotReportSecurityError); 190 return globalScope && BindingSecurity::shouldAllowAccessTo(m_isolate, to LocalDOMWindow(toDOMWindow(calling)), globalScope, DoNotReportSecurityError);
190 } 191 }
191 192
192 DOMWindow* window = toDOMWindow(target); 193 DOMWindow* window = toDOMWindow(target);
193 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW indow(toDOMWindow(calling)), window, DoNotReportSecurityError); 194 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW indow(toDOMWindow(calling)), window, DoNotReportSecurityError);
194 } 195 }
195 196
197 void MainThreadDebugger::reportMessageToConsole(v8::Local<v8::Context> context, ConsoleMessage* consoleMessage)
198 {
199 ExecutionContext* executionContext = toExecutionContext(context);
200 ASSERT(executionContext);
201 if (executionContext->isWorkletGlobalScope()) {
202 executionContext->addConsoleMessage(consoleMessage);
203 return;
204 }
205
206 DOMWindow* window = toDOMWindow(context);
207 if (!window)
208 return;
209 LocalDOMWindow* localDomWindow = toLocalDOMWindow(window);
210 if (!localDomWindow)
211 return;
212 LocalFrame* frame = localDomWindow->frame();
213 if (!frame)
214 return;
215 frame->console().addMessage(consoleMessage);
216 }
217
218 bool MainThreadDebugger::hasMemoryOnConsole(v8::Local<v8::Context> context)
219 {
220 ExecutionContext* executionContext = toExecutionContext(context);
221 ASSERT(executionContext);
222 return executionContext->isDocument();
223 }
224
225 v8::MaybeLocal<v8::Value> MainThreadDebugger::memoryInfo(v8::Isolate* isolate, v 8::Local<v8::Context> context, v8::Local<v8::Object> creationContext)
226 {
227 return hasMemoryOnConsole(context) ? toV8(MemoryInfo::create(), creationCont ext, isolate) : v8::MaybeLocal<v8::Value>();
228 }
229
196 } // namespace blink 230 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698