Changeset 126028 in webkit
- Timestamp:
- Aug 20, 2012 8:05:09 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r126026 r126028 1 2012-08-20 Andrey Adaikin <aandrey@chromium.org> 2 3 Web Inspector: [WebGL] Add minimum transport protocol from backend to frontend 4 https://bugs.webkit.org/show_bug.cgi?id=88973 5 6 Reviewed by Pavel Feldman. 7 8 Added the following protocol methods to communicate with the WebGL injected 9 module: captureFrame, getTraceLog, dropTraceLog, replayTraceLog. 10 11 * inspector/CodeGeneratorInspector.py: 12 * inspector/InjectedScriptWebGLModule.cpp: 13 (WebCore::InjectedScriptWebGLModule::captureFrame): 14 (WebCore): 15 (WebCore::InjectedScriptWebGLModule::dropTraceLog): 16 (WebCore::InjectedScriptWebGLModule::getTraceLog): 17 (WebCore::InjectedScriptWebGLModule::replayTraceLog): 18 * inspector/InjectedScriptWebGLModule.h: 19 (InjectedScriptWebGLModule): 20 * inspector/Inspector.json: 21 * inspector/InspectorController.cpp: 22 (WebCore::InspectorController::InspectorController): 23 * inspector/InspectorWebGLAgent.cpp: 24 (WebCore::InspectorWebGLAgent::InspectorWebGLAgent): 25 (WebCore::InspectorWebGLAgent::dropTraceLog): 26 (WebCore): 27 (WebCore::InspectorWebGLAgent::captureFrame): 28 (WebCore::InspectorWebGLAgent::getTraceLog): 29 (WebCore::InspectorWebGLAgent::replayTraceLog): 30 * inspector/InspectorWebGLAgent.h: 31 (WebCore): 32 (WebCore::InspectorWebGLAgent::create): 33 (InspectorWebGLAgent): 34 1 35 2012-08-20 Allan Sandfeld Jensen <allan.jensen@nokia.com> 2 36 -
trunk/Source/WebCore/inspector/CodeGeneratorInspector.py
r125248 r126028 59 59 60 60 TYPES_WITH_RUNTIME_CAST_SET = frozenset(["Runtime.RemoteObject", "Runtime.PropertyDescriptor", 61 "Debugger.FunctionDetails", "Debugger.CallFrame", 61 "Debugger.FunctionDetails", "Debugger.CallFrame", "WebGL.TraceLog", 62 62 # This should be a temporary hack. TimelineEvent should be created via generated C++ API. 63 63 "Timeline.TimelineEvent"]) -
trunk/Source/WebCore/inspector/InjectedScriptWebGLModule.cpp
r120957 r126028 73 73 } 74 74 75 void InjectedScriptWebGLModule::captureFrame(ErrorString* errorString, const String& contextId)75 void InjectedScriptWebGLModule::captureFrame(ErrorString* errorString, String* traceLogId) 76 76 { 77 77 ScriptFunctionCall function(injectedScriptObject(), "captureFrame"); 78 function.appendArgument(contextId); 78 RefPtr<InspectorValue> resultValue; 79 makeCall(function, &resultValue); 80 if (!resultValue || resultValue->type() != InspectorValue::TypeString || !resultValue->asString(traceLogId)) 81 *errorString = "Internal error: captureFrame"; 82 } 83 84 void InjectedScriptWebGLModule::dropTraceLog(ErrorString* errorString, const String& traceLogId) 85 { 86 ScriptFunctionCall function(injectedScriptObject(), "dropTraceLog"); 87 function.appendArgument(traceLogId); 79 88 bool hadException = false; 80 89 callFunctionWithEvalEnabled(function, hadException); 81 90 ASSERT(!hadException); 82 91 if (hadException) 83 *errorString = "Internal error"; 92 *errorString = "Internal error: dropTraceLog"; 93 } 94 95 void InjectedScriptWebGLModule::traceLog(ErrorString* errorString, const String& traceLogId, RefPtr<TypeBuilder::WebGL::TraceLog>* traceLog) 96 { 97 ScriptFunctionCall function(injectedScriptObject(), "traceLog"); 98 function.appendArgument(traceLogId); 99 RefPtr<InspectorValue> resultValue; 100 makeCall(function, &resultValue); 101 if (!resultValue || resultValue->type() != InspectorValue::TypeObject) { 102 if (!resultValue->asString(errorString)) 103 *errorString = "Internal error: traceLog"; 104 return; 105 } 106 *traceLog = TypeBuilder::WebGL::TraceLog::runtimeCast(resultValue); 107 } 108 109 void InjectedScriptWebGLModule::replayTraceLog(ErrorString* errorString, const String& traceLogId, int stepNo, String* result) 110 { 111 ScriptFunctionCall function(injectedScriptObject(), "replayTraceLog"); 112 function.appendArgument(traceLogId); 113 function.appendArgument(stepNo); 114 RefPtr<InspectorValue> resultValue; 115 makeCall(function, &resultValue); 116 if (!resultValue || resultValue->type() != InspectorValue::TypeString || !resultValue->asString(result)) 117 *errorString = "Internal error: replayTraceLog"; 84 118 } 85 119 -
trunk/Source/WebCore/inspector/InjectedScriptWebGLModule.h
r120929 r126028 45 45 class InjectedScriptWebGLModule : public InjectedScriptModule { 46 46 public: 47 InjectedScriptWebGLModule(); 48 47 49 virtual String source() const; 48 50 … … 50 52 51 53 ScriptObject wrapWebGLContext(const ScriptObject& glContext); 52 void captureFrame(ErrorString*, const String& contextId);53 54 private: 55 InjectedScriptWebGLModule();54 void captureFrame(ErrorString*, String*); 55 void dropTraceLog(ErrorString*, const String&); 56 void traceLog(ErrorString*, const String&, RefPtr<TypeBuilder::WebGL::TraceLog>*); 57 void replayTraceLog(ErrorString*, const String&, int, String*); 56 58 }; 57 59 -
trunk/Source/WebCore/inspector/Inspector.json
r125399 r126028 3118 3118 "domain": "WebGL", 3119 3119 "hidden": true, 3120 "types": [], 3120 "types": [ 3121 { 3122 "id": "TraceLogId", 3123 "type": "string", 3124 "description": "Unique object identifier." 3125 }, 3126 { 3127 "id": "Call", 3128 "type": "object", 3129 "properties": [ 3130 { "name": "functionName", "type": "string" } 3131 ] 3132 }, 3133 { 3134 "id": "TraceLog", 3135 "type": "object", 3136 "properties": [ 3137 { "name": "id", "$ref": "TraceLogId" }, 3138 { "name": "calls", "type": "array", "items": { "$ref": "Call" }} 3139 ] 3140 } 3141 ], 3121 3142 "commands": [ 3122 3143 { … … 3127 3148 "name": "disable", 3128 3149 "description": "Disables WebGL inspection." 3150 }, 3151 { 3152 "name": "dropTraceLog", 3153 "parameters": [ 3154 { "name": "traceLogId", "$ref": "TraceLogId" } 3155 ] 3156 }, 3157 { 3158 "name": "captureFrame", 3159 "returns": [ 3160 { "name": "traceLogId", "$ref": "TraceLogId" } 3161 ] 3162 }, 3163 { 3164 "name": "getTraceLog", 3165 "parameters": [ 3166 { "name": "traceLogId", "$ref": "TraceLogId" } 3167 ], 3168 "returns": [ 3169 { "name": "traceLog", "$ref": "TraceLog" } 3170 ] 3171 }, 3172 { 3173 "name": "replayTraceLog", 3174 "parameters": [ 3175 { "name": "traceLogId", "$ref": "TraceLogId" }, 3176 { "name": "stepNo", "type": "integer" } 3177 ], 3178 "returns": [ 3179 { "name": "screenshotDataUrl", "type": "string" } 3180 ] 3129 3181 } 3130 3182 ], -
trunk/Source/WebCore/inspector/InspectorController.cpp
r125025 r126028 149 149 150 150 #if ENABLE(WEBGL) 151 m_agents.append(InspectorWebGLAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get()));151 m_agents.append(InspectorWebGLAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get())); 152 152 #endif 153 153 -
trunk/Source/WebCore/inspector/InspectorWebGLAgent.cpp
r120929 r126028 35 35 #include "InspectorWebGLAgent.h" 36 36 37 #include "InjectedScript.h" 37 38 #include "InjectedScriptManager.h" 38 39 #include "InjectedScriptWebGLModule.h" … … 40 41 #include "InspectorState.h" 41 42 #include "InstrumentingAgents.h" 43 #include "Page.h" 42 44 #include "ScriptObject.h" 43 45 #include "ScriptState.h" … … 49 51 }; 50 52 51 InspectorWebGLAgent::InspectorWebGLAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager)53 InspectorWebGLAgent::InspectorWebGLAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, Page* page, InjectedScriptManager* injectedScriptManager) 52 54 : InspectorBaseAgent<InspectorWebGLAgent>("WebGL", instrumentingAgents, state) 55 , m_inspectedPage(page) 53 56 , m_injectedScriptManager(injectedScriptManager) 54 57 , m_frontend(0) … … 96 99 } 97 100 101 void InspectorWebGLAgent::dropTraceLog(ErrorString* errorString, const String& traceLogId) 102 { 103 InjectedScriptWebGLModule module = injectedScriptWebGLModuleForTraceLogId(errorString, traceLogId); 104 if (!module.hasNoValue()) 105 module.dropTraceLog(errorString, traceLogId); 106 } 107 108 void InspectorWebGLAgent::captureFrame(ErrorString* errorString, String* traceLogId) 109 { 110 ScriptState* scriptState = mainWorldScriptState(m_inspectedPage->mainFrame()); 111 InjectedScriptWebGLModule module = InjectedScriptWebGLModule::moduleForState(m_injectedScriptManager, scriptState); 112 if (module.hasNoValue()) { 113 *errorString = "Inspected frame has gone"; 114 return; 115 } 116 module.captureFrame(errorString, traceLogId); 117 } 118 119 void InspectorWebGLAgent::getTraceLog(ErrorString* errorString, const String& traceLogId, RefPtr<TypeBuilder::WebGL::TraceLog>& traceLog) 120 { 121 InjectedScriptWebGLModule module = injectedScriptWebGLModuleForTraceLogId(errorString, traceLogId); 122 if (!module.hasNoValue()) 123 module.traceLog(errorString, traceLogId, &traceLog); 124 } 125 126 void InspectorWebGLAgent::replayTraceLog(ErrorString* errorString, const String& traceLogId, int stepNo, String* result) 127 { 128 InjectedScriptWebGLModule module = injectedScriptWebGLModuleForTraceLogId(errorString, traceLogId); 129 if (!module.hasNoValue()) 130 module.replayTraceLog(errorString, traceLogId, stepNo, result); 131 } 132 98 133 ScriptObject InspectorWebGLAgent::wrapWebGLRenderingContextForInstrumentation(const ScriptObject& glContext) 99 134 { … … 110 145 } 111 146 147 InjectedScriptWebGLModule InspectorWebGLAgent::injectedScriptWebGLModuleForTraceLogId(ErrorString* errorString, const String& traceLogId) 148 { 149 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(traceLogId); 150 if (injectedScript.hasNoValue()) { 151 *errorString = "Inspected frame has gone"; 152 return InjectedScriptWebGLModule(); 153 } 154 InjectedScriptWebGLModule module = InjectedScriptWebGLModule::moduleForState(m_injectedScriptManager, injectedScript.scriptState()); 155 if (module.hasNoValue()) { 156 ASSERT_NOT_REACHED(); 157 *errorString = "Internal error: no WebGL module"; 158 return InjectedScriptWebGLModule(); 159 } 160 return module; 161 } 162 112 163 } // namespace WebCore 113 164 -
trunk/Source/WebCore/inspector/InspectorWebGLAgent.h
r119589 r126028 36 36 #include "InspectorBaseAgent.h" 37 37 #include "InspectorFrontend.h" 38 #include "InspectorTypeBuilder.h" 38 39 #include "PlatformString.h" 39 40 #include "ScriptState.h" … … 44 45 45 46 class InjectedScriptManager; 47 class InjectedScriptWebGLModule; 46 48 class InspectorState; 47 49 class InstrumentingAgents; 50 class Page; 48 51 class ScriptObject; 49 52 … … 52 55 class InspectorWebGLAgent : public InspectorBaseAgent<InspectorWebGLAgent>, public InspectorBackendDispatcher::WebGLCommandHandler { 53 56 public: 54 static PassOwnPtr<InspectorWebGLAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager)57 static PassOwnPtr<InspectorWebGLAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state, Page* page, InjectedScriptManager* injectedScriptManager) 55 58 { 56 return adoptPtr(new InspectorWebGLAgent(instrumentingAgents, state, injectedScriptManager));59 return adoptPtr(new InspectorWebGLAgent(instrumentingAgents, state, page, injectedScriptManager)); 57 60 } 58 61 ~InspectorWebGLAgent(); … … 69 72 virtual void enable(ErrorString*); 70 73 virtual void disable(ErrorString*); 74 virtual void dropTraceLog(ErrorString*, const String&); 75 virtual void captureFrame(ErrorString*, String*); 76 virtual void getTraceLog(ErrorString*, const String&, RefPtr<TypeBuilder::WebGL::TraceLog>&); 77 virtual void replayTraceLog(ErrorString*, const String&, int, String*); 71 78 72 79 // Called from the injected script. … … 75 82 76 83 private: 77 InspectorWebGLAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*);84 InspectorWebGLAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*); 78 85 86 InjectedScriptWebGLModule injectedScriptWebGLModuleForTraceLogId(ErrorString*, const String&); 87 88 Page* m_inspectedPage; 79 89 InjectedScriptManager* m_injectedScriptManager; 80 90 InspectorFrontend::WebGL* m_frontend;
Note: See TracChangeset
for help on using the changeset viewer.