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

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

Issue 2199943004: [DevTools] Rename V8Debugger to V8Inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/SourceLocation.h" 7 #include "bindings/core/v8/SourceLocation.h"
8 #include "bindings/core/v8/V8Binding.h" 8 #include "bindings/core/v8/V8Binding.h"
9 #include "bindings/core/v8/V8DOMException.h" 9 #include "bindings/core/v8/V8DOMException.h"
10 #include "bindings/core/v8/V8DOMTokenList.h" 10 #include "bindings/core/v8/V8DOMTokenList.h"
(...skipping 11 matching lines...) Expand all
22 #include "core/inspector/InspectorTraceEvents.h" 22 #include "core/inspector/InspectorTraceEvents.h"
23 #include "platform/ScriptForbiddenScope.h" 23 #include "platform/ScriptForbiddenScope.h"
24 #include "wtf/CurrentTime.h" 24 #include "wtf/CurrentTime.h"
25 #include "wtf/PtrUtil.h" 25 #include "wtf/PtrUtil.h"
26 #include <memory> 26 #include <memory>
27 27
28 namespace blink { 28 namespace blink {
29 29
30 ThreadDebugger::ThreadDebugger(v8::Isolate* isolate) 30 ThreadDebugger::ThreadDebugger(v8::Isolate* isolate)
31 : m_isolate(isolate) 31 : m_isolate(isolate)
32 , m_debugger(V8Debugger::create(isolate, this)) 32 , m_v8Inspector(V8Inspector::create(isolate, this))
33 { 33 {
34 } 34 }
35 35
36 ThreadDebugger::~ThreadDebugger() 36 ThreadDebugger::~ThreadDebugger()
37 { 37 {
38 } 38 }
39 39
40 // static 40 // static
41 ThreadDebugger* ThreadDebugger::from(v8::Isolate* isolate) 41 ThreadDebugger* ThreadDebugger::from(v8::Isolate* isolate)
42 { 42 {
(...skipping 12 matching lines...) Expand all
55 case V8ConsoleAPIType::kInfo: return InfoMessageLevel; 55 case V8ConsoleAPIType::kInfo: return InfoMessageLevel;
56 case V8ConsoleAPIType::kWarning: return WarningMessageLevel; 56 case V8ConsoleAPIType::kWarning: return WarningMessageLevel;
57 case V8ConsoleAPIType::kError: return ErrorMessageLevel; 57 case V8ConsoleAPIType::kError: return ErrorMessageLevel;
58 default: return LogMessageLevel; 58 default: return LogMessageLevel;
59 } 59 }
60 } 60 }
61 61
62 void ThreadDebugger::willExecuteScript(v8::Isolate* isolate, int scriptId) 62 void ThreadDebugger::willExecuteScript(v8::Isolate* isolate, int scriptId)
63 { 63 {
64 if (ThreadDebugger* debugger = ThreadDebugger::from(isolate)) 64 if (ThreadDebugger* debugger = ThreadDebugger::from(isolate))
65 debugger->debugger()->willExecuteScript(isolate->GetCurrentContext(), sc riptId); 65 debugger->v8Inspector()->willExecuteScript(isolate->GetCurrentContext(), scriptId);
66 } 66 }
67 67
68 void ThreadDebugger::didExecuteScript(v8::Isolate* isolate) 68 void ThreadDebugger::didExecuteScript(v8::Isolate* isolate)
69 { 69 {
70 if (ThreadDebugger* debugger = ThreadDebugger::from(isolate)) 70 if (ThreadDebugger* debugger = ThreadDebugger::from(isolate))
71 debugger->debugger()->didExecuteScript(isolate->GetCurrentContext()); 71 debugger->v8Inspector()->didExecuteScript(isolate->GetCurrentContext());
72 } 72 }
73 73
74 void ThreadDebugger::idleStarted(v8::Isolate* isolate) 74 void ThreadDebugger::idleStarted(v8::Isolate* isolate)
75 { 75 {
76 if (ThreadDebugger* debugger = ThreadDebugger::from(isolate)) 76 if (ThreadDebugger* debugger = ThreadDebugger::from(isolate))
77 debugger->debugger()->idleStarted(); 77 debugger->v8Inspector()->idleStarted();
78 } 78 }
79 79
80 void ThreadDebugger::idleFinished(v8::Isolate* isolate) 80 void ThreadDebugger::idleFinished(v8::Isolate* isolate)
81 { 81 {
82 if (ThreadDebugger* debugger = ThreadDebugger::from(isolate)) 82 if (ThreadDebugger* debugger = ThreadDebugger::from(isolate))
83 debugger->debugger()->idleFinished(); 83 debugger->v8Inspector()->idleFinished();
84 } 84 }
85 85
86 void ThreadDebugger::asyncTaskScheduled(const String& operationName, void* task, bool recurring) 86 void ThreadDebugger::asyncTaskScheduled(const String& operationName, void* task, bool recurring)
87 { 87 {
88 m_debugger->asyncTaskScheduled(operationName, task, recurring); 88 m_v8Inspector->asyncTaskScheduled(operationName, task, recurring);
89 } 89 }
90 90
91 void ThreadDebugger::asyncTaskCanceled(void* task) 91 void ThreadDebugger::asyncTaskCanceled(void* task)
92 { 92 {
93 m_debugger->asyncTaskCanceled(task); 93 m_v8Inspector->asyncTaskCanceled(task);
94 } 94 }
95 95
96 void ThreadDebugger::allAsyncTasksCanceled() 96 void ThreadDebugger::allAsyncTasksCanceled()
97 { 97 {
98 m_debugger->allAsyncTasksCanceled(); 98 m_v8Inspector->allAsyncTasksCanceled();
99 } 99 }
100 100
101 void ThreadDebugger::asyncTaskStarted(void* task) 101 void ThreadDebugger::asyncTaskStarted(void* task)
102 { 102 {
103 m_debugger->asyncTaskStarted(task); 103 m_v8Inspector->asyncTaskStarted(task);
104 } 104 }
105 105
106 void ThreadDebugger::asyncTaskFinished(void* task) 106 void ThreadDebugger::asyncTaskFinished(void* task)
107 { 107 {
108 m_debugger->asyncTaskFinished(task); 108 m_v8Inspector->asyncTaskFinished(task);
109 } 109 }
110 110
111 unsigned ThreadDebugger::promiseRejected(v8::Local<v8::Context> context, const S tring16& errorMessage, v8::Local<v8::Value> exception, std::unique_ptr<SourceLoc ation> location) 111 unsigned ThreadDebugger::promiseRejected(v8::Local<v8::Context> context, const S tring16& errorMessage, v8::Local<v8::Value> exception, std::unique_ptr<SourceLoc ation> location)
112 { 112 {
113 const String16 defaultMessage = "Uncaught (in promise)"; 113 const String16 defaultMessage = "Uncaught (in promise)";
114 String16 message = errorMessage; 114 String16 message = errorMessage;
115 if (message.isEmpty()) 115 if (message.isEmpty())
116 message = defaultMessage; 116 message = defaultMessage;
117 else if (message.startWith("Uncaught ")) 117 else if (message.startWith("Uncaught "))
118 message = message.substring(0, 8) + " (in promise)" + message.substring( 8); 118 message = message.substring(0, 8) + " (in promise)" + message.substring( 8);
119 119
120 unsigned result = debugger()->exceptionThrown(context, defaultMessage, excep tion, message, location->url(), location->lineNumber(), location->columnNumber() , location->cloneStackTrace(), location->scriptId()); 120 unsigned result = v8Inspector()->exceptionThrown(context, defaultMessage, ex ception, message, location->url(), location->lineNumber(), location->columnNumbe r(), location->cloneStackTrace(), location->scriptId());
121 // TODO(dgozman): do not wrap in ConsoleMessage. 121 // TODO(dgozman): do not wrap in ConsoleMessage.
122 reportConsoleMessage(toExecutionContext(context), ConsoleMessage::create(JSM essageSource, ErrorMessageLevel, message, std::move(location))); 122 reportConsoleMessage(toExecutionContext(context), ConsoleMessage::create(JSM essageSource, ErrorMessageLevel, message, std::move(location)));
123 return result; 123 return result;
124 } 124 }
125 125
126 void ThreadDebugger::promiseRejectionRevoked(v8::Local<v8::Context> context, uns igned promiseRejectionId) 126 void ThreadDebugger::promiseRejectionRevoked(v8::Local<v8::Context> context, uns igned promiseRejectionId)
127 { 127 {
128 const String16 message = "Handler added to rejected promise"; 128 const String16 message = "Handler added to rejected promise";
129 debugger()->exceptionRevoked(context, promiseRejectionId, message); 129 v8Inspector()->exceptionRevoked(context, promiseRejectionId, message);
130 } 130 }
131 131
132 void ThreadDebugger::beginUserGesture() 132 void ThreadDebugger::beginUserGesture()
133 { 133 {
134 m_userGestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProce ssingNewUserGesture)); 134 m_userGestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProce ssingNewUserGesture));
135 } 135 }
136 136
137 void ThreadDebugger::endUserGesture() 137 void ThreadDebugger::endUserGesture()
138 { 138 {
139 m_userGestureIndicator.reset(); 139 m_userGestureIndicator.reset();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 { 343 {
344 TRACE_EVENT_COPY_ASYNC_END0("blink.console", String(title).utf8().data(), th is); 344 TRACE_EVENT_COPY_ASYNC_END0("blink.console", String(title).utf8().data(), th is);
345 } 345 }
346 346
347 void ThreadDebugger::consoleTimeStamp(const String16& title) 347 void ThreadDebugger::consoleTimeStamp(const String16& title)
348 { 348 {
349 v8::Isolate* isolate = m_isolate; 349 v8::Isolate* isolate = m_isolate;
350 TRACE_EVENT_INSTANT1("devtools.timeline", "TimeStamp", TRACE_EVENT_SCOPE_THR EAD, "data", InspectorTimeStampEvent::data(currentExecutionContext(isolate), tit le)); 350 TRACE_EVENT_INSTANT1("devtools.timeline", "TimeStamp", TRACE_EVENT_SCOPE_THR EAD, "data", InspectorTimeStampEvent::data(currentExecutionContext(isolate), tit le));
351 } 351 }
352 352
353 void ThreadDebugger::startRepeatingTimer(double interval, V8DebuggerClient::Time rCallback callback, void* data) 353 void ThreadDebugger::startRepeatingTimer(double interval, V8InspectorClient::Tim erCallback callback, void* data)
354 { 354 {
355 m_timerData.append(data); 355 m_timerData.append(data);
356 m_timerCallbacks.append(callback); 356 m_timerCallbacks.append(callback);
357 357
358 std::unique_ptr<Timer<ThreadDebugger>> timer = wrapUnique(new Timer<ThreadDe bugger>(this, &ThreadDebugger::onTimer)); 358 std::unique_ptr<Timer<ThreadDebugger>> timer = wrapUnique(new Timer<ThreadDe bugger>(this, &ThreadDebugger::onTimer));
359 Timer<ThreadDebugger>* timerPtr = timer.get(); 359 Timer<ThreadDebugger>* timerPtr = timer.get();
360 m_timers.append(std::move(timer)); 360 m_timers.append(std::move(timer));
361 timerPtr->startRepeating(interval, BLINK_FROM_HERE); 361 timerPtr->startRepeating(interval, BLINK_FROM_HERE);
362 } 362 }
363 363
(...skipping 14 matching lines...) Expand all
378 { 378 {
379 for (size_t index = 0; index < m_timers.size(); ++index) { 379 for (size_t index = 0; index < m_timers.size(); ++index) {
380 if (m_timers[index].get() == timer) { 380 if (m_timers[index].get() == timer) {
381 m_timerCallbacks[index](m_timerData[index]); 381 m_timerCallbacks[index](m_timerData[index]);
382 return; 382 return;
383 } 383 }
384 } 384 }
385 } 385 }
386 386
387 } // namespace blink 387 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698