Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(634)

Side by Side Diff: Source/bindings/core/dart/DartInjectedScript.h

Issue 1532413002: Added Dartium changes onto 45.0.2454.104 (Closed) Base URL: http://src.chromium.org/blink/branches/chromium/2454
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2014 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 DartInjectedScript_h
32 #define DartInjectedScript_h
33
34 #include "bindings/common/ScriptState.h"
35 #include "bindings/common/ScriptValue.h"
36 #include "core/InspectorTypeBuilder.h"
37 #include "core/inspector/InjectedScript.h"
38 #include "core/inspector/InjectedScriptBase.h"
39 #include "core/inspector/InjectedScriptManager.h"
40 #include "core/inspector/ScriptArguments.h"
41 #include "wtf/Forward.h"
42 #include "wtf/HashMap.h"
43
44 #include <dart_tools_api.h>
45
46 namespace blink {
47
48 class DartScriptState;
49 class JSONValue;
50 class ScriptFunctionCall;
51
52 class DartDebuggerObject {
53 WTF_MAKE_NONCOPYABLE(DartDebuggerObject);
54 public:
55 // FIXME: consider merging ObjectClass and Class, and Object if possible.
56 enum Kind {
57 Object,
58 ObjectClass,
59 Function,
60 Method,
61 Class,
62 StaticClass,
63 Library,
64 CurrentLibrary,
65 Isolate,
66 LocalVariables,
67 Error
68 };
69
70 DartDebuggerObject(Dart_PersistentHandle, const String& objectGroup, Kind);
71 ~DartDebuggerObject();
72 const String& group() const { return m_group; }
73 Dart_PersistentHandle persistentHandle() const { return m_handle; }
74 Dart_Handle handle() const { return m_handle; }
75 Kind kind() const { return m_kind; }
76
77 private:
78 Dart_PersistentHandle m_handle;
79 String m_group;
80 Kind m_kind;
81 };
82
83 class DartInjectedScript {
84 public:
85 DartInjectedScript();
86 DartInjectedScript(DartScriptState*, InjectedScriptManager::InspectedStateAc cessCheck, int injectedScriptId, InjectedScriptHost*, InjectedScriptManager*);
87 ~DartInjectedScript();
88
89 const String& name() const { return m_name; }
90
91 void evaluate(ErrorString*,
92 const String& expression,
93 const String& objectGroup,
94 bool includeCommandLineAPI,
95 bool returnByValue,
96 bool generatePreview,
97 RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
98 TypeBuilder::OptOutput<bool>* wasThrown,
99 RefPtr<TypeBuilder::Debugger::ExceptionDetails>*);
100 void callFunctionOn(ErrorString*,
101 const String& objectId,
102 const String& expression,
103 const String& arguments,
104 bool returnByValue,
105 bool generatePreview,
106 RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
107 TypeBuilder::OptOutput<bool>* wasThrown);
108 void evaluateOnCallFrame(ErrorString*,
109 const Dart_StackTrace callFrames,
110 const String& callFrameId,
111 const String& expression,
112 const String& objectGroup,
113 bool includeCommandLineAPI,
114 bool returnByValue,
115 bool generatePreview,
116 RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
117 TypeBuilder::OptOutput<bool>* wasThrown,
118 RefPtr<TypeBuilder::Debugger::ExceptionDetails>*);
119 void getCompletionsOnCallFrame(
120 ErrorString*,
121 const Dart_StackTrace callFrames,
122 const String& callFrameId,
123 const String& expression,
124 RefPtr<TypeBuilder::Array<String> >* result);
125 void restartFrame(ErrorString*, const Dart_StackTrace callFrames, const Stri ng& callFrameId, RefPtr<JSONObject>* result);
126 void setVariableValue(ErrorString*, const Dart_StackTrace callFrames, const String* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber, cons t String& variableName, const String& newValueStr);
127 void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeB uilder::Debugger::FunctionDetails>* result);
128 void getCompletions(ErrorString*, const String& expression, RefPtr<TypeBuild er::Array<String> >* out_result);
129 void getProperties(ErrorString*, const String& objectId, bool ownProperties, bool accessorPropertiesOnly, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::Pr opertyDescriptor> >* result);
130 void getInternalProperties(ErrorString*, const String& objectId, RefPtr<Type Builder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor> >* result);
131 void getProperty(ErrorString*, const String& objectId, const RefPtr<JSONArra y>& propertyPath, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilde r::OptOutput<bool>* wasThrown);
132
133 Node* nodeForObjectId(const String& objectId);
134 void releaseObject(const String& objectId);
135
136 PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > wrapCallFr ames(const Dart_StackTrace, int asyncOrdinal);
137
138 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(const ScriptValue& , const String& groupName, bool generatePreview = false);
139 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const ScriptValue& table, const ScriptValue& columns);
140
141 ScriptValue findObjectById(const String& objectId) const;
142 void inspectNode(Node*);
143 void releaseObjectGroup(const String&);
144
145 bool isEmpty() const { return !m_scriptState; }
146
147 DartScriptState* scriptState() const;
148
149 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapDartObject(Dart_Handle, c onst String& groupName, bool generatePreview = false);
150
151 bool canAccessInspectedWindow() const;
152 static bool isDartObjectId(const String& objectId);
153
154 InjectedScriptManager* injectedScriptManager() { return m_injectedScriptMana ger; }
155 private:
156 Dart_Handle library();
157
158 friend class InjectedScriptModule;
159 friend InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState*) ;
160
161 bool validateObjectId(const String& objectId);
162
163 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapDartHandle(Dart_Handle, D artDebuggerObject::Kind, const String& groupName, bool generatePreview);
164
165 DartDebuggerObject::Kind inferKind(Dart_Handle);
166
167 String cacheObject(Dart_Handle, const String& objectGroup, DartDebuggerObjec t::Kind);
168 DartDebuggerObject* lookupObject(const String& objectId);
169
170 void evaluateAndPackageResult(Dart_Handle target, const String& rawExpressio n, Dart_Handle localVariables, bool includeCommandLineAPI, const String& objectG roup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder ::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown, RefPt r<TypeBuilder::Debugger::ExceptionDetails>*);
171 Dart_Handle evaluateHelper(Dart_Handle target, const String& rawExpression, Dart_Handle localVariables, bool includeCommandLineAPI, Dart_Handle& exception);
172 PassRefPtr<TypeBuilder::Array<TypeBuilder::Console::CallFrame> > consoleCall Frames(Dart_StackTrace);
173
174 void packageResult(Dart_Handle, DartDebuggerObject::Kind, const String& obje ctGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuil der::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
175 void packageObjectResult(Dart_Handle, const String& objectGroup, ErrorString *, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::Remote Object>* result, TypeBuilder::OptOutput<bool>* wasThrown);
176 void packageObjectClassResult(Dart_Handle, const String& objectGroup, ErrorS tring*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::R emoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
177 void packageLibraryResult(Dart_Handle, DartDebuggerObject::Kind, const Strin g& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<T ypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThr own);
178 void packageIsolateResult(Dart_Handle, const String& objectGroup, ErrorStrin g*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::Remot eObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
179 void packageClassResult(Dart_Handle, DartDebuggerObject::Kind, const String& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<Typ eBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrow n);
180 void packageFunctionResult(Dart_Handle, const String& objectGroup, ErrorStri ng*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::Remo teObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
181 void packageMethodResult(Dart_Handle, const String& objectGroup, ErrorString *, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::Remote Object>* result, TypeBuilder::OptOutput<bool>* wasThrown);
182 void packageLocalVariablesResult(Dart_Handle, const String& objectGroup, Err orString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime ::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
183 void packageErrorResult(Dart_Handle, const String& objectGroup, ErrorString* , bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteO bject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
184
185 String getCallFrameId(int ordinal, int asyncOrdinal);
186 Dart_ActivationFrame callFrameForId(const Dart_StackTrace callFrames, const String& callFrameId);
187
188 Dart_Handle consoleApi();
189
190 String m_name;
191 InjectedScriptManager::InspectedStateAccessCheck m_inspectedStateAccessCheck ;
192
193 typedef HashMap<String, Vector<String> > ObjectGroupMap;
194 ObjectGroupMap m_objectGroups;
195
196 // FIXME: use RefPtr<DartDebuggerObject> instead of DartDebuggerObject*
197 typedef HashMap<String, DartDebuggerObject*> DebuggerObjectMap;
198 DebuggerObjectMap m_objects;
199
200 DartScriptState* m_scriptState;
201
202 long m_nextObjectId;
203 int m_injectedScriptId;
204 InjectedScriptHost* m_host;
205 InjectedScriptManager* m_injectedScriptManager;
206 Dart_PersistentHandle m_consoleApi;
207 };
208
209 } // namespace blink
210
211 #endif
OLDNEW
« no previous file with comments | « Source/bindings/core/dart/DartHandleProxy.cpp ('k') | Source/bindings/core/dart/DartInjectedScript.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698