Commit 46a2b441 authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Inspector] Enter a new context when starting profiling.

We might have to collect source positions for existing functions when we
start profiling, and doing so requires a context to be entered in V8. Ensure
we always enter a context by creating a temporary context and entering it before
starting profiling.

BUG=chromium:992063

Change-Id: I72b259a3ad31b712b0475f7729fb4ffdab5cdd96
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1745481
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63149}
parent 28db9713
......@@ -502,6 +502,13 @@ void V8ProfilerAgentImpl::startProfiling(const String16& title) {
m_state->integerProperty(ProfilerAgentState::samplingInterval, 0);
if (interval) m_profiler->SetSamplingInterval(interval);
}
// Create a new temporary context and enter it while starting profiling
// since this might involve collecting source positions and requires a
// context.
// TODO(992063): Remove this once parsing / collecting source positions has
// been properly made context independent.
v8::Local<v8::Context> tmpContext = v8::Context::New(m_isolate);
v8::Context::Scope scope(tmpContext);
++m_startedProfilesCount;
m_profiler->StartProfiling(toV8String(m_isolate, title), true);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment