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/V8Inspector.h" | |
7 | |
8 #include "platform/inspector_protocol/DispatcherBase.h" | |
9 #include "platform/v8_inspector/V8StringUtil.h" | |
10 #include "platform/v8_inspector/public/V8Debugger.h" | |
11 #include "platform/v8_inspector/public/V8DebuggerClient.h" | |
12 | |
13 namespace blink { | |
14 | |
15 V8Inspector::V8Inspector(v8::Isolate* isolate, v8::Local<v8::Context> context) | |
16 : m_context(context) | |
17 { | |
18 m_debugger = V8Debugger::create(isolate, this); | |
19 m_debugger->contextCreated(V8ContextInfo(context, 1, true, "", | |
20 "NodeJS Main Context", "", false)); | |
21 } | |
22 | |
23 V8Inspector::~V8Inspector() | |
24 { | |
25 disconnectFrontend(); | |
26 } | |
27 | |
28 String16 V8Inspector::valueSubtype(v8::Local<v8::Value> value) | |
29 { | |
30 return String16(); | |
31 } | |
32 | |
33 bool V8Inspector::formatAccessorsAsProperties(v8::Local<v8::Value> value) | |
34 { | |
35 return false; | |
36 } | |
37 | |
38 void V8Inspector::connectFrontend(protocol::FrontendChannel* channel) | |
39 { | |
40 m_session = m_debugger->connect(1, channel, this, &m_state); | |
41 } | |
42 | |
43 void V8Inspector::disconnectFrontend() | |
44 { | |
45 m_session.reset(); | |
46 } | |
47 | |
48 void V8Inspector::dispatchMessageFromFrontend(const String16& message) | |
49 { | |
50 if (m_session) | |
51 m_session->dispatchProtocolMessage(message); | |
52 } | |
53 | |
54 v8::Local<v8::Context> V8Inspector::ensureDefaultContextInGroup(int) | |
55 { | |
56 return m_context; | |
57 } | |
58 | |
59 bool V8Inspector::isExecutionAllowed() | |
60 { | |
61 return true; | |
62 } | |
63 | |
64 bool V8Inspector::canExecuteScripts() | |
65 { | |
66 return true; | |
67 } | |
68 | |
69 void V8Inspector::notifyContextDestroyed() | |
70 { | |
71 m_debugger->contextDestroyed(m_context); | |
72 } | |
73 | |
74 } // namespace blink | |
OLD | NEW |