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 10 matching lines...) Expand all Loading... |
21 m_contextId(contextId), | 21 m_contextId(contextId), |
22 m_contextGroupId(info.contextGroupId), | 22 m_contextGroupId(info.contextGroupId), |
23 m_origin(toString16(info.origin)), | 23 m_origin(toString16(info.origin)), |
24 m_humanReadableName(toString16(info.humanReadableName)), | 24 m_humanReadableName(toString16(info.humanReadableName)), |
25 m_auxData(toString16(info.auxData)), | 25 m_auxData(toString16(info.auxData)), |
26 m_reported(false) { | 26 m_reported(false) { |
27 v8::Isolate* isolate = m_inspector->isolate(); | 27 v8::Isolate* isolate = m_inspector->isolate(); |
28 info.context->SetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex), | 28 info.context->SetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex), |
29 v8::Int32::New(isolate, contextId)); | 29 v8::Int32::New(isolate, contextId)); |
30 v8::Local<v8::Object> global = info.context->Global(); | 30 v8::Local<v8::Object> global = info.context->Global(); |
31 v8::Local<v8::Object> console = V8Console::createConsole(this); | 31 v8::Local<v8::Object> console = |
| 32 m_inspector->console()->createConsole(info.context); |
32 if (info.hasMemoryOnConsole) { | 33 if (info.hasMemoryOnConsole) { |
33 V8Console::installMemoryGetter(m_inspector, info.context, console); | 34 m_inspector->console()->installMemoryGetter(info.context, console); |
34 } | 35 } |
35 if (!global | 36 if (!global |
36 ->Set(info.context, toV8StringInternalized(isolate, "console"), | 37 ->Set(info.context, toV8StringInternalized(isolate, "console"), |
37 console) | 38 console) |
38 .FromMaybe(false)) { | 39 .FromMaybe(false)) { |
39 return; | 40 return; |
40 } | 41 } |
41 } | 42 } |
42 | 43 |
43 InspectedContext::~InspectedContext() { | 44 InspectedContext::~InspectedContext() { |
(...skipping 20 matching lines...) Expand all Loading... |
64 std::unique_ptr<InjectedScript> injectedScript = InjectedScript::create(this); | 65 std::unique_ptr<InjectedScript> injectedScript = InjectedScript::create(this); |
65 // InjectedScript::create can destroy |this|. | 66 // InjectedScript::create can destroy |this|. |
66 if (!injectedScript) return false; | 67 if (!injectedScript) return false; |
67 m_injectedScript = std::move(injectedScript); | 68 m_injectedScript = std::move(injectedScript); |
68 return true; | 69 return true; |
69 } | 70 } |
70 | 71 |
71 void InspectedContext::discardInjectedScript() { m_injectedScript.reset(); } | 72 void InspectedContext::discardInjectedScript() { m_injectedScript.reset(); } |
72 | 73 |
73 } // namespace v8_inspector | 74 } // namespace v8_inspector |
OLD | NEW |