]> git.saurik.com Git - apple/javascriptcore.git/blob - inspector/agents/InspectorRuntimeAgent.h
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / inspector / agents / InspectorRuntimeAgent.h
1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #ifndef InspectorRuntimeAgent_h
33 #define InspectorRuntimeAgent_h
34
35 #if ENABLE(INSPECTOR)
36
37 #include "InspectorJSBackendDispatchers.h"
38 #include "InspectorJSFrontendDispatchers.h"
39 #include "inspector/InspectorAgentBase.h"
40 #include <wtf/Forward.h>
41 #include <wtf/Noncopyable.h>
42
43 namespace JSC {
44 class VM;
45 }
46
47 namespace Inspector {
48
49 class InjectedScript;
50 class InjectedScriptManager;
51 class InspectorArray;
52 class ScriptDebugServer;
53 typedef String ErrorString;
54
55 class JS_EXPORT_PRIVATE InspectorRuntimeAgent : public InspectorAgentBase, public InspectorRuntimeBackendDispatcherHandler {
56 WTF_MAKE_NONCOPYABLE(InspectorRuntimeAgent);
57 public:
58 virtual ~InspectorRuntimeAgent();
59
60 virtual void enable(ErrorString*) override { m_enabled = true; }
61 virtual void disable(ErrorString*) override { m_enabled = false; }
62 virtual void parse(ErrorString*, const String& expression, Inspector::TypeBuilder::Runtime::SyntaxErrorType::Enum* result, Inspector::TypeBuilder::OptOutput<String>* message, RefPtr<Inspector::TypeBuilder::Runtime::ErrorRange>&) override final;
63 virtual void evaluate(ErrorString*, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) override final;
64 virtual void callFunctionOn(ErrorString*, const String& objectId, const String& expression, const RefPtr<Inspector::InspectorArray>* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) override final;
65 virtual void releaseObject(ErrorString*, const ErrorString& objectId) override final;
66 virtual void getProperties(ErrorString*, const String& objectId, const bool* ownProperties, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Runtime::InternalPropertyDescriptor>>& internalProperties) override final;
67 virtual void releaseObjectGroup(ErrorString*, const String& objectGroup) override final;
68 virtual void run(ErrorString*) override;
69
70 void setScriptDebugServer(ScriptDebugServer* scriptDebugServer) { m_scriptDebugServer = scriptDebugServer; }
71
72 bool enabled() const { return m_enabled; }
73
74 protected:
75 InspectorRuntimeAgent(InjectedScriptManager*);
76
77 InjectedScriptManager* injectedScriptManager() { return m_injectedScriptManager; }
78
79 virtual JSC::VM& globalVM() = 0;
80 virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId) = 0;
81
82 virtual void muteConsole() = 0;
83 virtual void unmuteConsole() = 0;
84
85 private:
86 InjectedScriptManager* m_injectedScriptManager;
87 ScriptDebugServer* m_scriptDebugServer;
88 bool m_enabled;
89 };
90
91 } // namespace Inspector
92
93 #endif // ENABLE(INSPECTOR)
94 #endif // InspectorRuntimeAgent_h