OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class InjectedScriptManager; | 40 class InjectedScriptManager; |
41 class V8DebuggerImpl; | 41 class V8DebuggerImpl; |
42 | 42 |
43 namespace protocol { | 43 namespace protocol { |
44 class DictionaryValue; | 44 class DictionaryValue; |
45 } | 45 } |
46 | 46 |
47 typedef String ErrorString; | |
48 | |
49 using protocol::Maybe; | 47 using protocol::Maybe; |
50 | 48 |
51 class V8RuntimeAgentImpl : public V8RuntimeAgent { | 49 class V8RuntimeAgentImpl : public V8RuntimeAgent { |
52 PROTOCOL_DISALLOW_COPY(V8RuntimeAgentImpl); | 50 PROTOCOL_DISALLOW_COPY(V8RuntimeAgentImpl); |
53 public: | 51 public: |
54 V8RuntimeAgentImpl(V8DebuggerImpl*, Client*); | 52 V8RuntimeAgentImpl(V8DebuggerImpl*, Client*); |
55 ~V8RuntimeAgentImpl() override; | 53 ~V8RuntimeAgentImpl() override; |
56 | 54 |
57 // State management methods. | 55 // State management methods. |
58 void setInspectorState(protocol::DictionaryValue*) override; | 56 void setInspectorState(protocol::DictionaryValue*) override; |
59 void setFrontend(protocol::Frontend::Runtime*) override; | 57 void setFrontend(protocol::Frontend::Runtime*) override; |
60 void clearFrontend() override; | 58 void clearFrontend() override; |
61 void restore() override; | 59 void restore() override; |
62 | 60 |
63 // Part of the protocol. | 61 // Part of the protocol. |
64 void enable(ErrorString*) override; | 62 void enable(ErrorString*) override; |
65 void disable(ErrorString*) override; | 63 void disable(ErrorString*) override; |
66 void evaluate(ErrorString*, | 64 void evaluate(ErrorString*, |
67 const String& expression, | 65 const String16& expression, |
68 const Maybe<String>& objectGroup, | 66 const Maybe<String16>& objectGroup, |
69 const Maybe<bool>& includeCommandLineAPI, | 67 const Maybe<bool>& includeCommandLineAPI, |
70 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, | 68 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, |
71 const Maybe<int>& executionContextId, | 69 const Maybe<int>& executionContextId, |
72 const Maybe<bool>& returnByValue, | 70 const Maybe<bool>& returnByValue, |
73 const Maybe<bool>& generatePreview, | 71 const Maybe<bool>& generatePreview, |
74 OwnPtr<protocol::Runtime::RemoteObject>* result, | 72 OwnPtr<protocol::Runtime::RemoteObject>* result, |
75 Maybe<bool>* wasThrown, | 73 Maybe<bool>* wasThrown, |
76 Maybe<protocol::Runtime::ExceptionDetails>*) override; | 74 Maybe<protocol::Runtime::ExceptionDetails>*) override; |
77 void callFunctionOn(ErrorString*, | 75 void callFunctionOn(ErrorString*, |
78 const String& objectId, | 76 const String16& objectId, |
79 const String& expression, | 77 const String16& expression, |
80 const Maybe<protocol::Array<protocol::Runtime::CallArgument>>& optionalA
rguments, | 78 const Maybe<protocol::Array<protocol::Runtime::CallArgument>>& optionalA
rguments, |
81 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, | 79 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, |
82 const Maybe<bool>& returnByValue, | 80 const Maybe<bool>& returnByValue, |
83 const Maybe<bool>& generatePreview, | 81 const Maybe<bool>& generatePreview, |
84 OwnPtr<protocol::Runtime::RemoteObject>* result, | 82 OwnPtr<protocol::Runtime::RemoteObject>* result, |
85 Maybe<bool>* wasThrown) override; | 83 Maybe<bool>* wasThrown) override; |
86 void releaseObject(ErrorString*, const String& objectId) override; | 84 void releaseObject(ErrorString*, const String16& objectId) override; |
87 void getProperties(ErrorString*, | 85 void getProperties(ErrorString*, |
88 const String& objectId, | 86 const String16& objectId, |
89 const Maybe<bool>& ownProperties, | 87 const Maybe<bool>& ownProperties, |
90 const Maybe<bool>& accessorPropertiesOnly, | 88 const Maybe<bool>& accessorPropertiesOnly, |
91 const Maybe<bool>& generatePreview, | 89 const Maybe<bool>& generatePreview, |
92 OwnPtr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* result, | 90 OwnPtr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* result, |
93 Maybe<protocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* i
nternalProperties, | 91 Maybe<protocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* i
nternalProperties, |
94 Maybe<protocol::Runtime::ExceptionDetails>*) override; | 92 Maybe<protocol::Runtime::ExceptionDetails>*) override; |
95 void releaseObjectGroup(ErrorString*, const String& objectGroup) override; | 93 void releaseObjectGroup(ErrorString*, const String16& objectGroup) override; |
96 void run(ErrorString*) override; | 94 void run(ErrorString*) override; |
97 void setCustomObjectFormatterEnabled(ErrorString*, bool) override; | 95 void setCustomObjectFormatterEnabled(ErrorString*, bool) override; |
98 void compileScript(ErrorString*, | 96 void compileScript(ErrorString*, |
99 const String& expression, | 97 const String16& expression, |
100 const String& sourceURL, | 98 const String16& sourceURL, |
101 bool persistScript, | 99 bool persistScript, |
102 int executionContextId, | 100 int executionContextId, |
103 Maybe<protocol::Runtime::ScriptId>*, | 101 Maybe<String16>*, |
104 Maybe<protocol::Runtime::ExceptionDetails>*) override; | 102 Maybe<protocol::Runtime::ExceptionDetails>*) override; |
105 void runScript(ErrorString*, | 103 void runScript(ErrorString*, |
106 const protocol::Runtime::ScriptId&, | 104 const String16&, |
107 int executionContextId, | 105 int executionContextId, |
108 const Maybe<String>& objectGroup, | 106 const Maybe<String16>& objectGroup, |
109 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, | 107 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, |
110 const Maybe<bool>& includeCommandLineAPI, | 108 const Maybe<bool>& includeCommandLineAPI, |
111 OwnPtr<protocol::Runtime::RemoteObject>* result, | 109 OwnPtr<protocol::Runtime::RemoteObject>* result, |
112 Maybe<protocol::Runtime::ExceptionDetails>*) override; | 110 Maybe<protocol::Runtime::ExceptionDetails>*) override; |
113 | 111 |
114 V8DebuggerImpl* debugger() { return m_debugger; } | 112 V8DebuggerImpl* debugger() { return m_debugger; } |
115 InjectedScriptManager* injectedScriptManager() { return m_injectedScriptMana
ger.get(); } | 113 InjectedScriptManager* injectedScriptManager() { return m_injectedScriptMana
ger.get(); } |
116 | 114 |
117 void setClearConsoleCallback(PassOwnPtr<ClearConsoleCallback>) override; | 115 void setClearConsoleCallback(PassOwnPtr<ClearConsoleCallback>) override; |
118 void setInspectObjectCallback(PassOwnPtr<InspectCallback>) override; | 116 void setInspectObjectCallback(PassOwnPtr<InspectCallback>) override; |
119 int ensureDefaultContextAvailable(v8::Local<v8::Context>) override; | 117 int ensureDefaultContextAvailable(v8::Local<v8::Context>) override; |
120 PassOwnPtr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Context
>, v8::Local<v8::Value>, const String& groupName, bool generatePreview = false)
override; | 118 PassOwnPtr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Context
>, v8::Local<v8::Value>, const String16& groupName, bool generatePreview = false
) override; |
121 PassOwnPtr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Context>
, v8::Local<v8::Value> table, v8::Local<v8::Value> columns) override; | 119 PassOwnPtr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Context>
, v8::Local<v8::Value> table, v8::Local<v8::Value> columns) override; |
122 void disposeObjectGroup(const String&) override; | 120 void disposeObjectGroup(const String16&) override; |
123 v8::Local<v8::Value> findObject(const String& objectId, v8::Local<v8::Contex
t>* = nullptr, String* groupName = nullptr) override; | 121 v8::Local<v8::Value> findObject(const String16& objectId, v8::Local<v8::Cont
ext>* = nullptr, String16* groupName = nullptr) override; |
124 void addInspectedObject(PassOwnPtr<Inspectable>) override; | 122 void addInspectedObject(PassOwnPtr<Inspectable>) override; |
125 void clearInspectedObjects() override; | 123 void clearInspectedObjects() override; |
126 | 124 |
127 private: | 125 private: |
128 void reportExecutionContextCreated(v8::Local<v8::Context>, const String& typ
e, const String& origin, const String& humanReadableName, const String& frameId)
override; | 126 void reportExecutionContextCreated(v8::Local<v8::Context>, const String16& t
ype, const String16& origin, const String16& humanReadableName, const String16&
frameId) override; |
129 void reportExecutionContextDestroyed(v8::Local<v8::Context>) override; | 127 void reportExecutionContextDestroyed(v8::Local<v8::Context>) override; |
130 PassOwnPtr<protocol::Runtime::ExceptionDetails> createExceptionDetails(v8::I
solate*, v8::Local<v8::Message>); | 128 PassOwnPtr<protocol::Runtime::ExceptionDetails> createExceptionDetails(v8::I
solate*, v8::Local<v8::Message>); |
131 | 129 |
132 Client* m_client; | 130 Client* m_client; |
133 protocol::DictionaryValue* m_state; | 131 protocol::DictionaryValue* m_state; |
134 protocol::Frontend::Runtime* m_frontend; | 132 protocol::Frontend::Runtime* m_frontend; |
135 OwnPtr<InjectedScriptManager> m_injectedScriptManager; | 133 OwnPtr<InjectedScriptManager> m_injectedScriptManager; |
136 V8DebuggerImpl* m_debugger; | 134 V8DebuggerImpl* m_debugger; |
137 bool m_enabled; | 135 bool m_enabled; |
138 protocol::HashMap<String, OwnPtr<v8::Global<v8::Script>>> m_compiledScripts; | 136 protocol::HashMap<String16, OwnPtr<v8::Global<v8::Script>>> m_compiledScript
s; |
139 }; | 137 }; |
140 | 138 |
141 } // namespace blink | 139 } // namespace blink |
142 | 140 |
143 #endif // V8RuntimeAgentImpl_h | 141 #endif // V8RuntimeAgentImpl_h |
OLD | NEW |