OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 |
| 6 #include "platform/v8_inspector/public/SimpleInspector.h" |
| 7 |
| 8 #include "platform/inspector_protocol/DispatcherBase.h" |
| 9 #include "platform/v8_inspector/V8StringUtil.h" |
| 10 #include "platform/v8_inspector/public/V8Inspector.h" |
| 11 #include "platform/v8_inspector/public/V8InspectorClient.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 SimpleInspector::SimpleInspector(v8::Isolate* isolate, v8::Local<v8::Context> co
ntext) |
| 16 : m_context(context) |
| 17 { |
| 18 m_inspector = V8Inspector::create(isolate, this); |
| 19 m_inspector->contextCreated(V8ContextInfo(context, 1, true, "", |
| 20 "NodeJS Main Context", "", false)); |
| 21 } |
| 22 |
| 23 SimpleInspector::~SimpleInspector() |
| 24 { |
| 25 disconnectFrontend(); |
| 26 } |
| 27 |
| 28 String16 SimpleInspector::valueSubtype(v8::Local<v8::Value> value) |
| 29 { |
| 30 return String16(); |
| 31 } |
| 32 |
| 33 bool SimpleInspector::formatAccessorsAsProperties(v8::Local<v8::Value> value) |
| 34 { |
| 35 return false; |
| 36 } |
| 37 |
| 38 void SimpleInspector::connectFrontend(protocol::FrontendChannel* channel) |
| 39 { |
| 40 m_session = m_inspector->connect(1, channel, this, &m_state); |
| 41 } |
| 42 |
| 43 void SimpleInspector::disconnectFrontend() |
| 44 { |
| 45 m_session.reset(); |
| 46 } |
| 47 |
| 48 void SimpleInspector::dispatchMessageFromFrontend(const String16& message) |
| 49 { |
| 50 if (m_session) |
| 51 m_session->dispatchProtocolMessage(message); |
| 52 } |
| 53 |
| 54 v8::Local<v8::Context> SimpleInspector::ensureDefaultContextInGroup(int) |
| 55 { |
| 56 return m_context; |
| 57 } |
| 58 |
| 59 bool SimpleInspector::isExecutionAllowed() |
| 60 { |
| 61 return true; |
| 62 } |
| 63 |
| 64 bool SimpleInspector::canExecuteScripts() |
| 65 { |
| 66 return true; |
| 67 } |
| 68 |
| 69 void SimpleInspector::notifyContextDestroyed() |
| 70 { |
| 71 m_inspector->contextDestroyed(m_context); |
| 72 } |
| 73 |
| 74 } // namespace blink |
OLD | NEW |