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

Unified Diff: src/inspector/v8-inspector-session-impl.cc

Issue 2916803005: [inspector] Create InjectedScript per session in each context (Closed)
Patch Set: rebased Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/inspector/v8-console.cc ('k') | test/inspector/inspector-test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/v8-inspector-session-impl.cc
diff --git a/src/inspector/v8-inspector-session-impl.cc b/src/inspector/v8-inspector-session-impl.cc
index a2017a6d98d102578b44be1f860fdf25346272a2..f0bbc3b3c7a5392719120b33df4b4759a4ba179e 100644
--- a/src/inspector/v8-inspector-session-impl.cc
+++ b/src/inspector/v8-inspector-session-impl.cc
@@ -183,9 +183,11 @@ void V8InspectorSessionImpl::reset() {
void V8InspectorSessionImpl::discardInjectedScripts() {
m_inspectedObjects.clear();
- m_inspector->forEachContext(m_contextGroupId, [](InspectedContext* context) {
- context->discardInjectedScript();
- });
+ int sessionId = m_sessionId;
+ m_inspector->forEachContext(m_contextGroupId,
+ [&sessionId](InspectedContext* context) {
+ context->discardInjectedScript(sessionId);
+ });
}
Response V8InspectorSessionImpl::findInjectedScript(
@@ -194,13 +196,14 @@ Response V8InspectorSessionImpl::findInjectedScript(
InspectedContext* context =
m_inspector->getContext(m_contextGroupId, contextId);
if (!context) return Response::Error("Cannot find context with specified id");
- if (!context->getInjectedScript()) {
- if (!context->createInjectedScript())
+ injectedScript = context->getInjectedScript(m_sessionId);
+ if (!injectedScript) {
+ if (!context->createInjectedScript(m_sessionId))
return Response::Error("Cannot access specified execution context");
+ injectedScript = context->getInjectedScript(m_sessionId);
if (m_customObjectFormatterEnabled)
- context->getInjectedScript()->setCustomObjectFormatterEnabled(true);
+ injectedScript->setCustomObjectFormatterEnabled(true);
}
- injectedScript = context->getInjectedScript();
return Response::OK();
}
@@ -214,9 +217,10 @@ void V8InspectorSessionImpl::releaseObjectGroup(const StringView& objectGroup) {
}
void V8InspectorSessionImpl::releaseObjectGroup(const String16& objectGroup) {
+ int sessionId = m_sessionId;
m_inspector->forEachContext(
- m_contextGroupId, [&objectGroup](InspectedContext* context) {
- InjectedScript* injectedScript = context->getInjectedScript();
+ m_contextGroupId, [&objectGroup, &sessionId](InspectedContext* context) {
+ InjectedScript* injectedScript = context->getInjectedScript(sessionId);
if (injectedScript) injectedScript->releaseObjectGroup(objectGroup);
});
}
@@ -288,9 +292,10 @@ V8InspectorSessionImpl::wrapTable(v8::Local<v8::Context> context,
void V8InspectorSessionImpl::setCustomObjectFormatterEnabled(bool enabled) {
m_customObjectFormatterEnabled = enabled;
+ int sessionId = m_sessionId;
m_inspector->forEachContext(
- m_contextGroupId, [&enabled](InspectedContext* context) {
- InjectedScript* injectedScript = context->getInjectedScript();
+ m_contextGroupId, [&enabled, &sessionId](InspectedContext* context) {
+ InjectedScript* injectedScript = context->getInjectedScript(sessionId);
if (injectedScript)
injectedScript->setCustomObjectFormatterEnabled(enabled);
});
« no previous file with comments | « src/inspector/v8-console.cc ('k') | test/inspector/inspector-test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698