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

Unified Diff: src/inspector/inspected-context.cc

Issue 2432163004: Avoid using stale InspectedContext pointers (Closed)
Patch Set: Fix nits Created 4 years, 2 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/inspected-context.h ('k') | src/inspector/v8-inspector-session-impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/inspected-context.cc
diff --git a/src/inspector/inspected-context.cc b/src/inspector/inspected-context.cc
index 1b5081ff334ac6be926a6fc0fe29a58e4342a358..82b5a1b5b4e25e5c6bc4f034da8fd8f80939b1db 100644
--- a/src/inspector/inspected-context.cc
+++ b/src/inspector/inspected-context.cc
@@ -75,9 +75,13 @@ v8::Isolate* InspectedContext::isolate() const {
return m_inspector->isolate();
}
-void InspectedContext::createInjectedScript() {
+bool InspectedContext::createInjectedScript() {
DCHECK(!m_injectedScript);
- m_injectedScript = InjectedScript::create(this);
+ std::unique_ptr<InjectedScript> injectedScript = InjectedScript::create(this);
+ // InjectedScript::create can destroy |this|.
+ if (!injectedScript) return false;
+ m_injectedScript = std::move(injectedScript);
+ return true;
}
void InspectedContext::discardInjectedScript() { m_injectedScript.reset(); }
« no previous file with comments | « src/inspector/inspected-context.h ('k') | src/inspector/v8-inspector-session-impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698