Commit 22cb8d45 authored by Andrey Lushnikov's avatar Andrey Lushnikov Committed by Commit Bot

inspector: teach v8Inspector to return default context

This is a follow-up to https://chromium-review.googlesource.com/c/v8/v8/+/1173718

R=kozy, pfeldman
TBR=pfeldman

Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I48b4ca5589505d03773477623654fa54703f0714
Reviewed-on: https://chromium-review.googlesource.com/1175061
Commit-Queue: Andrey Lushnikov <lushnikov@chromium.org>
Reviewed-by: 's avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55133}
parent 14170c67
......@@ -245,7 +245,8 @@ class V8_EXPORT V8Inspector {
virtual void contextCreated(const V8ContextInfo&) = 0;
virtual void contextDestroyed(v8::Local<v8::Context>) = 0;
virtual void resetContextGroup(int contextGroupId) = 0;
virtual v8::MaybeLocal<v8::Context> contextById(int contextId) = 0;
virtual v8::MaybeLocal<v8::Context> contextById(int groupId,
v8::Maybe<int> contextId) = 0;
// Various instrumentation.
virtual void idleStarted() = 0;
......
......@@ -188,8 +188,14 @@ InspectedContext* V8InspectorImpl::getContext(int contextId) const {
return getContext(contextGroupId(contextId), contextId);
}
v8::MaybeLocal<v8::Context> V8InspectorImpl::contextById(int contextId) {
InspectedContext* context = getContext(contextId);
v8::MaybeLocal<v8::Context> V8InspectorImpl::contextById(
int groupId, v8::Maybe<int> contextId) {
if (contextId.IsNothing()) {
v8::Local<v8::Context> context =
client()->ensureDefaultContextInGroup(groupId);
return context.IsEmpty() ? v8::MaybeLocal<v8::Context>() : context;
}
InspectedContext* context = getContext(contextId.FromJust());
return context ? context->context() : v8::MaybeLocal<v8::Context>();
}
......
......@@ -78,7 +78,8 @@ class V8InspectorImpl : public V8Inspector {
const StringView& state) override;
void contextCreated(const V8ContextInfo&) override;
void contextDestroyed(v8::Local<v8::Context>) override;
v8::MaybeLocal<v8::Context> contextById(int contextId) override;
v8::MaybeLocal<v8::Context> contextById(int groupId,
v8::Maybe<int> contextId) override;
void contextCollected(int contextGroupId, int contextId);
void resetContextGroup(int contextGroupId) override;
void idleStarted() override;
......
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