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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/inspector/inspected-context.h" 5 #include "src/inspector/inspected-context.h"
6 6
7 #include "src/inspector/injected-script.h" 7 #include "src/inspector/injected-script.h"
8 #include "src/inspector/string-util.h" 8 #include "src/inspector/string-util.h"
9 #include "src/inspector/v8-console.h" 9 #include "src/inspector/v8-console.h"
10 #include "src/inspector/v8-inspector-impl.h" 10 #include "src/inspector/v8-inspector-impl.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 v8::Local<v8::Context> InspectedContext::context() const { 70 v8::Local<v8::Context> InspectedContext::context() const {
71 return m_context.Get(isolate()); 71 return m_context.Get(isolate());
72 } 72 }
73 73
74 v8::Isolate* InspectedContext::isolate() const { 74 v8::Isolate* InspectedContext::isolate() const {
75 return m_inspector->isolate(); 75 return m_inspector->isolate();
76 } 76 }
77 77
78 void InspectedContext::createInjectedScript() { 78 bool InspectedContext::createInjectedScript() {
79 DCHECK(!m_injectedScript); 79 DCHECK(!m_injectedScript);
80 m_injectedScript = InjectedScript::create(this); 80 std::unique_ptr<InjectedScript> injectedScript = InjectedScript::create(this);
81 // InjectedScript::create can destroy |this|.
82 if (!injectedScript) return false;
83 m_injectedScript = std::move(injectedScript);
84 return true;
81 } 85 }
82 86
83 void InspectedContext::discardInjectedScript() { m_injectedScript.reset(); } 87 void InspectedContext::discardInjectedScript() { m_injectedScript.reset(); }
84 88
85 } // namespace v8_inspector 89 } // namespace v8_inspector
OLDNEW
« 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