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

Side by Side Diff: third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp

Issue 1859293002: [DevTools] Move Console to v8_inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/inspector/ThreadDebugger.h" 5 #include "core/inspector/ThreadDebugger.h"
6 6
7 #include "bindings/core/v8/ScriptCallStack.h"
8 #include "bindings/core/v8/ScriptValue.h"
7 #include "bindings/core/v8/V8Binding.h" 9 #include "bindings/core/v8/V8Binding.h"
8 #include "bindings/core/v8/V8DOMException.h" 10 #include "bindings/core/v8/V8DOMException.h"
9 #include "bindings/core/v8/V8DOMTokenList.h" 11 #include "bindings/core/v8/V8DOMTokenList.h"
10 #include "bindings/core/v8/V8HTMLAllCollection.h" 12 #include "bindings/core/v8/V8HTMLAllCollection.h"
11 #include "bindings/core/v8/V8HTMLCollection.h" 13 #include "bindings/core/v8/V8HTMLCollection.h"
12 #include "bindings/core/v8/V8Node.h" 14 #include "bindings/core/v8/V8Node.h"
13 #include "bindings/core/v8/V8NodeList.h" 15 #include "bindings/core/v8/V8NodeList.h"
16 #include "core/inspector/ConsoleMessage.h"
14 #include "core/inspector/InspectorDOMDebuggerAgent.h" 17 #include "core/inspector/InspectorDOMDebuggerAgent.h"
18 #include "core/inspector/InspectorTraceEvents.h"
19 #include "core/inspector/ScriptArguments.h"
15 #include "platform/ScriptForbiddenScope.h" 20 #include "platform/ScriptForbiddenScope.h"
16 #include "wtf/CurrentTime.h" 21 #include "wtf/CurrentTime.h"
17 22
18 namespace blink { 23 namespace blink {
19 24
20 ThreadDebugger::ThreadDebugger(v8::Isolate* isolate) 25 ThreadDebugger::ThreadDebugger(v8::Isolate* isolate)
21 : m_isolate(isolate) 26 : m_isolate(isolate)
22 , m_debugger(V8Debugger::create(isolate, this)) 27 , m_debugger(V8Debugger::create(isolate, this))
23 { 28 {
24 } 29 }
(...skipping 30 matching lines...) Expand all
55 bool ThreadDebugger::isExecutionAllowed() 60 bool ThreadDebugger::isExecutionAllowed()
56 { 61 {
57 return !ScriptForbiddenScope::isScriptForbidden(); 62 return !ScriptForbiddenScope::isScriptForbidden();
58 } 63 }
59 64
60 double ThreadDebugger::currentTimeMS() 65 double ThreadDebugger::currentTimeMS()
61 { 66 {
62 return WTF::currentTimeMS(); 67 return WTF::currentTimeMS();
63 } 68 }
64 69
70 void ThreadDebugger::reportMessageToConsole(v8::Local<v8::Context> context, Mess ageType type, MessageLevel level, const String16& message, const v8::FunctionCal lbackInfo<v8::Value>* arguments, unsigned skipArgumentCount, int maxStackSize)
71 {
72 ScriptState* scriptState = ScriptState::from(context);
73 ScriptArguments* scriptArguments = nullptr;
74 if (arguments && scriptState->contextIsValid())
75 scriptArguments = ScriptArguments::create(scriptState, *arguments, skipA rgumentCount);
76 String messageText = message;
77 if (messageText.isEmpty() && scriptArguments)
78 scriptArguments->getFirstArgumentAsString(messageText);
79
80 ConsoleMessage* consoleMessage = ConsoleMessage::create(ConsoleAPIMessageSou rce, level, messageText);
81 consoleMessage->setType(type);
82 consoleMessage->setScriptState(scriptState);
83 if (arguments)
84 consoleMessage->setScriptArguments(scriptArguments);
85 if (maxStackSize == -1)
86 consoleMessage->setCallStack(ScriptCallStack::captureForConsole());
87 else if (maxStackSize)
88 consoleMessage->setCallStack(ScriptCallStack::capture(maxStackSize));
89 reportMessageToConsole(context, consoleMessage);
90 }
91
92 void ThreadDebugger::consoleTime(const String16& title)
93 {
94 TRACE_EVENT_COPY_ASYNC_BEGIN0("blink.console", String(title).utf8().data(), this);
95 }
96
97 void ThreadDebugger::consoleTimeEnd(const String16& title)
98 {
99 TRACE_EVENT_COPY_ASYNC_END0("blink.console", String(title).utf8().data(), th is);
100 }
101
102 void ThreadDebugger::consoleTimeStamp(const String16& title)
103 {
104 v8::Isolate* isolate = m_isolate;
105 TRACE_EVENT_INSTANT1("devtools.timeline", "TimeStamp", TRACE_EVENT_SCOPE_THR EAD, "data", InspectorTimeStampEvent::data(currentExecutionContext(isolate), tit le));
106 }
65 107
66 } // namespace blink 108 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698