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

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

Issue 300393002: Merge DevTools Refactor CL to Blink36 (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1985
Patch Set: PTAL Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/dart/DartDebugServer.cpp ('k') | Source/bindings/dart/DartInjectedScript.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "InspectorTypeBuilder.h"
35 #include "bindings/v8/ScriptObject.h"
36 #include "core/inspector/InjectedScript.h"
37 #include "core/inspector/InjectedScriptBase.h"
38 #include "core/inspector/InjectedScriptManager.h"
39 #include "core/inspector/ScriptArguments.h"
40 #include "wtf/Forward.h"
41 #include "wtf/HashMap.h"
42
43 namespace WebCore {
44
45 class DartScriptState;
46
47 class DartDebuggerObject {
48 WTF_MAKE_NONCOPYABLE(DartDebuggerObject);
49 public:
50 // FIXME: consider merging ObjectClass and Class, and Object if possible.
51 enum Kind {
52 Object,
53 ObjectClass,
54 Function,
55 Method,
56 Class,
57 StaticClass,
58 Library,
59 CurrentLibrary,
60 Isolate,
61 LocalVariables,
62 Error
63 };
64
65 DartDebuggerObject(Dart_PersistentHandle, const String& objectGroup, Kind);
66 ~DartDebuggerObject();
67 const String& group() const { return m_group; }
68 Dart_PersistentHandle persistentHandle() const { return m_handle; }
69 Dart_Handle handle() const { return m_handle; }
70 Kind kind() const { return m_kind; }
71
72 private:
73 Dart_PersistentHandle m_handle;
74 String m_group;
75 Kind m_kind;
76 };
77
78 class DartInjectedScript : public InjectedScript {
79 public:
80 DartInjectedScript();
81 virtual ~DartInjectedScript();
82
83 virtual bool isJavaScript() const { return false; }
84 virtual const String& name() const { return m_name; }
85
86 virtual void evaluate(ErrorString*,
87 const String& expression,
88 const String& objectGroup,
89 bool includeCommandLineAPI,
90 bool returnByValue,
91 bool generatePreview,
92 RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
93 TypeBuilder::OptOutput<bool>* wasThrown);
94 virtual void callFunctionOn(ErrorString*,
95 const String& objectId,
96 const String& expression,
97 const String& arguments,
98 bool returnByValue,
99 bool generatePreview,
100 RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
101 TypeBuilder::OptOutput<bool>* wasThrown);
102 virtual void evaluateOnCallFrame(ErrorString*,
103 const StackTrace& callFrames,
104 const Vector<StackTrace>& asyncCallStacks,
105 const String& callFrameId,
106 const String& expression,
107 const String& objectGroup,
108 bool includeCommandLineAPI,
109 bool returnByValue,
110 bool generatePreview,
111 RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
112 TypeBuilder::OptOutput<bool>* wasThrown);
113 virtual void getCompletionsOnCallFrame(
114 ErrorString*,
115 const StackTrace& callFrames,
116 const Vector<StackTrace>& asyncCallStacks,
117 const String& callFrameId,
118 const String& expression,
119 RefPtr<TypeBuilder::Array<String> >* result);
120 virtual void restartFrame(ErrorString*, const StackTrace& callFrames, const String& callFrameId, RefPtr<JSONObject>* result);
121 virtual void getStepInPositions(ErrorString*, const StackTrace& callFrames, const String& callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Loca tion> >& positions);
122 virtual void setVariableValue(ErrorString*, const StackTrace& callFrames, co nst String* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber, const String& variableName, const String& newValueStr);
123 virtual void getFunctionDetails(ErrorString*, const String& functionId, RefP tr<TypeBuilder::Debugger::FunctionDetails>* result);
124 virtual void getCompletions(ErrorString*, const String& expression, RefPtr<T ypeBuilder::Array<String> >* out_result);
125 virtual void getProperties(ErrorString*, const String& objectId, bool ownPro perties, bool accessorPropertiesOnly, RefPtr<TypeBuilder::Array<TypeBuilder::Run time::PropertyDescriptor> >* result);
126 virtual void getInternalProperties(ErrorString*, const String& objectId, Ref Ptr<TypeBuilder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor> >* resu lt);
127 virtual void getProperty(ErrorString*, const String& objectId, const RefPtr< JSONArray>& propertyPath, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, Ty peBuilder::OptOutput<bool>* wasThrown);
128
129 virtual Node* nodeForObjectId(const String& objectId);
130 virtual void releaseObject(const String& objectId);
131
132 virtual PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > wr apCallFrames(const StackTrace&, int asyncOrdinal);
133
134 virtual PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(const Scri ptValue&, const String& groupName, bool generatePreview = false);
135 virtual PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const Scrip tValue& table, const ScriptValue& columns);
136 virtual ActivationFrame findCallFrameById(ErrorString*, const StackTrace& to pCallFrame, const String& callFrameId);
137
138 virtual void releaseObjectGroup(const String&);
139
140 virtual bool isEmpty() const { return !m_scriptState; }
141
142 virtual ScriptState* scriptState() const;
143
144 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapDartObject(Dart_Handle, c onst String& groupName, bool generatePreview = false);
145
146 bool canAccessInspectedWindow() const;
147
148 private:
149 Dart_Handle library();
150
151 friend class InjectedScriptModule;
152 friend InjectedScript& InjectedScriptManager::injectedScriptFor(ScriptState* );
153 DartInjectedScript(DartScriptState*, InspectedStateAccessCheck, int injected ScriptId, InjectedScriptHost*);
154
155 bool validateObjectId(const String& objectId);
156
157 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapDartHandle(Dart_Handle, D artDebuggerObject::Kind, const String& groupName, bool generatePreview);
158
159 DartDebuggerObject::Kind inferKind(Dart_Handle);
160
161 String cacheObject(Dart_Handle, const String& objectGroup, DartDebuggerObjec t::Kind);
162 DartDebuggerObject* lookupObject(const String& objectId);
163
164 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);
165 Dart_Handle evaluateHelper(Dart_Handle target, const String& rawExpression, Dart_Handle localVariables, bool includeCommandLineAPI, Dart_Handle& exception);
166
167 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);
168 void packageObjectResult(Dart_Handle, const String& objectGroup, ErrorString *, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::Remote Object>* result, TypeBuilder::OptOutput<bool>* wasThrown);
169 void packageObjectClassResult(Dart_Handle, const String& objectGroup, ErrorS tring*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::R emoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
170 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);
171 void packageIsolateResult(Dart_Handle, const String& objectGroup, ErrorStrin g*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::Remot eObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
172 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);
173 void packageFunctionResult(Dart_Handle, const String& objectGroup, ErrorStri ng*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::Remo teObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
174 void packageMethodResult(Dart_Handle, const String& objectGroup, ErrorString *, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::Remote Object>* result, TypeBuilder::OptOutput<bool>* wasThrown);
175 void packageLocalVariablesResult(Dart_Handle, const String& objectGroup, Err orString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime ::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
176 void packageErrorResult(Dart_Handle, const String& objectGroup, ErrorString* , bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteO bject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
177
178 String getCallFrameId(int ordinal, int asyncOrdinal);
179 Dart_ActivationFrame callFrameForId(const StackTrace& callFrames, const Vect or<StackTrace>& asyncCallStacks, const String& callFrameId);
180
181 Dart_Handle consoleApi();
182
183 String m_name;
184 InspectedStateAccessCheck m_inspectedStateAccessCheck;
185
186 typedef HashMap<String, Vector<String> > ObjectGroupMap;
187 ObjectGroupMap m_objectGroups;
188
189 // FIXME: use RefPtr<DartDebuggerObject> instead of DartDebuggerObject*
190 typedef HashMap<String, DartDebuggerObject*> DebuggerObjectMap;
191 DebuggerObjectMap m_objects;
192
193 DartScriptState* m_scriptState;
194
195 size_t m_nextObjectId;
196 int m_injectedScriptId;
197 InjectedScriptHost* m_host;
198 Dart_PersistentHandle m_consoleApi;
199 };
200
201 } // namespace WebCore
202
203 #endif
OLDNEW
« no previous file with comments | « Source/bindings/dart/DartDebugServer.cpp ('k') | Source/bindings/dart/DartInjectedScript.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698