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

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

Issue 2200273002: [DevTools] Cleanup mute exceptions, usecounter and deprecations in v8_inspector API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2205913002
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 ScriptState* scriptState = nullptr; 160 ScriptState* scriptState = nullptr;
161 if (context->isDocument()) { 161 if (context->isDocument()) {
162 frame = toDocument(context)->frame(); 162 frame = toDocument(context)->frame();
163 scriptState = event->world() ? ScriptState::forWorld(frame, *event->worl d()) : nullptr; 163 scriptState = event->world() ? ScriptState::forWorld(frame, *event->worl d()) : nullptr;
164 } 164 }
165 if (context->isMainThreadWorkletGlobalScope()) { 165 if (context->isMainThreadWorkletGlobalScope()) {
166 frame = toMainThreadWorkletGlobalScope(context)->frame(); 166 frame = toMainThreadWorkletGlobalScope(context)->frame();
167 scriptState = toMainThreadWorkletGlobalScope(context)->scriptController( )->getScriptState(); 167 scriptState = toMainThreadWorkletGlobalScope(context)->scriptController( )->getScriptState();
168 } 168 }
169 169
170 if (frame->host() && frame->host()->consoleMessageStorage().isMuted())
171 return;
172
173 const String16 defaultMessage = "Uncaught"; 170 const String16 defaultMessage = "Uncaught";
174 if (scriptState && scriptState->contextIsValid()) { 171 if (scriptState && scriptState->contextIsValid()) {
175 ScriptState::Scope scope(scriptState); 172 ScriptState::Scope scope(scriptState);
176 v8::Local<v8::Value> exception = V8ErrorHandler::loadExceptionFromErrorE ventWrapper(scriptState, event, scriptState->context()->Global()); 173 v8::Local<v8::Value> exception = V8ErrorHandler::loadExceptionFromErrorE ventWrapper(scriptState, event, scriptState->context()->Global());
177 SourceLocation* location = event->location(); 174 SourceLocation* location = event->location();
178 v8Inspector()->exceptionThrown(scriptState->context(), defaultMessage, e xception, event->messageForConsole(), location->url(), location->lineNumber(), l ocation->columnNumber(), location->cloneStackTrace(), location->scriptId()); 175 v8Inspector()->exceptionThrown(scriptState->context(), defaultMessage, e xception, event->messageForConsole(), location->url(), location->lineNumber(), l ocation->columnNumber(), location->cloneStackTrace(), location->scriptId());
179 } 176 }
180 177
181 // TODO(dgozman): do not wrap in ConsoleMessage. 178 // TODO(dgozman): do not wrap in ConsoleMessage.
182 frame->console().reportMessageToClient(ConsoleMessage::create(JSMessageSourc e, ErrorMessageLevel, event->messageForConsole(), event->location()->clone())); 179 frame->console().reportMessageToClient(ConsoleMessage::create(JSMessageSourc e, ErrorMessageLevel, event->messageForConsole(), event->location()->clone()));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 m_clientMessageLoop->run(pausedFrame); 218 m_clientMessageLoop->run(pausedFrame);
222 } 219 }
223 220
224 void MainThreadDebugger::quitMessageLoopOnPause() 221 void MainThreadDebugger::quitMessageLoopOnPause()
225 { 222 {
226 m_paused = false; 223 m_paused = false;
227 if (m_clientMessageLoop) 224 if (m_clientMessageLoop)
228 m_clientMessageLoop->quitNow(); 225 m_clientMessageLoop->quitNow();
229 } 226 }
230 227
231 void MainThreadDebugger::muteWarningsAndDeprecations(int contextGroupId) 228 void MainThreadDebugger::muteMetrics(int contextGroupId)
232 { 229 {
233 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); 230 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
234 if (frame && frame->host()) { 231 if (frame && frame->host()) {
235 frame->host()->consoleMessageStorage().mute();
236 frame->host()->useCounter().muteForInspector(); 232 frame->host()->useCounter().muteForInspector();
237 frame->host()->deprecation().muteForInspector(); 233 frame->host()->deprecation().muteForInspector();
238 } 234 }
239 } 235 }
240 236
241 void MainThreadDebugger::unmuteWarningsAndDeprecations(int contextGroupId) 237 void MainThreadDebugger::unmuteMetrics(int contextGroupId)
242 { 238 {
243 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); 239 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
244 if (frame && frame->host()) { 240 if (frame && frame->host()) {
245 frame->host()->consoleMessageStorage().unmute();
246 frame->host()->useCounter().unmuteForInspector(); 241 frame->host()->useCounter().unmuteForInspector();
247 frame->host()->deprecation().unmuteForInspector(); 242 frame->host()->deprecation().unmuteForInspector();
248 } 243 }
249 } 244 }
250 245
251 v8::Local<v8::Context> MainThreadDebugger::ensureDefaultContextInGroup(int conte xtGroupId) 246 v8::Local<v8::Context> MainThreadDebugger::ensureDefaultContextInGroup(int conte xtGroupId)
252 { 247 {
253 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); 248 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
254 ScriptState* scriptState = frame ? ScriptState::forMainWorld(frame) : nullpt r; 249 ScriptState* scriptState = frame ? ScriptState::forMainWorld(frame) : nullpt r;
255 return scriptState ? scriptState->context() : v8::Local<v8::Context>(); 250 return scriptState ? scriptState->context() : v8::Local<v8::Context>();
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 return; 385 return;
391 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get Isolate())).FromMaybe(false)) 386 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get Isolate())).FromMaybe(false))
392 return; 387 return;
393 } 388 }
394 info.GetReturnValue().Set(nodes); 389 info.GetReturnValue().Set(nodes);
395 } 390 }
396 exceptionState.throwIfNeeded(); 391 exceptionState.throwIfNeeded();
397 } 392 }
398 393
399 } // namespace blink 394 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698