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

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

Issue 2748503002: [inspector] changed a way of preserving stepping between tasks (Closed)
Patch Set: removed willExecuteScript from tests Created 3 years, 9 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return agent && agent->enabled() ? agent : nullptr; 83 return agent && agent->enabled() ? agent : nullptr;
84 } 84 }
85 85
86 V8ProfilerAgentImpl* V8InspectorImpl::enabledProfilerAgentForGroup( 86 V8ProfilerAgentImpl* V8InspectorImpl::enabledProfilerAgentForGroup(
87 int contextGroupId) { 87 int contextGroupId) {
88 V8InspectorSessionImpl* session = sessionForContextGroup(contextGroupId); 88 V8InspectorSessionImpl* session = sessionForContextGroup(contextGroupId);
89 V8ProfilerAgentImpl* agent = session ? session->profilerAgent() : nullptr; 89 V8ProfilerAgentImpl* agent = session ? session->profilerAgent() : nullptr;
90 return agent && agent->enabled() ? agent : nullptr; 90 return agent && agent->enabled() ? agent : nullptr;
91 } 91 }
92 92
93 v8::MaybeLocal<v8::Value> V8InspectorImpl::runCompiledScript( 93 v8::MaybeLocal<v8::Value> V8InspectorImpl::runCompiledScript(
dgozman 2017/03/13 17:31:33 Remove this function now.
kozy 2017/03/14 01:30:14 Done.
94 v8::Local<v8::Context> context, v8::Local<v8::Script> script) { 94 v8::Local<v8::Context> context, v8::Local<v8::Script> script) {
95 v8::MicrotasksScope microtasksScope(m_isolate, 95 v8::MicrotasksScope microtasksScope(m_isolate,
96 v8::MicrotasksScope::kRunMicrotasks); 96 v8::MicrotasksScope::kRunMicrotasks);
97 int groupId = contextGroupId(context); 97 return script->Run(context);
98 if (V8DebuggerAgentImpl* agent = enabledDebuggerAgentForGroup(groupId))
99 agent->willExecuteScript(script->GetUnboundScript()->GetId());
100 v8::MaybeLocal<v8::Value> result = script->Run(context);
101 // Get agent from the map again, since it could have detached during script
102 // execution.
103 if (V8DebuggerAgentImpl* agent = enabledDebuggerAgentForGroup(groupId))
104 agent->didExecuteScript();
105 return result;
106 } 98 }
107 99
108 v8::MaybeLocal<v8::Value> V8InspectorImpl::callFunction( 100 v8::MaybeLocal<v8::Value> V8InspectorImpl::callFunction(
109 v8::Local<v8::Function> function, v8::Local<v8::Context> context, 101 v8::Local<v8::Function> function, v8::Local<v8::Context> context,
110 v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) { 102 v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) {
111 return callFunction(function, context, receiver, argc, info, 103 return callFunction(function, context, receiver, argc, info,
112 v8::MicrotasksScope::kRunMicrotasks); 104 v8::MicrotasksScope::kRunMicrotasks);
113 } 105 }
114 106
115 v8::MaybeLocal<v8::Value> V8InspectorImpl::callInternalFunction( 107 v8::MaybeLocal<v8::Value> V8InspectorImpl::callInternalFunction(
dgozman 2017/03/13 17:31:32 And maybe these as well?
kozy 2017/03/14 01:30:14 Done.
116 v8::Local<v8::Function> function, v8::Local<v8::Context> context, 108 v8::Local<v8::Function> function, v8::Local<v8::Context> context,
117 v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) { 109 v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) {
118 return callFunction(function, context, receiver, argc, info, 110 return callFunction(function, context, receiver, argc, info,
119 v8::MicrotasksScope::kDoNotRunMicrotasks); 111 v8::MicrotasksScope::kDoNotRunMicrotasks);
120 } 112 }
121 113
122 v8::MaybeLocal<v8::Value> V8InspectorImpl::callFunction( 114 v8::MaybeLocal<v8::Value> V8InspectorImpl::callFunction(
dgozman 2017/03/13 17:31:32 And this one.
kozy 2017/03/14 01:30:14 Done.
123 v8::Local<v8::Function> function, v8::Local<v8::Context> context, 115 v8::Local<v8::Function> function, v8::Local<v8::Context> context,
124 v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[], 116 v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[],
125 v8::MicrotasksScope::Type runMicrotasks) { 117 v8::MicrotasksScope::Type runMicrotasks) {
126 v8::MicrotasksScope microtasksScope(m_isolate, runMicrotasks); 118 v8::MicrotasksScope microtasksScope(m_isolate, runMicrotasks);
127 int groupId = contextGroupId(context); 119 return function->Call(context, receiver, argc, info);
128 if (V8DebuggerAgentImpl* agent = enabledDebuggerAgentForGroup(groupId))
129 agent->willExecuteScript(function->ScriptId());
130 v8::MaybeLocal<v8::Value> result =
131 function->Call(context, receiver, argc, info);
132 // Get agent from the map again, since it could have detached during script
133 // execution.
134 if (V8DebuggerAgentImpl* agent = enabledDebuggerAgentForGroup(groupId))
135 agent->didExecuteScript();
136 return result;
137 } 120 }
138 121
139 v8::MaybeLocal<v8::Value> V8InspectorImpl::compileAndRunInternalScript( 122 v8::MaybeLocal<v8::Value> V8InspectorImpl::compileAndRunInternalScript(
140 v8::Local<v8::Context> context, v8::Local<v8::String> source) { 123 v8::Local<v8::Context> context, v8::Local<v8::String> source) {
141 v8::Local<v8::UnboundScript> unboundScript; 124 v8::Local<v8::UnboundScript> unboundScript;
142 if (!v8::debug::CompileInspectorScript(m_isolate, source) 125 if (!v8::debug::CompileInspectorScript(m_isolate, source)
143 .ToLocal(&unboundScript)) 126 .ToLocal(&unboundScript))
144 return v8::MaybeLocal<v8::Value>(); 127 return v8::MaybeLocal<v8::Value>();
145 v8::MicrotasksScope microtasksScope(m_isolate, 128 v8::MicrotasksScope microtasksScope(m_isolate,
146 v8::MicrotasksScope::kDoNotRunMicrotasks); 129 v8::MicrotasksScope::kDoNotRunMicrotasks);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 m_consoleStorageMap.erase(contextGroupId); 263 m_consoleStorageMap.erase(contextGroupId);
281 m_muteExceptionsMap.erase(contextGroupId); 264 m_muteExceptionsMap.erase(contextGroupId);
282 SessionMap::iterator session = m_sessions.find(contextGroupId); 265 SessionMap::iterator session = m_sessions.find(contextGroupId);
283 if (session != m_sessions.end()) session->second->reset(); 266 if (session != m_sessions.end()) session->second->reset();
284 m_contexts.erase(contextGroupId); 267 m_contexts.erase(contextGroupId);
285 m_debugger->wasmTranslation()->Clear(); 268 m_debugger->wasmTranslation()->Clear();
286 } 269 }
287 270
288 void V8InspectorImpl::willExecuteScript(v8::Local<v8::Context> context, 271 void V8InspectorImpl::willExecuteScript(v8::Local<v8::Context> context,
289 int scriptId) { 272 int scriptId) {
290 if (V8DebuggerAgentImpl* agent =
291 enabledDebuggerAgentForGroup(contextGroupId(context))) {
292 agent->willExecuteScript(scriptId);
293 }
294 } 273 }
295 274
296 void V8InspectorImpl::didExecuteScript(v8::Local<v8::Context> context) { 275 void V8InspectorImpl::didExecuteScript(v8::Local<v8::Context> context) {
297 if (V8DebuggerAgentImpl* agent =
298 enabledDebuggerAgentForGroup(contextGroupId(context))) {
299 agent->didExecuteScript();
300 }
301 } 276 }
302 277
303 void V8InspectorImpl::idleStarted() { 278 void V8InspectorImpl::idleStarted() {
304 for (auto it = m_sessions.begin(); it != m_sessions.end(); ++it) { 279 for (auto it = m_sessions.begin(); it != m_sessions.end(); ++it) {
305 if (it->second->profilerAgent()->idleStarted()) return; 280 if (it->second->profilerAgent()->idleStarted()) return;
306 } 281 }
307 } 282 }
308 283
309 void V8InspectorImpl::idleFinished() { 284 void V8InspectorImpl::idleFinished() {
310 for (auto it = m_sessions.begin(); it != m_sessions.end(); ++it) { 285 for (auto it = m_sessions.begin(); it != m_sessions.end(); ++it) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 365 }
391 366
392 V8InspectorSessionImpl* V8InspectorImpl::sessionForContextGroup( 367 V8InspectorSessionImpl* V8InspectorImpl::sessionForContextGroup(
393 int contextGroupId) { 368 int contextGroupId) {
394 if (!contextGroupId) return nullptr; 369 if (!contextGroupId) return nullptr;
395 SessionMap::iterator iter = m_sessions.find(contextGroupId); 370 SessionMap::iterator iter = m_sessions.find(contextGroupId);
396 return iter == m_sessions.end() ? nullptr : iter->second; 371 return iter == m_sessions.end() ? nullptr : iter->second;
397 } 372 }
398 373
399 } // namespace v8_inspector 374 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698