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

Side by Side Diff: src/inspector/v8-inspector-impl.cc

Issue 2523743003: Roll third_party/inspector_protocol to 73028acaa3646789fd2a3bfd0d79eb2d91b696b3 (Closed)
Patch Set: addressed comments Created 4 years 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 27 matching lines...) Expand all
38 #include "src/inspector/v8-debugger.h" 38 #include "src/inspector/v8-debugger.h"
39 #include "src/inspector/v8-inspector-session-impl.h" 39 #include "src/inspector/v8-inspector-session-impl.h"
40 #include "src/inspector/v8-profiler-agent-impl.h" 40 #include "src/inspector/v8-profiler-agent-impl.h"
41 #include "src/inspector/v8-runtime-agent-impl.h" 41 #include "src/inspector/v8-runtime-agent-impl.h"
42 #include "src/inspector/v8-stack-trace-impl.h" 42 #include "src/inspector/v8-stack-trace-impl.h"
43 43
44 namespace v8_inspector { 44 namespace v8_inspector {
45 45
46 std::unique_ptr<V8Inspector> V8Inspector::create(v8::Isolate* isolate, 46 std::unique_ptr<V8Inspector> V8Inspector::create(v8::Isolate* isolate,
47 V8InspectorClient* client) { 47 V8InspectorClient* client) {
48 return wrapUnique(new V8InspectorImpl(isolate, client)); 48 return std::unique_ptr<V8Inspector>(new V8InspectorImpl(isolate, client));
49 } 49 }
50 50
51 V8InspectorImpl::V8InspectorImpl(v8::Isolate* isolate, 51 V8InspectorImpl::V8InspectorImpl(v8::Isolate* isolate,
52 V8InspectorClient* client) 52 V8InspectorClient* client)
53 : m_isolate(isolate), 53 : m_isolate(isolate),
54 m_client(client), 54 m_client(client),
55 m_debugger(new V8Debugger(isolate, this)), 55 m_debugger(new V8Debugger(isolate, this)),
56 m_capturingStackTracesCount(0), 56 m_capturingStackTracesCount(0),
57 m_lastExceptionId(0) {} 57 m_lastExceptionId(0) {}
58 58
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 void V8InspectorImpl::unmuteExceptions(int contextGroupId) { 157 void V8InspectorImpl::unmuteExceptions(int contextGroupId) {
158 m_muteExceptionsMap[contextGroupId]--; 158 m_muteExceptionsMap[contextGroupId]--;
159 } 159 }
160 160
161 V8ConsoleMessageStorage* V8InspectorImpl::ensureConsoleMessageStorage( 161 V8ConsoleMessageStorage* V8InspectorImpl::ensureConsoleMessageStorage(
162 int contextGroupId) { 162 int contextGroupId) {
163 ConsoleStorageMap::iterator storageIt = 163 ConsoleStorageMap::iterator storageIt =
164 m_consoleStorageMap.find(contextGroupId); 164 m_consoleStorageMap.find(contextGroupId);
165 if (storageIt == m_consoleStorageMap.end()) 165 if (storageIt == m_consoleStorageMap.end())
166 storageIt = 166 storageIt = m_consoleStorageMap
167 m_consoleStorageMap 167 .insert(std::make_pair(
168 .insert(std::make_pair( 168 contextGroupId,
169 contextGroupId, 169 std::unique_ptr<V8ConsoleMessageStorage>(
170 wrapUnique(new V8ConsoleMessageStorage(this, contextGroupId)))) 170 new V8ConsoleMessageStorage(this, contextGroupId))))
171 .first; 171 .first;
172 return storageIt->second.get(); 172 return storageIt->second.get();
173 } 173 }
174 174
175 bool V8InspectorImpl::hasConsoleMessageStorage(int contextGroupId) { 175 bool V8InspectorImpl::hasConsoleMessageStorage(int contextGroupId) {
176 ConsoleStorageMap::iterator storageIt = 176 ConsoleStorageMap::iterator storageIt =
177 m_consoleStorageMap.find(contextGroupId); 177 m_consoleStorageMap.find(contextGroupId);
178 return storageIt != m_consoleStorageMap.end(); 178 return storageIt != m_consoleStorageMap.end();
179 } 179 }
180 180
181 std::unique_ptr<V8StackTrace> V8InspectorImpl::createStackTrace( 181 std::unique_ptr<V8StackTrace> V8InspectorImpl::createStackTrace(
(...skipping 28 matching lines...) Expand all
210 210
211 return contextIt->second.get(); 211 return contextIt->second.get();
212 } 212 }
213 213
214 void V8InspectorImpl::contextCreated(const V8ContextInfo& info) { 214 void V8InspectorImpl::contextCreated(const V8ContextInfo& info) {
215 int contextId = m_debugger->markContext(info); 215 int contextId = m_debugger->markContext(info);
216 216
217 ContextsByGroupMap::iterator contextIt = m_contexts.find(info.contextGroupId); 217 ContextsByGroupMap::iterator contextIt = m_contexts.find(info.contextGroupId);
218 if (contextIt == m_contexts.end()) 218 if (contextIt == m_contexts.end())
219 contextIt = m_contexts 219 contextIt = m_contexts
220 .insert(std::make_pair(info.contextGroupId, 220 .insert(std::make_pair(
221 wrapUnique(new ContextByIdMap()))) 221 info.contextGroupId,
222 std::unique_ptr<ContextByIdMap>(new ContextByIdMap())))
222 .first; 223 .first;
223 224
224 const auto& contextById = contextIt->second; 225 const auto& contextById = contextIt->second;
225 226
226 DCHECK(contextById->find(contextId) == contextById->cend()); 227 DCHECK(contextById->find(contextId) == contextById->cend());
227 InspectedContext* context = new InspectedContext(this, info, contextId); 228 InspectedContext* context = new InspectedContext(this, info, contextId);
228 (*contextById)[contextId] = wrapUnique(context); 229 (*contextById)[contextId].reset(context);
229 SessionMap::iterator sessionIt = m_sessions.find(info.contextGroupId); 230 SessionMap::iterator sessionIt = m_sessions.find(info.contextGroupId);
230 if (sessionIt != m_sessions.end()) 231 if (sessionIt != m_sessions.end())
231 sessionIt->second->runtimeAgent()->reportExecutionContextCreated(context); 232 sessionIt->second->runtimeAgent()->reportExecutionContextCreated(context);
232 } 233 }
233 234
234 void V8InspectorImpl::contextDestroyed(v8::Local<v8::Context> context) { 235 void V8InspectorImpl::contextDestroyed(v8::Local<v8::Context> context) {
235 int contextId = V8Debugger::contextId(context); 236 int contextId = V8Debugger::contextId(context);
236 int contextGroupId = V8Debugger::getGroupId(context); 237 int contextGroupId = V8Debugger::getGroupId(context);
237 238
238 ConsoleStorageMap::iterator storageIt = 239 ConsoleStorageMap::iterator storageIt =
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 285 }
285 } 286 }
286 287
287 unsigned V8InspectorImpl::exceptionThrown( 288 unsigned V8InspectorImpl::exceptionThrown(
288 v8::Local<v8::Context> context, const StringView& message, 289 v8::Local<v8::Context> context, const StringView& message,
289 v8::Local<v8::Value> exception, const StringView& detailedMessage, 290 v8::Local<v8::Value> exception, const StringView& detailedMessage,
290 const StringView& url, unsigned lineNumber, unsigned columnNumber, 291 const StringView& url, unsigned lineNumber, unsigned columnNumber,
291 std::unique_ptr<V8StackTrace> stackTrace, int scriptId) { 292 std::unique_ptr<V8StackTrace> stackTrace, int scriptId) {
292 int contextGroupId = V8Debugger::getGroupId(context); 293 int contextGroupId = V8Debugger::getGroupId(context);
293 if (!contextGroupId || m_muteExceptionsMap[contextGroupId]) return 0; 294 if (!contextGroupId || m_muteExceptionsMap[contextGroupId]) return 0;
294 std::unique_ptr<V8StackTraceImpl> stackTraceImpl = 295 std::unique_ptr<V8StackTraceImpl> stackTraceImpl(
295 wrapUnique(static_cast<V8StackTraceImpl*>(stackTrace.release())); 296 static_cast<V8StackTraceImpl*>(stackTrace.release()));
296 unsigned exceptionId = nextExceptionId(); 297 unsigned exceptionId = nextExceptionId();
297 std::unique_ptr<V8ConsoleMessage> consoleMessage = 298 std::unique_ptr<V8ConsoleMessage> consoleMessage =
298 V8ConsoleMessage::createForException( 299 V8ConsoleMessage::createForException(
299 m_client->currentTimeMS(), toString16(detailedMessage), 300 m_client->currentTimeMS(), toString16(detailedMessage),
300 toString16(url), lineNumber, columnNumber, std::move(stackTraceImpl), 301 toString16(url), lineNumber, columnNumber, std::move(stackTraceImpl),
301 scriptId, m_isolate, toString16(message), 302 scriptId, m_isolate, toString16(message),
302 V8Debugger::contextId(context), exception, exceptionId); 303 V8Debugger::contextId(context), exception, exceptionId);
303 ensureConsoleMessageStorage(contextGroupId) 304 ensureConsoleMessageStorage(contextGroupId)
304 ->addMessage(std::move(consoleMessage)); 305 ->addMessage(std::move(consoleMessage));
305 return exceptionId; 306 return exceptionId;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 365 }
365 366
366 V8InspectorSessionImpl* V8InspectorImpl::sessionForContextGroup( 367 V8InspectorSessionImpl* V8InspectorImpl::sessionForContextGroup(
367 int contextGroupId) { 368 int contextGroupId) {
368 if (!contextGroupId) return nullptr; 369 if (!contextGroupId) return nullptr;
369 SessionMap::iterator iter = m_sessions.find(contextGroupId); 370 SessionMap::iterator iter = m_sessions.find(contextGroupId);
370 return iter == m_sessions.end() ? nullptr : iter->second; 371 return iter == m_sessions.end() ? nullptr : iter->second;
371 } 372 }
372 373
373 } // namespace v8_inspector 374 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-heap-profiler-agent-impl.cc ('k') | src/inspector/v8-inspector-session-impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698