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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 namespace v8_inspector { | 40 namespace v8_inspector { |
41 | 41 |
42 class InjectedScript; | 42 class InjectedScript; |
43 class InspectedContext; | 43 class InspectedContext; |
44 class RemoteObjectIdBase; | 44 class RemoteObjectIdBase; |
45 class V8ConsoleMessage; | 45 class V8ConsoleMessage; |
46 class V8InspectorImpl; | 46 class V8InspectorImpl; |
47 class V8InspectorSessionImpl; | 47 class V8InspectorSessionImpl; |
48 | 48 |
49 using protocol::ErrorString; | 49 using protocol::Response; |
50 using protocol::Maybe; | 50 using protocol::Maybe; |
51 | 51 |
52 class V8RuntimeAgentImpl : public protocol::Runtime::Backend { | 52 class V8RuntimeAgentImpl : public protocol::Runtime::Backend { |
53 public: | 53 public: |
54 V8RuntimeAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*, | 54 V8RuntimeAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*, |
55 protocol::DictionaryValue* state); | 55 protocol::DictionaryValue* state); |
56 ~V8RuntimeAgentImpl() override; | 56 ~V8RuntimeAgentImpl() override; |
57 void restore(); | 57 void restore(); |
58 | 58 |
59 // Part of the protocol. | 59 // Part of the protocol. |
60 void enable(ErrorString*) override; | 60 Response enable() override; |
61 void disable(ErrorString*) override; | 61 Response disable() override; |
62 void evaluate(const String16& expression, const Maybe<String16>& objectGroup, | 62 void evaluate(const String16& expression, Maybe<String16> objectGroup, |
63 const Maybe<bool>& includeCommandLineAPI, | 63 Maybe<bool> includeCommandLineAPI, Maybe<bool> silent, |
64 const Maybe<bool>& silent, const Maybe<int>& executionContextId, | 64 Maybe<int> executionContextId, Maybe<bool> returnByValue, |
65 const Maybe<bool>& returnByValue, | 65 Maybe<bool> generatePreview, Maybe<bool> userGesture, |
66 const Maybe<bool>& generatePreview, | 66 Maybe<bool> awaitPromise, |
67 const Maybe<bool>& userGesture, const Maybe<bool>& awaitPromise, | |
68 std::unique_ptr<EvaluateCallback>) override; | 67 std::unique_ptr<EvaluateCallback>) override; |
69 void awaitPromise(const String16& promiseObjectId, | 68 void awaitPromise(const String16& promiseObjectId, Maybe<bool> returnByValue, |
70 const Maybe<bool>& returnByValue, | 69 Maybe<bool> generatePreview, |
71 const Maybe<bool>& generatePreview, | |
72 std::unique_ptr<AwaitPromiseCallback>) override; | 70 std::unique_ptr<AwaitPromiseCallback>) override; |
73 void callFunctionOn( | 71 void callFunctionOn( |
74 const String16& objectId, const String16& expression, | 72 const String16& objectId, const String16& expression, |
75 const Maybe<protocol::Array<protocol::Runtime::CallArgument>>& | 73 Maybe<protocol::Array<protocol::Runtime::CallArgument>> optionalArguments, |
76 optionalArguments, | 74 Maybe<bool> silent, Maybe<bool> returnByValue, |
77 const Maybe<bool>& silent, const Maybe<bool>& returnByValue, | 75 Maybe<bool> generatePreview, Maybe<bool> userGesture, |
78 const Maybe<bool>& generatePreview, const Maybe<bool>& userGesture, | 76 Maybe<bool> awaitPromise, |
79 const Maybe<bool>& awaitPromise, | |
80 std::unique_ptr<CallFunctionOnCallback>) override; | 77 std::unique_ptr<CallFunctionOnCallback>) override; |
81 void releaseObject(ErrorString*, const String16& objectId) override; | 78 Response releaseObject(const String16& objectId) override; |
82 void getProperties( | 79 Response getProperties( |
83 ErrorString*, const String16& objectId, const Maybe<bool>& ownProperties, | 80 const String16& objectId, Maybe<bool> ownProperties, |
84 const Maybe<bool>& accessorPropertiesOnly, | 81 Maybe<bool> accessorPropertiesOnly, Maybe<bool> generatePreview, |
85 const Maybe<bool>& generatePreview, | |
86 std::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* | 82 std::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* |
87 result, | 83 result, |
88 Maybe<protocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* | 84 Maybe<protocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* |
89 internalProperties, | 85 internalProperties, |
90 Maybe<protocol::Runtime::ExceptionDetails>*) override; | 86 Maybe<protocol::Runtime::ExceptionDetails>*) override; |
91 void releaseObjectGroup(ErrorString*, const String16& objectGroup) override; | 87 Response releaseObjectGroup(const String16& objectGroup) override; |
92 void runIfWaitingForDebugger(ErrorString*) override; | 88 Response runIfWaitingForDebugger() override; |
93 void setCustomObjectFormatterEnabled(ErrorString*, bool) override; | 89 Response setCustomObjectFormatterEnabled(bool) override; |
94 void discardConsoleEntries(ErrorString*) override; | 90 Response discardConsoleEntries() override; |
95 void compileScript(ErrorString*, const String16& expression, | 91 Response compileScript(const String16& expression, const String16& sourceURL, |
96 const String16& sourceURL, bool persistScript, | 92 bool persistScript, Maybe<int> executionContextId, |
97 const Maybe<int>& executionContextId, Maybe<String16>*, | 93 Maybe<String16>*, |
98 Maybe<protocol::Runtime::ExceptionDetails>*) override; | 94 Maybe<protocol::Runtime::ExceptionDetails>*) override; |
99 void runScript(const String16&, const Maybe<int>& executionContextId, | 95 void runScript(const String16&, Maybe<int> executionContextId, |
100 const Maybe<String16>& objectGroup, const Maybe<bool>& silent, | 96 Maybe<String16> objectGroup, Maybe<bool> silent, |
101 const Maybe<bool>& includeCommandLineAPI, | 97 Maybe<bool> includeCommandLineAPI, Maybe<bool> returnByValue, |
102 const Maybe<bool>& returnByValue, | 98 Maybe<bool> generatePreview, Maybe<bool> awaitPromise, |
103 const Maybe<bool>& generatePreview, | |
104 const Maybe<bool>& awaitPromise, | |
105 std::unique_ptr<RunScriptCallback>) override; | 99 std::unique_ptr<RunScriptCallback>) override; |
106 | 100 |
107 void reset(); | 101 void reset(); |
108 void reportExecutionContextCreated(InspectedContext*); | 102 void reportExecutionContextCreated(InspectedContext*); |
109 void reportExecutionContextDestroyed(InspectedContext*); | 103 void reportExecutionContextDestroyed(InspectedContext*); |
110 void inspect(std::unique_ptr<protocol::Runtime::RemoteObject> objectToInspect, | 104 void inspect(std::unique_ptr<protocol::Runtime::RemoteObject> objectToInspect, |
111 std::unique_ptr<protocol::DictionaryValue> hints); | 105 std::unique_ptr<protocol::DictionaryValue> hints); |
112 void messageAdded(V8ConsoleMessage*); | 106 void messageAdded(V8ConsoleMessage*); |
113 bool enabled() const { return m_enabled; } | 107 bool enabled() const { return m_enabled; } |
114 | 108 |
115 private: | 109 private: |
116 bool reportMessage(V8ConsoleMessage*, bool generatePreview); | 110 bool reportMessage(V8ConsoleMessage*, bool generatePreview); |
117 | 111 |
118 V8InspectorSessionImpl* m_session; | 112 V8InspectorSessionImpl* m_session; |
119 protocol::DictionaryValue* m_state; | 113 protocol::DictionaryValue* m_state; |
120 protocol::Runtime::Frontend m_frontend; | 114 protocol::Runtime::Frontend m_frontend; |
121 V8InspectorImpl* m_inspector; | 115 V8InspectorImpl* m_inspector; |
122 bool m_enabled; | 116 bool m_enabled; |
123 protocol::HashMap<String16, std::unique_ptr<v8::Global<v8::Script>>> | 117 protocol::HashMap<String16, std::unique_ptr<v8::Global<v8::Script>>> |
124 m_compiledScripts; | 118 m_compiledScripts; |
125 | 119 |
126 DISALLOW_COPY_AND_ASSIGN(V8RuntimeAgentImpl); | 120 DISALLOW_COPY_AND_ASSIGN(V8RuntimeAgentImpl); |
127 }; | 121 }; |
128 | 122 |
129 } // namespace v8_inspector | 123 } // namespace v8_inspector |
130 | 124 |
131 #endif // V8_INSPECTOR_V8RUNTIMEAGENTIMPL_H_ | 125 #endif // V8_INSPECTOR_V8RUNTIMEAGENTIMPL_H_ |
OLD | NEW |