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

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: 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 // 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 v8::FunctionCallbackInfo<v8::Value>& arg uments, unsigned skipArgumentCount)
71 {
72 ScriptState* scriptState = ScriptState::from(context);
73 RawPtr<ScriptArguments> scriptArguments;
74 if (scriptState->contextIsValid())
75 scriptArguments = ScriptArguments::create(scriptState, arguments, skipAr gumentCount);
76 String message;
77 if (scriptArguments)
78 scriptArguments->getFirstArgumentAsString(message);
79
80 ConsoleMessage* consoleMessage = ConsoleMessage::create(ConsoleAPIMessageSou rce, level, message);
81 consoleMessage->setType(type);
82 consoleMessage->setScriptState(scriptState);
83 consoleMessage->setScriptArguments(scriptArguments.release());
84 consoleMessage->setCallStack(ScriptCallStack::captureForConsole());
85 reportMessageToConsole(context, consoleMessage);
86 }
87
88 void ThreadDebugger::reportMessageToConsole(v8::Local<v8::Context> context, Mess ageType type, MessageLevel level, const String16& text)
89 {
90 ConsoleMessage* consoleMessage = ConsoleMessage::create(ConsoleAPIMessageSou rce, level, text);
91 consoleMessage->setType(type);
92 consoleMessage->setCallStack(ScriptCallStack::capture(1));
dgozman 2016/04/12 03:32:15 consoleMessage->setScriptState(scriptState);
kozy 2016/04/12 21:58:32 Done.
93 reportMessageToConsole(context, consoleMessage);
94 }
95
96 void ThreadDebugger::consoleTime(v8::Isolate* isolate, const String16& title)
97 {
98 TRACE_EVENT_COPY_ASYNC_BEGIN0("blink.console", ((String)title).utf8().data() , this);
dgozman 2016/04/12 03:32:15 String(title).utf8().data()
kozy 2016/04/12 21:58:32 Done.
99 }
100
101 void ThreadDebugger::consoleTimeEnd(v8::Isolate* isolate, const String16& title)
102 {
103 TRACE_EVENT_COPY_ASYNC_END0("blink.console", ((String)title).utf8().data(), this);
dgozman 2016/04/12 03:32:15 ditto
kozy 2016/04/12 21:58:32 Done.
104 }
105
106 void ThreadDebugger::consoleTimeStamp(v8::Isolate* isolate, const String16& titl e)
107 {
108 TRACE_EVENT_INSTANT1("devtools.timeline", "TimeStamp", TRACE_EVENT_SCOPE_THR EAD, "data", InspectorTimeStampEvent::data(currentExecutionContext(isolate), tit le));
109 }
65 110
66 } // namespace blink 111 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698