Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 38 #include "core/inspector/ScriptArguments.h" | 38 #include "core/inspector/ScriptArguments.h" |
| 39 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
| 40 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 class InjectedScriptModule; | 44 class InjectedScriptModule; |
| 45 class Node; | 45 class Node; |
| 46 class SerializedScriptValue; | 46 class SerializedScriptValue; |
| 47 | 47 |
| 48 class InjectedScript FINAL : public InjectedScriptBase { | 48 class InjectedScript : public virtual InjectedScriptBase { |
|
vsm
2014/06/03 14:24:49
Should this class be moved to bindings? Or, perha
| |
| 49 public: | 49 public: |
| 50 InjectedScript(); | |
| 51 virtual ~InjectedScript() { } | 50 virtual ~InjectedScript() { } |
| 52 | 51 |
| 53 void evaluate( | 52 virtual void evaluate(ErrorString*, |
| 53 const String& expression, | |
| 54 const String& objectGroup, | |
| 55 bool includeCommandLineAPI, | |
| 56 bool returnByValue, | |
| 57 bool generatePreview, | |
| 58 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, | |
| 59 TypeBuilder::OptOutput<bool>* wasThrown) = 0; | |
| 60 virtual void callFunctionOn(ErrorString*, | |
| 61 const String& objectId, | |
| 62 const String& expression, | |
| 63 const String& arguments, | |
| 64 bool returnByValue, | |
| 65 bool generatePreview, | |
| 66 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, | |
| 67 TypeBuilder::OptOutput<bool>* wasThrown) = 0; | |
| 68 virtual void evaluateOnCallFrame( | |
| 69 ErrorString*, | |
| 70 const StackTrace& callFrames, | |
| 71 const Vector<StackTrace>& asyncCallStacks, | |
| 72 const String& callFrameId, | |
| 73 const String& expression, | |
| 74 const String& objectGroup, | |
| 75 bool includeCommandLineAPI, | |
| 76 bool returnByValue, | |
| 77 bool generatePreview, | |
| 78 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, | |
| 79 TypeBuilder::OptOutput<bool>* wasThrown) = 0; | |
| 80 virtual void getCompletionsOnCallFrame( | |
| 81 ErrorString*, | |
| 82 const StackTrace& callFrames, | |
| 83 const Vector<StackTrace>& asyncCallStacks, | |
| 84 const String& callFrameId, | |
| 85 const String& expression, | |
| 86 RefPtr<TypeBuilder::Array<String> >* result) = 0; | |
| 87 virtual void restartFrame(ErrorString*, const StackTrace& callFrames, const String& callFrameId, RefPtr<JSONObject>* result) = 0; | |
| 88 virtual void getStepInPositions(ErrorString*, const StackTrace& callFrames, const String& callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Loca tion> >& positions) = 0; | |
| 89 virtual void setVariableValue(ErrorString*, const StackTrace& callFrames, co nst String* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber, const String& variableName, const String& newValueStr) = 0; | |
| 90 virtual void getFunctionDetails(ErrorString*, const String& functionId, RefP tr<TypeBuilder::Debugger::FunctionDetails>* result) = 0; | |
| 91 virtual void getCompletions(ErrorString*, const String& expression, RefPtr<T ypeBuilder::Array<String> >* result) = 0; | |
| 92 virtual void getProperties(ErrorString*, const String& objectId, bool ownPro perties, bool accessorPropertiesOnly, RefPtr<TypeBuilder::Array<TypeBuilder::Run time::PropertyDescriptor> >* result) = 0; | |
| 93 virtual void getInternalProperties(ErrorString*, const String& objectId, Ref Ptr<TypeBuilder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor> >* resu lt) = 0; | |
| 94 virtual void getProperty(ErrorString*, const String& objectId, const RefPtr< JSONArray>& propertyPath, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, Ty peBuilder::OptOutput<bool>* wasThrown) = 0; | |
| 95 | |
| 96 virtual Node* nodeForObjectId(const String& objectId) = 0; | |
| 97 virtual void releaseObject(const String& objectId) = 0; | |
| 98 | |
| 99 virtual PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > wr apCallFrames(const StackTrace&, int asyncOrdinal) = 0; | |
| 100 | |
| 101 virtual PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(const Scri ptValue&, const String& groupName, bool generatePreview = false) = 0; | |
| 102 virtual PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const Scrip tValue& table, const ScriptValue& columns) = 0; | |
| 103 | |
| 104 virtual ActivationFrame findCallFrameById(ErrorString*, const StackTrace& to pCallFrame, const String& callFrameId) = 0; | |
| 105 | |
| 106 virtual void releaseObjectGroup(const String&) = 0; | |
| 107 }; | |
| 108 | |
| 109 class V8InjectedScript FINAL : public V8InjectedScriptBase, public InjectedScrip t { | |
| 110 public: | |
| 111 V8InjectedScript(); | |
| 112 virtual ~V8InjectedScript() { } | |
| 113 | |
| 114 virtual void evaluate( | |
| 54 ErrorString*, | 115 ErrorString*, |
| 55 const String& expression, | 116 const String& expression, |
| 56 const String& objectGroup, | 117 const String& objectGroup, |
| 57 bool includeCommandLineAPI, | 118 bool includeCommandLineAPI, |
| 58 bool returnByValue, | 119 bool returnByValue, |
| 59 bool generatePreview, | 120 bool generatePreview, |
| 60 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, | 121 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, |
| 61 TypeBuilder::OptOutput<bool>* wasThrown); | 122 TypeBuilder::OptOutput<bool>* wasThrown); |
| 62 void callFunctionOn( | 123 virtual void callFunctionOn( |
| 63 ErrorString*, | 124 ErrorString*, |
| 64 const String& objectId, | 125 const String& objectId, |
| 65 const String& expression, | 126 const String& expression, |
| 66 const String& arguments, | 127 const String& arguments, |
| 67 bool returnByValue, | 128 bool returnByValue, |
| 68 bool generatePreview, | 129 bool generatePreview, |
| 69 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, | 130 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, |
| 70 TypeBuilder::OptOutput<bool>* wasThrown); | 131 TypeBuilder::OptOutput<bool>* wasThrown); |
| 71 void evaluateOnCallFrame( | 132 virtual void evaluateOnCallFrame( |
| 72 ErrorString*, | 133 ErrorString*, |
| 73 const ScriptValue& callFrames, | 134 const StackTrace& callFrames, |
| 74 const Vector<ScriptValue>& asyncCallStacks, | 135 const Vector<StackTrace>& asyncCallStacks, |
| 75 const String& callFrameId, | 136 const String& callFrameId, |
| 76 const String& expression, | 137 const String& expression, |
| 77 const String& objectGroup, | 138 const String& objectGroup, |
| 78 bool includeCommandLineAPI, | 139 bool includeCommandLineAPI, |
| 79 bool returnByValue, | 140 bool returnByValue, |
| 80 bool generatePreview, | 141 bool generatePreview, |
| 81 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, | 142 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, |
| 82 TypeBuilder::OptOutput<bool>* wasThrown); | 143 TypeBuilder::OptOutput<bool>* wasThrown); |
| 83 void restartFrame(ErrorString*, const ScriptValue& callFrames, const String& callFrameId, RefPtr<JSONObject>* result); | 144 virtual void getCompletionsOnCallFrame( |
| 84 void getStepInPositions(ErrorString*, const ScriptValue& callFrames, const S tring& callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location> > & positions); | 145 ErrorString*, |
| 85 void setVariableValue(ErrorString*, const ScriptValue& callFrames, const Str ing* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber, const S tring& variableName, const String& newValueStr); | 146 const StackTrace& callFrames, |
| 86 void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeB uilder::Debugger::FunctionDetails>* result); | 147 const Vector<StackTrace>& asyncCallStacks, |
| 87 void getProperties(ErrorString*, const String& objectId, bool ownProperties, bool accessorPropertiesOnly, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::Pr opertyDescriptor> >* result); | 148 const String& callFrameId, |
| 88 void getInternalProperties(ErrorString*, const String& objectId, RefPtr<Type Builder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor> >* result); | 149 const String& expression, |
| 89 Node* nodeForObjectId(const String& objectId); | 150 RefPtr<TypeBuilder::Array<String> >* result); |
| 90 void releaseObject(const String& objectId); | 151 virtual void restartFrame(ErrorString*, const StackTrace& callFrames, const String& callFrameId, RefPtr<JSONObject>* result); |
| 152 virtual void getStepInPositions(ErrorString*, const StackTrace& callFrames, const String& callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Loca tion> >& positions); | |
| 153 virtual void setVariableValue(ErrorString*, const StackTrace& callFrames, co nst String* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber, const String& variableName, const String& newValueStr); | |
| 154 virtual void getFunctionDetails(ErrorString*, const String& functionId, RefP tr<TypeBuilder::Debugger::FunctionDetails>* result); | |
| 155 virtual void getCompletions(ErrorString*, const String& expression, RefPtr<T ypeBuilder::Array<String> >* out_result); | |
| 156 virtual void getProperties(ErrorString*, const String& objectId, bool ownPro perties, bool accessorPropertiesOnly, RefPtr<TypeBuilder::Array<TypeBuilder::Run time::PropertyDescriptor> >* result); | |
| 157 virtual void getInternalProperties(ErrorString*, const String& objectId, Ref Ptr<TypeBuilder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor> >* resu lt); | |
| 158 virtual void getProperty(ErrorString*, const String& objectId, const RefPtr< JSONArray>& propertyPath, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, Ty peBuilder::OptOutput<bool>* wasThrown); | |
| 159 virtual Node* nodeForObjectId(const String& objectId); | |
| 160 virtual void releaseObject(const String& objectId); | |
| 91 | 161 |
| 92 PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > wrapCallFr ames(const ScriptValue&, int asyncOrdinal); | 162 virtual PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > wr apCallFrames(const StackTrace&, int asyncOrdinal); |
| 93 | 163 |
| 94 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(const ScriptValue& , const String& groupName, bool generatePreview = false) const; | 164 virtual PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(const Scri ptValue&, const String& groupName, bool generatePreview = false); |
| 95 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const ScriptValue& table, const ScriptValue& columns) const; | 165 virtual PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const Scrip tValue& table, const ScriptValue& columns); |
| 166 | |
| 96 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapNode(Node*, const String& groupName); | 167 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapNode(Node*, const String& groupName); |
| 97 ScriptValue findObjectById(const String& objectId) const; | 168 ScriptValue findObjectById(const String& objectId) const; |
| 98 ScriptValue findCallFrameById(ErrorString*, const ScriptValue& topCallFrame, const String& callFrameId); | 169 virtual ActivationFrame findCallFrameById(ErrorString*, const StackTrace& to pCallFrame, const String& callFrameId); |
| 99 | 170 |
| 100 void inspectNode(Node*); | 171 void inspectNode(Node*); |
| 101 void releaseObjectGroup(const String&); | 172 virtual void releaseObjectGroup(const String&); |
| 102 | 173 |
| 103 private: | 174 private: |
| 104 friend class InjectedScriptModule; | 175 friend class InjectedScriptModule; |
| 105 friend InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState*) ; | 176 friend InjectedScript& InjectedScriptManager::injectedScriptFor(ScriptState* ); |
| 106 InjectedScript(ScriptObject, InspectedStateAccessCheck); | 177 V8InjectedScript(ScriptObject, InspectedStateAccessCheck); |
| 107 | 178 |
| 108 ScriptValue nodeAsScriptValue(Node*); | 179 ScriptValue nodeAsScriptValue(Node*); |
| 109 }; | 180 }; |
| 110 | 181 |
| 111 | |
| 112 } // namespace WebCore | 182 } // namespace WebCore |
| 113 | 183 |
| 114 #endif | 184 #endif |
| OLD | NEW |