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

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

Issue 2251343003: [DevTools] Generate separate copies of inspector_protocol. (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 /* 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 22 matching lines...) Expand all
33 #include "bindings/core/v8/ScriptState.h" 33 #include "bindings/core/v8/ScriptState.h"
34 #include "bindings/core/v8/SourceLocation.h" 34 #include "bindings/core/v8/SourceLocation.h"
35 #include "bindings/core/v8/V8ErrorHandler.h" 35 #include "bindings/core/v8/V8ErrorHandler.h"
36 #include "bindings/core/v8/V8PerIsolateData.h" 36 #include "bindings/core/v8/V8PerIsolateData.h"
37 #include "bindings/core/v8/V8ScriptRunner.h" 37 #include "bindings/core/v8/V8ScriptRunner.h"
38 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" 38 #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
39 #include "core/events/ErrorEvent.h" 39 #include "core/events/ErrorEvent.h"
40 #include "core/inspector/ConsoleMessage.h" 40 #include "core/inspector/ConsoleMessage.h"
41 #include "core/inspector/ConsoleMessageStorage.h" 41 #include "core/inspector/ConsoleMessageStorage.h"
42 #include "core/inspector/IdentifiersFactory.h" 42 #include "core/inspector/IdentifiersFactory.h"
43 #include "core/inspector/V8InspectorStringConversion.h"
43 #include "core/workers/WorkerGlobalScope.h" 44 #include "core/workers/WorkerGlobalScope.h"
44 #include "core/workers/WorkerReportingProxy.h" 45 #include "core/workers/WorkerReportingProxy.h"
45 #include "core/workers/WorkerThread.h" 46 #include "core/workers/WorkerThread.h"
46 #include <v8.h> 47 #include <v8.h>
47 48
48 namespace blink { 49 namespace blink {
49 50
50 static const int workerContextGroupId = 1; 51 static const int workerContextGroupId = 1;
51 52
52 WorkerThreadDebugger* WorkerThreadDebugger::from(v8::Isolate* isolate) 53 WorkerThreadDebugger* WorkerThreadDebugger::from(v8::Isolate* isolate)
(...skipping 27 matching lines...) Expand all
80 { 81 {
81 if (!context) 82 if (!context)
82 return 0; 83 return 0;
83 DCHECK(context == m_workerThread->globalScope()); 84 DCHECK(context == m_workerThread->globalScope());
84 return workerContextGroupId; 85 return workerContextGroupId;
85 } 86 }
86 87
87 void WorkerThreadDebugger::contextCreated(v8::Local<v8::Context> context) 88 void WorkerThreadDebugger::contextCreated(v8::Local<v8::Context> context)
88 { 89 {
89 v8_inspector::V8ContextInfo contextInfo(context, workerContextGroupId, ""); 90 v8_inspector::V8ContextInfo contextInfo(context, workerContextGroupId, "");
90 contextInfo.origin = m_workerThread->globalScope()->url().getString(); 91 contextInfo.origin = toV8InspectorString(m_workerThread->globalScope()->url( ).getString());
91 v8Inspector()->contextCreated(contextInfo); 92 v8Inspector()->contextCreated(contextInfo);
92 } 93 }
93 94
94 void WorkerThreadDebugger::contextWillBeDestroyed(v8::Local<v8::Context> context ) 95 void WorkerThreadDebugger::contextWillBeDestroyed(v8::Local<v8::Context> context )
95 { 96 {
96 v8Inspector()->contextDestroyed(context); 97 v8Inspector()->contextDestroyed(context);
97 } 98 }
98 99
99 void WorkerThreadDebugger::exceptionThrown(ErrorEvent* event) 100 void WorkerThreadDebugger::exceptionThrown(ErrorEvent* event)
100 { 101 {
101 m_workerThread->workerReportingProxy().reportConsoleMessage(JSMessageSource, ErrorMessageLevel, event->messageForConsole(), event->location()); 102 m_workerThread->workerReportingProxy().reportConsoleMessage(JSMessageSource, ErrorMessageLevel, event->messageForConsole(), event->location());
102 103
103 const String16 defaultMessage = "Uncaught"; 104 const v8_inspector::String16 defaultMessage = "Uncaught";
104 ScriptState* scriptState = m_workerThread->globalScope()->scriptController() ->getScriptState(); 105 ScriptState* scriptState = m_workerThread->globalScope()->scriptController() ->getScriptState();
105 if (scriptState && scriptState->contextIsValid()) { 106 if (scriptState && scriptState->contextIsValid()) {
106 ScriptState::Scope scope(scriptState); 107 ScriptState::Scope scope(scriptState);
107 v8::Local<v8::Value> exception = V8ErrorHandler::loadExceptionFromErrorE ventWrapper(scriptState, event, scriptState->context()->Global()); 108 v8::Local<v8::Value> exception = V8ErrorHandler::loadExceptionFromErrorE ventWrapper(scriptState, event, scriptState->context()->Global());
108 SourceLocation* location = event->location(); 109 SourceLocation* location = event->location();
109 v8Inspector()->exceptionThrown(scriptState->context(), defaultMessage, e xception, event->messageForConsole(), location->url(), location->lineNumber(), l ocation->columnNumber(), location->takeStackTrace(), location->scriptId()); 110 v8Inspector()->exceptionThrown(scriptState->context(), defaultMessage, e xception, toV8InspectorString(event->messageForConsole()), toV8InspectorString(l ocation->url()), location->lineNumber(), location->columnNumber(), location->tak eStackTrace(), location->scriptId());
110 } 111 }
111 } 112 }
112 113
113 int WorkerThreadDebugger::contextGroupId() 114 int WorkerThreadDebugger::contextGroupId()
114 { 115 {
115 return workerContextGroupId; 116 return workerContextGroupId;
116 } 117 }
117 118
118 void WorkerThreadDebugger::runMessageLoopOnPause(int contextGroupId) 119 void WorkerThreadDebugger::runMessageLoopOnPause(int contextGroupId)
119 { 120 {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 DCHECK(contextGroupId == workerContextGroupId); 159 DCHECK(contextGroupId == workerContextGroupId);
159 return true; 160 return true;
160 } 161 }
161 162
162 void WorkerThreadDebugger::runIfWaitingForDebugger(int contextGroupId) 163 void WorkerThreadDebugger::runIfWaitingForDebugger(int contextGroupId)
163 { 164 {
164 DCHECK(contextGroupId == workerContextGroupId); 165 DCHECK(contextGroupId == workerContextGroupId);
165 m_workerThread->stopRunningDebuggerTasksOnPauseOnWorkerThread(); 166 m_workerThread->stopRunningDebuggerTasksOnPauseOnWorkerThread();
166 } 167 }
167 168
168 void WorkerThreadDebugger::consoleAPIMessage(int contextGroupId, v8_inspector::V 8ConsoleAPIType type, const String16& message, const String16& url, unsigned lin eNumber, unsigned columnNumber, v8_inspector::V8StackTrace* stackTrace) 169 void WorkerThreadDebugger::consoleAPIMessage(int contextGroupId, v8_inspector::V 8ConsoleAPIType type, const v8_inspector::String16& message, const v8_inspector: :String16& url, unsigned lineNumber, unsigned columnNumber, v8_inspector::V8Stac kTrace* stackTrace)
169 { 170 {
170 DCHECK(contextGroupId == workerContextGroupId); 171 DCHECK(contextGroupId == workerContextGroupId);
171 if (type == v8_inspector::V8ConsoleAPIType::kClear) 172 if (type == v8_inspector::V8ConsoleAPIType::kClear)
172 m_workerThread->consoleMessageStorage()->clear(); 173 m_workerThread->consoleMessageStorage()->clear();
173 std::unique_ptr<SourceLocation> location = SourceLocation::create(url, lineN umber, columnNumber, stackTrace ? stackTrace->clone() : nullptr, 0); 174 std::unique_ptr<SourceLocation> location = SourceLocation::create(toCoreStri ng(url), lineNumber, columnNumber, stackTrace ? stackTrace->clone() : nullptr, 0 );
174 m_workerThread->workerReportingProxy().reportConsoleMessage(ConsoleAPIMessag eSource, consoleAPITypeToMessageLevel(type), message, location.get()); 175 m_workerThread->workerReportingProxy().reportConsoleMessage(ConsoleAPIMessag eSource, consoleAPITypeToMessageLevel(type), toCoreString(message), location.get ());
175 } 176 }
176 177
177 v8::MaybeLocal<v8::Value> WorkerThreadDebugger::memoryInfo(v8::Isolate*, v8::Loc al<v8::Context>) 178 v8::MaybeLocal<v8::Value> WorkerThreadDebugger::memoryInfo(v8::Isolate*, v8::Loc al<v8::Context>)
178 { 179 {
179 ASSERT_NOT_REACHED(); 180 ASSERT_NOT_REACHED();
180 return v8::MaybeLocal<v8::Value>(); 181 return v8::MaybeLocal<v8::Value>();
181 } 182 }
182 183
183 } // namespace blink 184 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698