OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are |
| 6 * met: |
| 7 * |
| 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ |
| 30 |
| 31 #ifndef V8_INSPECTOR_V8RUNTIMEAGENTIMPL_H_ |
| 32 #define V8_INSPECTOR_V8RUNTIMEAGENTIMPL_H_ |
| 33 |
| 34 #include "src/inspector/Allocator.h" |
| 35 #include "src/inspector/protocol/Forward.h" |
| 36 #include "src/inspector/protocol/Runtime.h" |
| 37 |
| 38 #include <v8.h> |
| 39 |
| 40 namespace v8_inspector { |
| 41 |
| 42 class InjectedScript; |
| 43 class InspectedContext; |
| 44 class RemoteObjectIdBase; |
| 45 class V8ConsoleMessage; |
| 46 class V8InspectorImpl; |
| 47 class V8InspectorSessionImpl; |
| 48 |
| 49 using protocol::ErrorString; |
| 50 using protocol::Maybe; |
| 51 |
| 52 class V8RuntimeAgentImpl : public protocol::Runtime::Backend { |
| 53 V8_INSPECTOR_DISALLOW_COPY(V8RuntimeAgentImpl); |
| 54 |
| 55 public: |
| 56 V8RuntimeAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*, |
| 57 protocol::DictionaryValue* state); |
| 58 ~V8RuntimeAgentImpl() override; |
| 59 void restore(); |
| 60 |
| 61 // Part of the protocol. |
| 62 void enable(ErrorString*) override; |
| 63 void disable(ErrorString*) override; |
| 64 void evaluate(const String16& expression, const Maybe<String16>& objectGroup, |
| 65 const Maybe<bool>& includeCommandLineAPI, |
| 66 const Maybe<bool>& silent, const Maybe<int>& executionContextId, |
| 67 const Maybe<bool>& returnByValue, |
| 68 const Maybe<bool>& generatePreview, |
| 69 const Maybe<bool>& userGesture, const Maybe<bool>& awaitPromise, |
| 70 std::unique_ptr<EvaluateCallback>) override; |
| 71 void awaitPromise(const String16& promiseObjectId, |
| 72 const Maybe<bool>& returnByValue, |
| 73 const Maybe<bool>& generatePreview, |
| 74 std::unique_ptr<AwaitPromiseCallback>) override; |
| 75 void callFunctionOn( |
| 76 const String16& objectId, const String16& expression, |
| 77 const Maybe<protocol::Array<protocol::Runtime::CallArgument>>& |
| 78 optionalArguments, |
| 79 const Maybe<bool>& silent, const Maybe<bool>& returnByValue, |
| 80 const Maybe<bool>& generatePreview, const Maybe<bool>& userGesture, |
| 81 const Maybe<bool>& awaitPromise, |
| 82 std::unique_ptr<CallFunctionOnCallback>) override; |
| 83 void releaseObject(ErrorString*, const String16& objectId) override; |
| 84 void getProperties( |
| 85 ErrorString*, const String16& objectId, const Maybe<bool>& ownProperties, |
| 86 const Maybe<bool>& accessorPropertiesOnly, |
| 87 const Maybe<bool>& generatePreview, |
| 88 std::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* |
| 89 result, |
| 90 Maybe<protocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* |
| 91 internalProperties, |
| 92 Maybe<protocol::Runtime::ExceptionDetails>*) override; |
| 93 void releaseObjectGroup(ErrorString*, const String16& objectGroup) override; |
| 94 void runIfWaitingForDebugger(ErrorString*) override; |
| 95 void setCustomObjectFormatterEnabled(ErrorString*, bool) override; |
| 96 void discardConsoleEntries(ErrorString*) override; |
| 97 void compileScript(ErrorString*, const String16& expression, |
| 98 const String16& sourceURL, bool persistScript, |
| 99 const Maybe<int>& executionContextId, Maybe<String16>*, |
| 100 Maybe<protocol::Runtime::ExceptionDetails>*) override; |
| 101 void runScript(const String16&, const Maybe<int>& executionContextId, |
| 102 const Maybe<String16>& objectGroup, const Maybe<bool>& silent, |
| 103 const Maybe<bool>& includeCommandLineAPI, |
| 104 const Maybe<bool>& returnByValue, |
| 105 const Maybe<bool>& generatePreview, |
| 106 const Maybe<bool>& awaitPromise, |
| 107 std::unique_ptr<RunScriptCallback>) override; |
| 108 |
| 109 void reset(); |
| 110 void reportExecutionContextCreated(InspectedContext*); |
| 111 void reportExecutionContextDestroyed(InspectedContext*); |
| 112 void inspect(std::unique_ptr<protocol::Runtime::RemoteObject> objectToInspect, |
| 113 std::unique_ptr<protocol::DictionaryValue> hints); |
| 114 void messageAdded(V8ConsoleMessage*); |
| 115 bool enabled() const { return m_enabled; } |
| 116 |
| 117 private: |
| 118 void reportMessage(V8ConsoleMessage*, bool generatePreview); |
| 119 |
| 120 V8InspectorSessionImpl* m_session; |
| 121 protocol::DictionaryValue* m_state; |
| 122 protocol::Runtime::Frontend m_frontend; |
| 123 V8InspectorImpl* m_inspector; |
| 124 bool m_enabled; |
| 125 protocol::HashMap<String16, std::unique_ptr<v8::Global<v8::Script>>> |
| 126 m_compiledScripts; |
| 127 }; |
| 128 |
| 129 } // namespace v8_inspector |
| 130 |
| 131 #endif // V8_INSPECTOR_V8RUNTIMEAGENTIMPL_H_ |
OLD | NEW |