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

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

Issue 2499273003: [inspector] introduced Script::TYPE_INSPECTOR (Closed)
Patch Set: rebased Created 4 years, 1 month 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
« no previous file with comments | « src/inspector/v8-inspector-impl.h ('k') | src/inspector/v8-runtime-agent-impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 function->Call(context, receiver, argc, info); 106 function->Call(context, receiver, argc, info);
107 // Get agent from the map again, since it could have detached during script 107 // Get agent from the map again, since it could have detached during script
108 // execution. 108 // execution.
109 if (V8DebuggerAgentImpl* agent = enabledDebuggerAgentForGroup(groupId)) 109 if (V8DebuggerAgentImpl* agent = enabledDebuggerAgentForGroup(groupId))
110 agent->didExecuteScript(); 110 agent->didExecuteScript();
111 return result; 111 return result;
112 } 112 }
113 113
114 v8::MaybeLocal<v8::Value> V8InspectorImpl::compileAndRunInternalScript( 114 v8::MaybeLocal<v8::Value> V8InspectorImpl::compileAndRunInternalScript(
115 v8::Local<v8::Context> context, v8::Local<v8::String> source) { 115 v8::Local<v8::Context> context, v8::Local<v8::String> source) {
116 v8::Local<v8::Script> script = 116 v8::Local<v8::UnboundScript> unboundScript;
117 compileScript(context, source, String16(), true); 117 if (!v8::DebugInterface::CompileInspectorScript(m_isolate, source)
118 if (script.IsEmpty()) return v8::MaybeLocal<v8::Value>(); 118 .ToLocal(&unboundScript))
119 return v8::MaybeLocal<v8::Value>();
119 v8::MicrotasksScope microtasksScope(m_isolate, 120 v8::MicrotasksScope microtasksScope(m_isolate,
120 v8::MicrotasksScope::kDoNotRunMicrotasks); 121 v8::MicrotasksScope::kDoNotRunMicrotasks);
121 return script->Run(context); 122 v8::Context::Scope contextScope(context);
123 return unboundScript->BindToCurrentContext()->Run(context);
122 } 124 }
123 125
124 v8::Local<v8::Script> V8InspectorImpl::compileScript( 126 v8::MaybeLocal<v8::Script> V8InspectorImpl::compileScript(
125 v8::Local<v8::Context> context, v8::Local<v8::String> code, 127 v8::Local<v8::Context> context, const String16& code,
126 const String16& fileName, bool markAsInternal) { 128 const String16& fileName) {
127 v8::ScriptOrigin origin( 129 v8::ScriptOrigin origin(
128 toV8String(m_isolate, fileName), v8::Integer::New(m_isolate, 0), 130 toV8String(m_isolate, fileName), v8::Integer::New(m_isolate, 0),
129 v8::Integer::New(m_isolate, 0), 131 v8::Integer::New(m_isolate, 0),
130 v8::False(m_isolate), // sharable 132 v8::False(m_isolate), // sharable
131 v8::Local<v8::Integer>(), 133 v8::Local<v8::Integer>(), v8::Boolean::New(m_isolate, false), // internal
132 v8::Boolean::New(m_isolate, markAsInternal), // internal 134 toV8String(m_isolate, String16()), // sourceMap
133 toV8String(m_isolate, String16()), // sourceMap 135 v8::True(m_isolate)); // opaqueresource
134 v8::True(m_isolate)); // opaqueresource 136 v8::ScriptCompiler::Source source(toV8String(m_isolate, code), origin);
135 v8::ScriptCompiler::Source source(code, origin); 137 return v8::ScriptCompiler::Compile(context, &source,
136 v8::Local<v8::Script> script; 138 v8::ScriptCompiler::kNoCompileOptions);
137 if (!v8::ScriptCompiler::Compile(context, &source,
138 v8::ScriptCompiler::kNoCompileOptions)
139 .ToLocal(&script))
140 return v8::Local<v8::Script>();
141 return script;
142 } 139 }
143 140
144 void V8InspectorImpl::enableStackCapturingIfNeeded() { 141 void V8InspectorImpl::enableStackCapturingIfNeeded() {
145 if (!m_capturingStackTracesCount) 142 if (!m_capturingStackTracesCount)
146 V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions(m_isolate, 143 V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions(m_isolate,
147 true); 144 true);
148 ++m_capturingStackTracesCount; 145 ++m_capturingStackTracesCount;
149 } 146 }
150 147
151 void V8InspectorImpl::disableStackCapturingIfNeeded() { 148 void V8InspectorImpl::disableStackCapturingIfNeeded() {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 365 }
369 366
370 V8InspectorSessionImpl* V8InspectorImpl::sessionForContextGroup( 367 V8InspectorSessionImpl* V8InspectorImpl::sessionForContextGroup(
371 int contextGroupId) { 368 int contextGroupId) {
372 if (!contextGroupId) return nullptr; 369 if (!contextGroupId) return nullptr;
373 SessionMap::iterator iter = m_sessions.find(contextGroupId); 370 SessionMap::iterator iter = m_sessions.find(contextGroupId);
374 return iter == m_sessions.end() ? nullptr : iter->second; 371 return iter == m_sessions.end() ? nullptr : iter->second;
375 } 372 }
376 373
377 } // namespace v8_inspector 374 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-inspector-impl.h ('k') | src/inspector/v8-runtime-agent-impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698