Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 41 m_humanReadableName(toString16(info.humanReadableName)), | 41 m_humanReadableName(toString16(info.humanReadableName)), |
| 42 m_auxData(toString16(info.auxData)), | 42 m_auxData(toString16(info.auxData)), |
| 43 m_reported(false) { | 43 m_reported(false) { |
| 44 m_context.SetWeak(&m_context, &clearContext, | 44 m_context.SetWeak(&m_context, &clearContext, |
| 45 v8::WeakCallbackType::kParameter); | 45 v8::WeakCallbackType::kParameter); |
| 46 | 46 |
| 47 v8::Isolate* isolate = m_inspector->isolate(); | 47 v8::Isolate* isolate = m_inspector->isolate(); |
| 48 v8::Local<v8::Object> global = info.context->Global(); | 48 v8::Local<v8::Object> global = info.context->Global(); |
| 49 v8::Local<v8::Object> console = | 49 v8::Local<v8::Object> console = |
| 50 V8Console::createConsole(this, info.hasMemoryOnConsole); | 50 V8Console::createConsole(this, info.hasMemoryOnConsole); |
| 51 v8::PropertyDescriptor descriptor(console, /* writable */ true); | |
| 52 descriptor.set_enumerable(false); | |
| 53 descriptor.set_configurable(true); | |
| 51 if (!global | 54 if (!global |
| 52 ->Set(info.context, toV8StringInternalized(isolate, "console"), | 55 ->DefineProperty(info.context, |
|
dgozman
2016/10/19 00:19:53
What is this formatting?
kozy
2016/10/19 00:54:36
Done.
| |
| 53 console) | 56 toV8StringInternalized(isolate, "console"), |
| 57 descriptor) | |
| 54 .FromMaybe(false)) | 58 .FromMaybe(false)) |
| 55 return; | 59 return; |
| 56 m_console.Reset(isolate, console); | 60 m_console.Reset(isolate, console); |
| 57 m_console.SetWeak(); | 61 m_console.SetWeak(); |
| 58 } | 62 } |
| 59 | 63 |
| 60 InspectedContext::~InspectedContext() { | 64 InspectedContext::~InspectedContext() { |
| 61 if (!m_console.IsEmpty()) { | 65 if (!m_console.IsEmpty()) { |
| 62 v8::HandleScope scope(isolate()); | 66 v8::HandleScope scope(isolate()); |
| 63 V8Console::clearInspectedContextIfNeeded(context(), | 67 V8Console::clearInspectedContextIfNeeded(context(), |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 74 } | 78 } |
| 75 | 79 |
| 76 void InspectedContext::createInjectedScript() { | 80 void InspectedContext::createInjectedScript() { |
| 77 DCHECK(!m_injectedScript); | 81 DCHECK(!m_injectedScript); |
| 78 m_injectedScript = InjectedScript::create(this); | 82 m_injectedScript = InjectedScript::create(this); |
| 79 } | 83 } |
| 80 | 84 |
| 81 void InspectedContext::discardInjectedScript() { m_injectedScript.reset(); } | 85 void InspectedContext::discardInjectedScript() { m_injectedScript.reset(); } |
| 82 | 86 |
| 83 } // namespace v8_inspector | 87 } // namespace v8_inspector |
| OLD | NEW |