Commit fba8c5ec authored by Andrey Lushnikov's avatar Andrey Lushnikov Committed by Commit Bot

inspector: introduce V8Inspector::contextById(contextId)

This is a pre-requisite for https://chromium-review.googlesource.com/c/chromium/src/+/1134430

R=kozy

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: Ic437eaffd0870e1ce6b16e4992e9232515e091ec
Reviewed-on: https://chromium-review.googlesource.com/1173718Reviewed-by: 's avatarPavel Feldman <pfeldman@chromium.org>
Reviewed-by: 's avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Commit-Queue: Andrey Lushnikov <lushnikov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55131}
parent 521e8464
......@@ -245,6 +245,7 @@ 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;
// Various instrumentation.
virtual void idleStarted() = 0;
......
......@@ -188,6 +188,11 @@ InspectedContext* V8InspectorImpl::getContext(int contextId) const {
return getContext(contextGroupId(contextId), contextId);
}
v8::MaybeLocal<v8::Context> V8InspectorImpl::contextById(int contextId) {
InspectedContext* context = getContext(contextId);
return context ? context->context() : v8::MaybeLocal<v8::Context>();
}
void V8InspectorImpl::contextCreated(const V8ContextInfo& info) {
int contextId = ++m_lastContextId;
InspectedContext* context = new InspectedContext(this, info, contextId);
......
......@@ -78,6 +78,7 @@ 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;
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