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

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: added missing tests 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 m_clientMessageLoop = clientMessageLoop; 97 m_clientMessageLoop = clientMessageLoop;
97 } 98 }
98 99
99 void MainThreadDebugger::contextCreated(ScriptState* scriptState, LocalFrame* fr ame, SecurityOrigin* origin) 100 void MainThreadDebugger::contextCreated(ScriptState* scriptState, LocalFrame* fr ame, SecurityOrigin* origin)
100 { 101 {
101 ASSERT(isMainThread()); 102 ASSERT(isMainThread());
102 v8::HandleScope handles(scriptState->isolate()); 103 v8::HandleScope handles(scriptState->isolate());
103 DOMWrapperWorld& world = scriptState->world(); 104 DOMWrapperWorld& world = scriptState->world();
104 if (frame->localFrameRoot() == frame && world.isMainWorld()) 105 if (frame->localFrameRoot() == frame && world.isMainWorld())
105 debugger()->resetContextGroup(contextGroupId(frame)); 106 debugger()->resetContextGroup(contextGroupId(frame));
106 debugger()->contextCreated(V8ContextInfo(scriptState->context(), contextGrou pId(frame), world.isMainWorld(), origin ? origin->toRawString() : "", world.isIs olatedWorld() ? world.isolatedWorldHumanReadableName() : "", IdentifiersFactory: :frameId(frame))); 107 ExecutionContext* executionContext = scriptState->getExecutionContext();
108 debugger()->contextCreated(V8ContextInfo(scriptState->context(), contextGrou pId(frame), world.isMainWorld(), origin ? origin->toRawString() : "", world.isIs olatedWorld() ? world.isolatedWorldHumanReadableName() : "", IdentifiersFactory: :frameId(frame), executionContext->isDocument()));
dgozman 2016/04/12 03:32:15 Inline it!
kozy 2016/04/12 21:58:31 Done.
107 } 109 }
108 110
109 void MainThreadDebugger::contextWillBeDestroyed(ScriptState* scriptState) 111 void MainThreadDebugger::contextWillBeDestroyed(ScriptState* scriptState)
110 { 112 {
111 v8::HandleScope handles(scriptState->isolate()); 113 v8::HandleScope handles(scriptState->isolate());
112 debugger()->contextDestroyed(scriptState->context()); 114 debugger()->contextDestroyed(scriptState->context());
113 } 115 }
114 116
115 int MainThreadDebugger::contextGroupId(LocalFrame* frame) 117 int MainThreadDebugger::contextGroupId(LocalFrame* frame)
116 { 118 {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); 199 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
198 if (!frame) 200 if (!frame)
199 return 0; 201 return 0;
200 ScriptState* scriptState = ScriptState::forMainWorld(frame); 202 ScriptState* scriptState = ScriptState::forMainWorld(frame);
201 if (!scriptState) 203 if (!scriptState)
202 return 0; 204 return 0;
203 v8::HandleScope scopes(scriptState->isolate()); 205 v8::HandleScope scopes(scriptState->isolate());
204 return V8Debugger::contextId(scriptState->context()); 206 return V8Debugger::contextId(scriptState->context());
205 } 207 }
206 208
209 void MainThreadDebugger::reportMessageToConsole(v8::Local<v8::Context> context, ConsoleMessage* consoleMessage)
210 {
211 ExecutionContext* executionContext = toExecutionContext(context);
212 ASSERT(executionContext);
213 if (executionContext->isWorkletGlobalScope()) {
214 executionContext->addConsoleMessage(consoleMessage);
215 return;
216 }
217
218 DOMWindow* window = toDOMWindow(context);
219 if (!window)
220 return;
221 LocalDOMWindow* localDomWindow = toLocalDOMWindow(window);
222 if (!localDomWindow)
223 return;
224 LocalFrame* frame = localDomWindow->frame();
225 if (!frame)
226 return;
227 frame->console().addMessage(consoleMessage);
228 }
229
230 v8::MaybeLocal<v8::Value> MainThreadDebugger::memoryInfo(v8::Isolate* isolate, v 8::Local<v8::Context> context, v8::Local<v8::Object> creationContext)
231 {
232 ExecutionContext* executionContext = toExecutionContext(context);
233 ASSERT(executionContext);
234 return executionContext->isDocument() ? toV8(MemoryInfo::create(), creationC ontext, isolate) : v8::MaybeLocal<v8::Value>();
dgozman 2016/04/12 03:32:15 ASSERT(executionContext->isDocument())
kozy 2016/04/12 21:58:32 Done.
235 }
236
207 } // namespace blink 237 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698