| OLD | NEW |
| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 | 68 |
| 69 v8::Local<v8::Context> InspectedContext::context() const { | 69 v8::Local<v8::Context> InspectedContext::context() const { |
| 70 return m_context.Get(isolate()); | 70 return m_context.Get(isolate()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 v8::Isolate* InspectedContext::isolate() const { | 73 v8::Isolate* InspectedContext::isolate() const { |
| 74 return m_inspector->isolate(); | 74 return m_inspector->isolate(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void InspectedContext::createInjectedScript() { | 77 bool InspectedContext::createInjectedScript() { |
| 78 DCHECK(!m_injectedScript); | 78 DCHECK(!m_injectedScript); |
| 79 m_injectedScript = InjectedScript::create(this); | 79 std::unique_ptr<InjectedScript> injectedScript = InjectedScript::create(this); |
| 80 // InjectedScript::create can destroy |this|. |
| 81 if (!injectedScript) return false; |
| 82 m_injectedScript = std::move(injectedScript); |
| 83 return true; |
| 80 } | 84 } |
| 81 | 85 |
| 82 void InspectedContext::discardInjectedScript() { m_injectedScript.reset(); } | 86 void InspectedContext::discardInjectedScript() { m_injectedScript.reset(); } |
| 83 | 87 |
| 84 } // namespace v8_inspector | 88 } // namespace v8_inspector |
| OLD | NEW |