OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef InjectedScript_h | 31 #ifndef InjectedScript_h |
32 #define InjectedScript_h | 32 #define InjectedScript_h |
33 | 33 |
34 #include "bindings/core/v8/ScriptValue.h" | |
35 #include "core/InspectorTypeBuilder.h" | 34 #include "core/InspectorTypeBuilder.h" |
36 #include "core/inspector/InjectedScriptManager.h" | 35 #include "core/inspector/InjectedScriptManager.h" |
37 #include "core/inspector/InjectedScriptNative.h" | 36 #include "core/inspector/InjectedScriptNative.h" |
38 #include "wtf/Allocator.h" | 37 #include "wtf/Allocator.h" |
39 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
40 #include <v8.h> | 39 #include <v8.h> |
41 | 40 |
42 namespace blink { | 41 namespace blink { |
43 | 42 |
| 43 class InjectedScriptManager; |
44 class JSONValue; | 44 class JSONValue; |
45 class RemoteObjectId; | 45 class RemoteObjectId; |
46 class ScriptFunctionCall; | 46 class ScriptFunctionCall; |
47 class V8DebuggerClient; | 47 class V8DebuggerClient; |
48 | 48 |
49 typedef String ErrorString; | 49 typedef String ErrorString; |
50 | 50 |
51 class InjectedScript final { | 51 class InjectedScript final { |
52 USING_FAST_MALLOC(InjectedScript); | 52 USING_FAST_MALLOC(InjectedScript); |
53 public: | 53 public: |
54 ~InjectedScript(); | 54 ~InjectedScript(); |
55 | 55 |
56 ScriptState* scriptState() const | |
57 { | |
58 return m_injectedScriptObject.scriptState(); | |
59 } | |
60 | |
61 void evaluate( | 56 void evaluate( |
62 ErrorString*, | 57 ErrorString*, |
63 const String& expression, | 58 const String& expression, |
64 const String& objectGroup, | 59 const String& objectGroup, |
65 bool includeCommandLineAPI, | 60 bool includeCommandLineAPI, |
66 bool returnByValue, | 61 bool returnByValue, |
67 bool generatePreview, | 62 bool generatePreview, |
68 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, | 63 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, |
69 TypeBuilder::OptOutput<bool>* wasThrown, | 64 TypeBuilder::OptOutput<bool>* wasThrown, |
70 RefPtr<TypeBuilder::Debugger::ExceptionDetails>*); | 65 RefPtr<TypeBuilder::Debugger::ExceptionDetails>*); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(v8::Local<v8::Valu
e>, const String& groupName, bool generatePreview = false) const; | 100 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(v8::Local<v8::Valu
e>, const String& groupName, bool generatePreview = false) const; |
106 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(v8::Local<v8::Value
> table, v8::Local<v8::Value> columns) const; | 101 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(v8::Local<v8::Value
> table, v8::Local<v8::Value> columns) const; |
107 v8::Local<v8::Value> findObject(const RemoteObjectId&) const; | 102 v8::Local<v8::Value> findObject(const RemoteObjectId&) const; |
108 | 103 |
109 String objectIdToObjectGroupName(const String& objectId) const; | 104 String objectIdToObjectGroupName(const String& objectId) const; |
110 void releaseObjectGroup(const String&); | 105 void releaseObjectGroup(const String&); |
111 | 106 |
112 void setCustomObjectFormatterEnabled(bool); | 107 void setCustomObjectFormatterEnabled(bool); |
113 int contextId() { return m_contextId; } | 108 int contextId() { return m_contextId; } |
114 | 109 |
| 110 v8::Isolate* isolate() { return m_isolate; } |
| 111 v8::Local<v8::Context> context() const; |
| 112 void dispose(); |
| 113 |
115 private: | 114 private: |
116 friend InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8
::Context>); | 115 friend InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8
::Context>); |
117 InjectedScript(v8::Local<v8::Object>, V8DebuggerClient*, PassRefPtr<Injected
ScriptNative>, int contextId); | 116 InjectedScript(InjectedScriptManager*, v8::Local<v8::Context>, v8::Local<v8:
:Object>, V8DebuggerClient*, PassRefPtr<InjectedScriptNative>, int contextId); |
118 | 117 |
119 bool canAccessInspectedWindow() const; | 118 bool canAccessInspectedWindow() const; |
120 v8::Local<v8::Context> v8Context() const; | |
121 v8::Local<v8::Value> v8Value() const; | 119 v8::Local<v8::Value> v8Value() const; |
122 v8::Local<v8::Value> callFunctionWithEvalEnabled(ScriptFunctionCall&, bool&
hadException) const; | 120 v8::Local<v8::Value> callFunctionWithEvalEnabled(ScriptFunctionCall&, bool&
hadException) const; |
123 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); | 121 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); |
124 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run
time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown, RefPtr<Typ
eBuilder::Debugger::ExceptionDetails>* = 0); | 122 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run
time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown, RefPtr<Typ
eBuilder::Debugger::ExceptionDetails>* = 0); |
125 void makeCallWithExceptionDetails(ScriptFunctionCall&, RefPtr<JSONValue>* re
sult, RefPtr<TypeBuilder::Debugger::ExceptionDetails>*); | 123 void makeCallWithExceptionDetails(ScriptFunctionCall&, RefPtr<JSONValue>* re
sult, RefPtr<TypeBuilder::Debugger::ExceptionDetails>*); |
126 | 124 |
| 125 InjectedScriptManager* m_manager; |
127 v8::Isolate* m_isolate; | 126 v8::Isolate* m_isolate; |
128 ScriptValue m_injectedScriptObject; | 127 v8::Global<v8::Context> m_context; |
| 128 v8::Global<v8::Value> m_value; |
129 V8DebuggerClient* m_client; | 129 V8DebuggerClient* m_client; |
130 RefPtr<InjectedScriptNative> m_native; | 130 RefPtr<InjectedScriptNative> m_native; |
131 int m_contextId; | 131 int m_contextId; |
132 }; | 132 }; |
133 | 133 |
134 } // namespace blink | 134 } // namespace blink |
135 | 135 |
136 #endif | 136 #endif |
OLD | NEW |