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

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

Issue 2116113002: [worklets] Make WorkerThread handle both Worker and Worklet global scopes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again 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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "core/inspector/WorkerThreadDebugger.h" 31 #include "core/inspector/WorkerThreadDebugger.h"
32 32
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/V8PerIsolateData.h"
35 #include "bindings/core/v8/V8ScriptRunner.h" 36 #include "bindings/core/v8/V8ScriptRunner.h"
37 #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
36 #include "core/inspector/ConsoleMessage.h" 38 #include "core/inspector/ConsoleMessage.h"
37 #include "core/inspector/ConsoleMessageStorage.h" 39 #include "core/inspector/ConsoleMessageStorage.h"
38 #include "core/inspector/IdentifiersFactory.h" 40 #include "core/inspector/IdentifiersFactory.h"
39 #include "core/workers/WorkerGlobalScope.h" 41 #include "core/workers/WorkerGlobalScope.h"
40 #include "core/workers/WorkerReportingProxy.h" 42 #include "core/workers/WorkerReportingProxy.h"
41 #include "core/workers/WorkerThread.h" 43 #include "core/workers/WorkerThread.h"
42 #include <v8.h> 44 #include <v8.h>
43 45
44 namespace blink { 46 namespace blink {
45 47
(...skipping 15 matching lines...) Expand all
61 } 63 }
62 64
63 WorkerThreadDebugger::~WorkerThreadDebugger() 65 WorkerThreadDebugger::~WorkerThreadDebugger()
64 { 66 {
65 } 67 }
66 68
67 void WorkerThreadDebugger::reportConsoleMessage(ExecutionContext* context, Conso leMessage* message) 69 void WorkerThreadDebugger::reportConsoleMessage(ExecutionContext* context, Conso leMessage* message)
68 { 70 {
69 if (!context) 71 if (!context)
70 return; 72 return;
71 DCHECK(context == m_workerThread->workerGlobalScope()); 73 DCHECK(context == m_workerThread->globalScope());
72 m_workerThread->workerReportingProxy().reportConsoleMessage(message); 74 m_workerThread->workerReportingProxy().reportConsoleMessage(message);
73 } 75 }
74 76
75 int WorkerThreadDebugger::contextGroupId(ExecutionContext* context) 77 int WorkerThreadDebugger::contextGroupId(ExecutionContext* context)
76 { 78 {
77 if (!context) 79 if (!context)
78 return 0; 80 return 0;
79 DCHECK(context == m_workerThread->workerGlobalScope()); 81 DCHECK(context == m_workerThread->globalScope());
80 return workerContextGroupId; 82 return workerContextGroupId;
81 } 83 }
82 84
83 void WorkerThreadDebugger::contextCreated(v8::Local<v8::Context> context) 85 void WorkerThreadDebugger::contextCreated(v8::Local<v8::Context> context)
84 { 86 {
85 debugger()->contextCreated(V8ContextInfo(context, workerContextGroupId, true , m_workerThread->workerGlobalScope()->url().getString(), "", "", false)); 87 debugger()->contextCreated(V8ContextInfo(context, workerContextGroupId, true , m_workerThread->globalScope()->url().getString(), "", "", false));
86 } 88 }
87 89
88 void WorkerThreadDebugger::contextWillBeDestroyed(v8::Local<v8::Context> context ) 90 void WorkerThreadDebugger::contextWillBeDestroyed(v8::Local<v8::Context> context )
89 { 91 {
90 debugger()->contextDestroyed(context); 92 debugger()->contextDestroyed(context);
91 } 93 }
92 94
93 void WorkerThreadDebugger::exceptionThrown(const String& errorMessage, std::uniq ue_ptr<SourceLocation> location) 95 void WorkerThreadDebugger::exceptionThrown(const String& errorMessage, std::uniq ue_ptr<SourceLocation> location)
94 { 96 {
95 if (m_workerThread->workerGlobalScope()->consoleMessageStorage()->isMuted()) 97 if (m_workerThread->consoleMessageStorage()->isMuted())
96 return; 98 return;
97 debugger()->exceptionThrown(workerContextGroupId, errorMessage, location->ur l(), location->lineNumber(), location->columnNumber(), location->cloneStackTrace (), location->scriptId()); 99 debugger()->exceptionThrown(workerContextGroupId, errorMessage, location->ur l(), location->lineNumber(), location->columnNumber(), location->cloneStackTrace (), location->scriptId());
98 m_workerThread->workerReportingProxy().reportConsoleMessage(ConsoleMessage:: create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location))); 100 m_workerThread->workerReportingProxy().reportConsoleMessage(ConsoleMessage:: create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location)));
99 } 101 }
100 102
101 int WorkerThreadDebugger::contextGroupId() 103 int WorkerThreadDebugger::contextGroupId()
102 { 104 {
103 return workerContextGroupId; 105 return workerContextGroupId;
104 } 106 }
105 107
106 void WorkerThreadDebugger::runMessageLoopOnPause(int contextGroupId) 108 void WorkerThreadDebugger::runMessageLoopOnPause(int contextGroupId)
107 { 109 {
108 ASSERT(contextGroupId == workerContextGroupId); 110 ASSERT(contextGroupId == workerContextGroupId);
109 m_workerThread->startRunningDebuggerTasksOnPauseOnWorkerThread(); 111 m_workerThread->startRunningDebuggerTasksOnPauseOnWorkerThread();
110 } 112 }
111 113
112 void WorkerThreadDebugger::quitMessageLoopOnPause() 114 void WorkerThreadDebugger::quitMessageLoopOnPause()
113 { 115 {
114 m_workerThread->stopRunningDebuggerTasksOnPauseOnWorkerThread(); 116 m_workerThread->stopRunningDebuggerTasksOnPauseOnWorkerThread();
115 } 117 }
116 118
117 void WorkerThreadDebugger::muteWarningsAndDeprecations(int contextGroupId) 119 void WorkerThreadDebugger::muteWarningsAndDeprecations(int contextGroupId)
118 { 120 {
119 DCHECK(contextGroupId == workerContextGroupId); 121 DCHECK(contextGroupId == workerContextGroupId);
120 m_workerThread->workerGlobalScope()->consoleMessageStorage()->mute(); 122 m_workerThread->consoleMessageStorage()->mute();
121 } 123 }
122 124
123 void WorkerThreadDebugger::unmuteWarningsAndDeprecations(int contextGroupId) 125 void WorkerThreadDebugger::unmuteWarningsAndDeprecations(int contextGroupId)
124 { 126 {
125 DCHECK(contextGroupId == workerContextGroupId); 127 DCHECK(contextGroupId == workerContextGroupId);
126 m_workerThread->workerGlobalScope()->consoleMessageStorage()->unmute(); 128 m_workerThread->consoleMessageStorage()->unmute();
127 } 129 }
128 130
129 v8::Local<v8::Context> WorkerThreadDebugger::ensureDefaultContextInGroup(int con textGroupId) 131 v8::Local<v8::Context> WorkerThreadDebugger::ensureDefaultContextInGroup(int con textGroupId)
130 { 132 {
131 ASSERT(contextGroupId == workerContextGroupId); 133 ASSERT(contextGroupId == workerContextGroupId);
132 ScriptState* scriptState = m_workerThread->workerGlobalScope()->scriptContro ller()->getScriptState(); 134 ScriptState* scriptState = m_workerThread->globalScope()->scriptController() ->getScriptState();
133 return scriptState ? scriptState->context() : v8::Local<v8::Context>(); 135 return scriptState ? scriptState->context() : v8::Local<v8::Context>();
134 } 136 }
135 137
136 void WorkerThreadDebugger::beginEnsureAllContextsInGroup(int contextGroupId) 138 void WorkerThreadDebugger::beginEnsureAllContextsInGroup(int contextGroupId)
137 { 139 {
138 DCHECK(contextGroupId == workerContextGroupId); 140 DCHECK(contextGroupId == workerContextGroupId);
139 } 141 }
140 142
141 void WorkerThreadDebugger::endEnsureAllContextsInGroup(int contextGroupId) 143 void WorkerThreadDebugger::endEnsureAllContextsInGroup(int contextGroupId)
142 { 144 {
143 DCHECK(contextGroupId == workerContextGroupId); 145 DCHECK(contextGroupId == workerContextGroupId);
144 } 146 }
145 147
146 void WorkerThreadDebugger::consoleAPIMessage(int contextGroupId, MessageLevel le vel, const String16& message, const String16& url, unsigned lineNumber, unsigned columnNumber, V8StackTrace* stackTrace) 148 void WorkerThreadDebugger::consoleAPIMessage(int contextGroupId, MessageLevel le vel, const String16& message, const String16& url, unsigned lineNumber, unsigned columnNumber, V8StackTrace* stackTrace)
147 { 149 {
148 DCHECK(contextGroupId == workerContextGroupId); 150 DCHECK(contextGroupId == workerContextGroupId);
149 // TODO(dgozman): maybe not wrap with ConsoleMessage. 151 // TODO(dgozman): maybe not wrap with ConsoleMessage.
150 ConsoleMessage* consoleMessage = ConsoleMessage::create(ConsoleAPIMessageSou rce, level, message, SourceLocation::create(url, lineNumber, columnNumber, stack Trace ? stackTrace->clone() : nullptr, 0)); 152 ConsoleMessage* consoleMessage = ConsoleMessage::create(ConsoleAPIMessageSou rce, level, message, SourceLocation::create(url, lineNumber, columnNumber, stack Trace ? stackTrace->clone() : nullptr, 0));
151 m_workerThread->workerReportingProxy().reportConsoleMessage(consoleMessage); 153 m_workerThread->workerReportingProxy().reportConsoleMessage(consoleMessage);
152 } 154 }
153 155
154 v8::MaybeLocal<v8::Value> WorkerThreadDebugger::memoryInfo(v8::Isolate*, v8::Loc al<v8::Context>) 156 v8::MaybeLocal<v8::Value> WorkerThreadDebugger::memoryInfo(v8::Isolate*, v8::Loc al<v8::Context>)
155 { 157 {
156 ASSERT_NOT_REACHED(); 158 ASSERT_NOT_REACHED();
157 return v8::MaybeLocal<v8::Value>(); 159 return v8::MaybeLocal<v8::Value>();
158 } 160 }
159 161
160 } // namespace blink 162 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698