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

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

Issue 2260233002: [DevTools] Migrate v8_inspector/public from String16 to String{View,Buffer}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: styling Created 4 years, 3 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/V8InspectorString.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 26 matching lines...) Expand all
79 int WorkerThreadDebugger::contextGroupId(ExecutionContext* context) 80 int WorkerThreadDebugger::contextGroupId(ExecutionContext* context)
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, v8_in spector::StringView());
90 contextInfo.origin = m_workerThread->globalScope()->url().getString(); 91 String origin = m_workerThread->globalScope()->url().getString();
92 contextInfo.origin = toV8InspectorStringView(origin);
91 v8Inspector()->contextCreated(contextInfo); 93 v8Inspector()->contextCreated(contextInfo);
92 } 94 }
93 95
94 void WorkerThreadDebugger::contextWillBeDestroyed(v8::Local<v8::Context> context ) 96 void WorkerThreadDebugger::contextWillBeDestroyed(v8::Local<v8::Context> context )
95 { 97 {
96 v8Inspector()->contextDestroyed(context); 98 v8Inspector()->contextDestroyed(context);
97 } 99 }
98 100
99 void WorkerThreadDebugger::exceptionThrown(ErrorEvent* event) 101 void WorkerThreadDebugger::exceptionThrown(ErrorEvent* event)
100 { 102 {
101 m_workerThread->workerReportingProxy().reportConsoleMessage(JSMessageSource, ErrorMessageLevel, event->messageForConsole(), event->location()); 103 m_workerThread->workerReportingProxy().reportConsoleMessage(JSMessageSource, ErrorMessageLevel, event->messageForConsole(), event->location());
102 104
103 const String16 defaultMessage = "Uncaught"; 105 const String defaultMessage = "Uncaught";
104 ScriptState* scriptState = m_workerThread->globalScope()->scriptController() ->getScriptState(); 106 ScriptState* scriptState = m_workerThread->globalScope()->scriptController() ->getScriptState();
105 if (scriptState && scriptState->contextIsValid()) { 107 if (scriptState && scriptState->contextIsValid()) {
106 ScriptState::Scope scope(scriptState); 108 ScriptState::Scope scope(scriptState);
107 v8::Local<v8::Value> exception = V8ErrorHandler::loadExceptionFromErrorE ventWrapper(scriptState, event, scriptState->context()->Global()); 109 v8::Local<v8::Value> exception = V8ErrorHandler::loadExceptionFromErrorE ventWrapper(scriptState, event, scriptState->context()->Global());
108 SourceLocation* location = event->location(); 110 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()); 111 String message = event->messageForConsole();
112 String url = location->url();
113 v8Inspector()->exceptionThrown(scriptState->context(), toV8InspectorStri ngView(defaultMessage), exception, toV8InspectorStringView(message), toV8Inspect orStringView(url), location->lineNumber(), location->columnNumber(), location->t akeStackTrace(), location->scriptId());
110 } 114 }
111 } 115 }
112 116
113 int WorkerThreadDebugger::contextGroupId() 117 int WorkerThreadDebugger::contextGroupId()
114 { 118 {
115 return workerContextGroupId; 119 return workerContextGroupId;
116 } 120 }
117 121
118 void WorkerThreadDebugger::runMessageLoopOnPause(int contextGroupId) 122 void WorkerThreadDebugger::runMessageLoopOnPause(int contextGroupId)
119 { 123 {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 DCHECK(contextGroupId == workerContextGroupId); 162 DCHECK(contextGroupId == workerContextGroupId);
159 return true; 163 return true;
160 } 164 }
161 165
162 void WorkerThreadDebugger::runIfWaitingForDebugger(int contextGroupId) 166 void WorkerThreadDebugger::runIfWaitingForDebugger(int contextGroupId)
163 { 167 {
164 DCHECK(contextGroupId == workerContextGroupId); 168 DCHECK(contextGroupId == workerContextGroupId);
165 m_workerThread->stopRunningDebuggerTasksOnPauseOnWorkerThread(); 169 m_workerThread->stopRunningDebuggerTasksOnPauseOnWorkerThread();
166 } 170 }
167 171
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) 172 void WorkerThreadDebugger::consoleAPIMessage(int contextGroupId, v8_inspector::V 8ConsoleAPIType type, const v8_inspector::StringView& message, const v8_inspecto r::StringView& url, unsigned lineNumber, unsigned columnNumber, v8_inspector::V8 StackTrace* stackTrace)
169 { 173 {
170 DCHECK(contextGroupId == workerContextGroupId); 174 DCHECK(contextGroupId == workerContextGroupId);
171 if (type == v8_inspector::V8ConsoleAPIType::kClear) 175 if (type == v8_inspector::V8ConsoleAPIType::kClear)
172 m_workerThread->consoleMessageStorage()->clear(); 176 m_workerThread->consoleMessageStorage()->clear();
173 std::unique_ptr<SourceLocation> location = SourceLocation::create(url, lineN umber, columnNumber, stackTrace ? stackTrace->clone() : nullptr, 0); 177 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()); 178 m_workerThread->workerReportingProxy().reportConsoleMessage(ConsoleAPIMessag eSource, consoleAPITypeToMessageLevel(type), toCoreString(message), location.get ());
175 } 179 }
176 180
177 v8::MaybeLocal<v8::Value> WorkerThreadDebugger::memoryInfo(v8::Isolate*, v8::Loc al<v8::Context>) 181 v8::MaybeLocal<v8::Value> WorkerThreadDebugger::memoryInfo(v8::Isolate*, v8::Loc al<v8::Context>)
178 { 182 {
179 ASSERT_NOT_REACHED(); 183 ASSERT_NOT_REACHED();
180 return v8::MaybeLocal<v8::Value>(); 184 return v8::MaybeLocal<v8::Value>();
181 } 185 }
182 186
183 } // namespace blink 187 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698