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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 class InjectedScriptManager; | 41 class InjectedScriptManager; |
42 class RemoteObjectId; | 42 class RemoteObjectId; |
43 class V8FunctionCall; | 43 class V8FunctionCall; |
44 class V8DebuggerClient; | 44 class V8DebuggerClient; |
45 | 45 |
46 namespace protocol { | 46 namespace protocol { |
47 class DictionaryValue; | 47 class DictionaryValue; |
48 } | 48 } |
49 | 49 |
50 typedef String ErrorString; | |
51 | 50 |
52 using protocol::Maybe; | 51 using protocol::Maybe; |
53 | 52 |
54 class InjectedScript final { | 53 class InjectedScript final { |
55 public: | 54 public: |
56 ~InjectedScript(); | 55 ~InjectedScript(); |
57 | 56 |
58 void evaluate( | 57 void evaluate( |
59 ErrorString*, | 58 ErrorString*, |
60 const String& expression, | 59 const String16& expression, |
61 const String& objectGroup, | 60 const String16& objectGroup, |
62 bool includeCommandLineAPI, | 61 bool includeCommandLineAPI, |
63 bool returnByValue, | 62 bool returnByValue, |
64 bool generatePreview, | 63 bool generatePreview, |
65 OwnPtr<protocol::Runtime::RemoteObject>* result, | 64 OwnPtr<protocol::Runtime::RemoteObject>* result, |
66 Maybe<bool>* wasThrown, | 65 Maybe<bool>* wasThrown, |
67 Maybe<protocol::Runtime::ExceptionDetails>*); | 66 Maybe<protocol::Runtime::ExceptionDetails>*); |
68 void callFunctionOn( | 67 void callFunctionOn( |
69 ErrorString*, | 68 ErrorString*, |
70 const String& objectId, | 69 const String16& objectId, |
71 const String& expression, | 70 const String16& expression, |
72 const String& arguments, | 71 const String16& arguments, |
73 bool returnByValue, | 72 bool returnByValue, |
74 bool generatePreview, | 73 bool generatePreview, |
75 OwnPtr<protocol::Runtime::RemoteObject>* result, | 74 OwnPtr<protocol::Runtime::RemoteObject>* result, |
76 Maybe<bool>* wasThrown); | 75 Maybe<bool>* wasThrown); |
77 void evaluateOnCallFrame( | 76 void evaluateOnCallFrame( |
78 ErrorString*, | 77 ErrorString*, |
79 v8::Local<v8::Object> callFrames, | 78 v8::Local<v8::Object> callFrames, |
80 const String& callFrameId, | 79 const String16& callFrameId, |
81 const String& expression, | 80 const String16& expression, |
82 const String& objectGroup, | 81 const String16& objectGroup, |
83 bool includeCommandLineAPI, | 82 bool includeCommandLineAPI, |
84 bool returnByValue, | 83 bool returnByValue, |
85 bool generatePreview, | 84 bool generatePreview, |
86 OwnPtr<protocol::Runtime::RemoteObject>* result, | 85 OwnPtr<protocol::Runtime::RemoteObject>* result, |
87 Maybe<bool>* wasThrown, | 86 Maybe<bool>* wasThrown, |
88 Maybe<protocol::Runtime::ExceptionDetails>*); | 87 Maybe<protocol::Runtime::ExceptionDetails>*); |
89 void restartFrame(ErrorString*, v8::Local<v8::Object> callFrames, const Stri
ng& callFrameId); | 88 void restartFrame(ErrorString*, v8::Local<v8::Object> callFrames, const Stri
ng16& callFrameId); |
90 void getStepInPositions(ErrorString*, v8::Local<v8::Object> callFrames, cons
t String& callFrameId, Maybe<protocol::Array<protocol::Debugger::Location>>* pos
itions); | 89 void getStepInPositions(ErrorString*, v8::Local<v8::Object> callFrames, cons
t String16& callFrameId, Maybe<protocol::Array<protocol::Debugger::Location>>* p
ositions); |
91 void setVariableValue(ErrorString*, v8::Local<v8::Object> callFrames, const
Maybe<String>& callFrameIdOpt, const Maybe<String>& functionObjectIdOpt, int sco
peNumber, const String& variableName, const String& newValueStr); | 90 void setVariableValue(ErrorString*, v8::Local<v8::Object> callFrames, const
Maybe<String16>& callFrameIdOpt, const Maybe<String16>& functionObjectIdOpt, int
scopeNumber, const String16& variableName, const String16& newValueStr); |
92 void getFunctionDetails(ErrorString*, const String& functionId, OwnPtr<proto
col::Debugger::FunctionDetails>* result); | 91 void getFunctionDetails(ErrorString*, const String16& functionId, OwnPtr<pro
tocol::Debugger::FunctionDetails>* result); |
93 void getGeneratorObjectDetails(ErrorString*, const String& functionId, OwnPt
r<protocol::Debugger::GeneratorObjectDetails>* result); | 92 void getGeneratorObjectDetails(ErrorString*, const String16& functionId, Own
Ptr<protocol::Debugger::GeneratorObjectDetails>* result); |
94 void getCollectionEntries(ErrorString*, const String& objectId, OwnPtr<proto
col::Array<protocol::Debugger::CollectionEntry>>* result); | 93 void getCollectionEntries(ErrorString*, const String16& objectId, OwnPtr<pro
tocol::Array<protocol::Debugger::CollectionEntry>>* result); |
95 void getProperties(ErrorString*, const String& objectId, bool ownProperties,
bool accessorPropertiesOnly, bool generatePreview, OwnPtr<protocol::Array<proto
col::Runtime::PropertyDescriptor>>* result, Maybe<protocol::Runtime::ExceptionDe
tails>*); | 94 void getProperties(ErrorString*, const String16& objectId, bool ownPropertie
s, bool accessorPropertiesOnly, bool generatePreview, OwnPtr<protocol::Array<pro
tocol::Runtime::PropertyDescriptor>>* result, Maybe<protocol::Runtime::Exception
Details>*); |
96 void getInternalProperties(ErrorString*, const String& objectId, Maybe<proto
col::Array<protocol::Runtime::InternalPropertyDescriptor>>* result, Maybe<protoc
ol::Runtime::ExceptionDetails>*); | 95 void getInternalProperties(ErrorString*, const String16& objectId, Maybe<pro
tocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* result, Maybe<prot
ocol::Runtime::ExceptionDetails>*); |
97 void releaseObject(const String& objectId); | 96 void releaseObject(const String16& objectId); |
98 v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Script>, bool incl
udeCommandLineAPI); | 97 v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Script>, bool incl
udeCommandLineAPI); |
99 | 98 |
100 PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> wrapCallFrames(v8
::Local<v8::Object>); | 99 PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> wrapCallFrames(v8
::Local<v8::Object>); |
101 | 100 |
102 PassOwnPtr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Value>,
const String& groupName, bool generatePreview = false) const; | 101 PassOwnPtr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Value>,
const String16& groupName, bool generatePreview = false) const; |
103 PassOwnPtr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Value> t
able, v8::Local<v8::Value> columns) const; | 102 PassOwnPtr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Value> t
able, v8::Local<v8::Value> columns) const; |
104 v8::Local<v8::Value> findObject(const RemoteObjectId&) const; | 103 v8::Local<v8::Value> findObject(const RemoteObjectId&) const; |
105 String objectGroupName(const RemoteObjectId&) const; | 104 String16 objectGroupName(const RemoteObjectId&) const; |
106 void releaseObjectGroup(const String&); | 105 void releaseObjectGroup(const String16&); |
107 | 106 |
108 void setCustomObjectFormatterEnabled(bool); | 107 void setCustomObjectFormatterEnabled(bool); |
109 int contextId() { return m_contextId; } | 108 int contextId() { return m_contextId; } |
110 String origin() const { return m_origin; } | 109 String16 origin() const { return m_origin; } |
111 void setOrigin(const String& origin) { m_origin = origin; } | 110 void setOrigin(const String16& origin) { m_origin = origin; } |
112 | 111 |
113 v8::Isolate* isolate() { return m_isolate; } | 112 v8::Isolate* isolate() { return m_isolate; } |
114 v8::Local<v8::Context> context() const; | 113 v8::Local<v8::Context> context() const; |
115 void dispose(); | 114 void dispose(); |
116 | 115 |
117 private: | 116 private: |
118 friend InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8
::Context>); | 117 friend InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8
::Context>); |
119 InjectedScript(InjectedScriptManager*, v8::Local<v8::Context>, v8::Local<v8:
:Object>, V8DebuggerClient*, PassOwnPtr<InjectedScriptNative>, int contextId); | 118 InjectedScript(InjectedScriptManager*, v8::Local<v8::Context>, v8::Local<v8:
:Object>, V8DebuggerClient*, PassOwnPtr<InjectedScriptNative>, int contextId); |
120 | 119 |
121 bool canAccessInspectedWindow() const; | 120 bool canAccessInspectedWindow() const; |
122 v8::Local<v8::Value> v8Value() const; | 121 v8::Local<v8::Value> v8Value() const; |
123 v8::Local<v8::Value> callFunctionWithEvalEnabled(V8FunctionCall&, bool& hadE
xception) const; | 122 v8::Local<v8::Value> callFunctionWithEvalEnabled(V8FunctionCall&, bool& hadE
xception) const; |
124 PassOwnPtr<protocol::Value> makeCall(V8FunctionCall&); | 123 PassOwnPtr<protocol::Value> makeCall(V8FunctionCall&); |
125 PassOwnPtr<protocol::Runtime::RemoteObject> makeEvalCall(ErrorString*, V8Fun
ctionCall&, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::ExceptionDetails>*
= 0); | 124 PassOwnPtr<protocol::Runtime::RemoteObject> makeEvalCall(ErrorString*, V8Fun
ctionCall&, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::ExceptionDetails>*
= 0); |
126 PassOwnPtr<protocol::Value> makeCallWithExceptionDetails(V8FunctionCall&, Ma
ybe<protocol::Runtime::ExceptionDetails>*); | 125 PassOwnPtr<protocol::Value> makeCallWithExceptionDetails(V8FunctionCall&, Ma
ybe<protocol::Runtime::ExceptionDetails>*); |
127 | 126 |
128 InjectedScriptManager* m_manager; | 127 InjectedScriptManager* m_manager; |
129 v8::Isolate* m_isolate; | 128 v8::Isolate* m_isolate; |
130 v8::Global<v8::Context> m_context; | 129 v8::Global<v8::Context> m_context; |
131 v8::Global<v8::Value> m_value; | 130 v8::Global<v8::Value> m_value; |
132 V8DebuggerClient* m_client; | 131 V8DebuggerClient* m_client; |
133 OwnPtr<InjectedScriptNative> m_native; | 132 OwnPtr<InjectedScriptNative> m_native; |
134 int m_contextId; | 133 int m_contextId; |
135 String m_origin; | 134 String16 m_origin; |
136 }; | 135 }; |
137 | 136 |
138 } // namespace blink | 137 } // namespace blink |
139 | 138 |
140 #endif | 139 #endif |
OLD | NEW |