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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8InspectorImpl.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) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (c) 2010-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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions(m_isolate, t rue); 144 V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions(m_isolate, t rue);
145 ++m_capturingStackTracesCount; 145 ++m_capturingStackTracesCount;
146 } 146 }
147 147
148 void V8InspectorImpl::disableStackCapturingIfNeeded() 148 void V8InspectorImpl::disableStackCapturingIfNeeded()
149 { 149 {
150 if (!(--m_capturingStackTracesCount)) 150 if (!(--m_capturingStackTracesCount))
151 V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions(m_isolate, f alse); 151 V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions(m_isolate, f alse);
152 } 152 }
153 153
154 void V8InspectorImpl::muteExceptions(int contextGroupId)
155 {
156 m_muteExceptionsMap[contextGroupId]++;
157 }
158
159 void V8InspectorImpl::unmuteExceptions(int contextGroupId)
160 {
161 m_muteExceptionsMap[contextGroupId]--;
162 }
163
154 V8ConsoleMessageStorage* V8InspectorImpl::ensureConsoleMessageStorage(int contex tGroupId) 164 V8ConsoleMessageStorage* V8InspectorImpl::ensureConsoleMessageStorage(int contex tGroupId)
155 { 165 {
156 ConsoleStorageMap::iterator storageIt = m_consoleStorageMap.find(contextGrou pId); 166 ConsoleStorageMap::iterator storageIt = m_consoleStorageMap.find(contextGrou pId);
157 if (storageIt == m_consoleStorageMap.end()) 167 if (storageIt == m_consoleStorageMap.end())
158 storageIt = m_consoleStorageMap.insert(std::make_pair(contextGroupId, wr apUnique(new V8ConsoleMessageStorage(this, contextGroupId)))).first; 168 storageIt = m_consoleStorageMap.insert(std::make_pair(contextGroupId, wr apUnique(new V8ConsoleMessageStorage(this, contextGroupId)))).first;
159 return storageIt->second.get(); 169 return storageIt->second.get();
160 } 170 }
161 171
162 std::unique_ptr<V8StackTrace> V8InspectorImpl::createStackTrace(v8::Local<v8::St ackTrace> stackTrace) 172 std::unique_ptr<V8StackTrace> V8InspectorImpl::createStackTrace(v8::Local<v8::St ackTrace> stackTrace)
163 { 173 {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 234
225 SessionMap::iterator iter = m_sessions.find(contextGroupId); 235 SessionMap::iterator iter = m_sessions.find(contextGroupId);
226 if (iter != m_sessions.end()) 236 if (iter != m_sessions.end())
227 iter->second->runtimeAgent()->reportExecutionContextDestroyed(inspectedC ontext); 237 iter->second->runtimeAgent()->reportExecutionContextDestroyed(inspectedC ontext);
228 discardInspectedContext(contextGroupId, contextId); 238 discardInspectedContext(contextGroupId, contextId);
229 } 239 }
230 240
231 void V8InspectorImpl::resetContextGroup(int contextGroupId) 241 void V8InspectorImpl::resetContextGroup(int contextGroupId)
232 { 242 {
233 m_consoleStorageMap.erase(contextGroupId); 243 m_consoleStorageMap.erase(contextGroupId);
244 m_muteExceptionsMap.erase(contextGroupId);
234 SessionMap::iterator session = m_sessions.find(contextGroupId); 245 SessionMap::iterator session = m_sessions.find(contextGroupId);
235 if (session != m_sessions.end()) 246 if (session != m_sessions.end())
236 session->second->reset(); 247 session->second->reset();
237 m_contexts.erase(contextGroupId); 248 m_contexts.erase(contextGroupId);
238 } 249 }
239 250
240 void V8InspectorImpl::willExecuteScript(v8::Local<v8::Context> context, int scri ptId) 251 void V8InspectorImpl::willExecuteScript(v8::Local<v8::Context> context, int scri ptId)
241 { 252 {
242 if (V8DebuggerAgentImpl* agent = enabledDebuggerAgentForGroup(V8Debugger::ge tGroupId(context))) 253 if (V8DebuggerAgentImpl* agent = enabledDebuggerAgentForGroup(V8Debugger::ge tGroupId(context)))
243 agent->willExecuteScript(scriptId); 254 agent->willExecuteScript(scriptId);
(...skipping 11 matching lines...) Expand all
255 } 266 }
256 267
257 void V8InspectorImpl::idleFinished() 268 void V8InspectorImpl::idleFinished()
258 { 269 {
259 m_isolate->GetCpuProfiler()->SetIdle(false); 270 m_isolate->GetCpuProfiler()->SetIdle(false);
260 } 271 }
261 272
262 unsigned V8InspectorImpl::exceptionThrown(v8::Local<v8::Context> context, const String16& message, v8::Local<v8::Value> exception, const String16& detailedMessa ge, const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique _ptr<V8StackTrace> stackTrace, int scriptId) 273 unsigned V8InspectorImpl::exceptionThrown(v8::Local<v8::Context> context, const String16& message, v8::Local<v8::Value> exception, const String16& detailedMessa ge, const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique _ptr<V8StackTrace> stackTrace, int scriptId)
263 { 274 {
264 int contextGroupId = V8Debugger::getGroupId(context); 275 int contextGroupId = V8Debugger::getGroupId(context);
265 if (!contextGroupId) 276 if (!contextGroupId || m_muteExceptionsMap[contextGroupId])
266 return 0; 277 return 0;
267 std::unique_ptr<V8StackTraceImpl> stackTraceImpl = wrapUnique(static_cast<V8 StackTraceImpl*>(stackTrace.release())); 278 std::unique_ptr<V8StackTraceImpl> stackTraceImpl = wrapUnique(static_cast<V8 StackTraceImpl*>(stackTrace.release()));
268 unsigned exceptionId = ++m_lastExceptionId; 279 unsigned exceptionId = ++m_lastExceptionId;
269 std::unique_ptr<V8ConsoleMessage> consoleMessage = V8ConsoleMessage::createF orException(m_client->currentTimeMS(), detailedMessage, url, lineNumber, columnN umber, std::move(stackTraceImpl), scriptId, m_isolate, message, V8Debugger::cont extId(context), exception, exceptionId); 280 std::unique_ptr<V8ConsoleMessage> consoleMessage = V8ConsoleMessage::createF orException(m_client->currentTimeMS(), detailedMessage, url, lineNumber, columnN umber, std::move(stackTraceImpl), scriptId, m_isolate, message, V8Debugger::cont extId(context), exception, exceptionId);
270 ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMes sage)); 281 ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMes sage));
271 return exceptionId; 282 return exceptionId;
272 } 283 }
273 284
274 void V8InspectorImpl::exceptionRevoked(v8::Local<v8::Context> context, unsigned exceptionId, const String16& message) 285 void V8InspectorImpl::exceptionRevoked(v8::Local<v8::Context> context, unsigned exceptionId, const String16& message)
275 { 286 {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 346
336 V8InspectorSessionImpl* V8InspectorImpl::sessionForContextGroup(int contextGroup Id) 347 V8InspectorSessionImpl* V8InspectorImpl::sessionForContextGroup(int contextGroup Id)
337 { 348 {
338 if (!contextGroupId) 349 if (!contextGroupId)
339 return nullptr; 350 return nullptr;
340 SessionMap::iterator iter = m_sessions.find(contextGroupId); 351 SessionMap::iterator iter = m_sessions.find(contextGroupId);
341 return iter == m_sessions.end() ? nullptr : iter->second; 352 return iter == m_sessions.end() ? nullptr : iter->second;
342 } 353 }
343 354
344 } // namespace blink 355 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698