Diff
Modified: trunk/Source/WebCore/ChangeLog (119588 => 119589)
--- trunk/Source/WebCore/ChangeLog 2012-06-06 13:09:04 UTC (rev 119588)
+++ trunk/Source/WebCore/ChangeLog 2012-06-06 14:12:36 UTC (rev 119589)
@@ -1,3 +1,30 @@
+2012-06-06 Andrey Adaikin <[email protected]>
+
+ Web Inspector: [JSC] Add WebGL instrumentation support
+ https://bugs.webkit.org/show_bug.cgi?id=87975
+
+ Reviewed by Vsevolod Vlasov.
+
+ * bindings/js/JSInjectedScriptManager.cpp:
+ (WebCore::injectAndExecuteFunction):
+ (WebCore::InjectedScriptManager::createInjectedScript):
+ (WebCore):
+ (WebCore::InjectedScriptManager::injectWebGLScript):
+ * bindings/v8/custom/V8InjectedScriptManager.cpp:
+ (WebCore::InjectedScriptManager::injectWebGLScript):
+ * inspector/InjectedScriptManager.cpp:
+ (WebCore::InjectedScriptManager::wrapWebGLRenderingContextForInstrumentation):
+ * inspector/InjectedScriptManager.h:
+ (InjectedScriptManager):
+ * inspector/InspectorInstrumentation.h:
+ (InspectorInstrumentation):
+ * inspector/InspectorWebGLAgent.cpp:
+ (WebCore::InspectorWebGLAgent::wrapWebGLRenderingContextForInstrumentation):
+ * inspector/InspectorWebGLAgent.h:
+ (InspectorWebGLAgent):
+ * inspector/InspectorWebGLInstrumentation.h:
+ (WebCore::InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation):
+
2012-06-06 Tor Arne Vestbø <[email protected]>
Fix a few spelling mistakes in IconDatabase logging
Modified: trunk/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp (119588 => 119589)
--- trunk/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp 2012-06-06 13:09:04 UTC (rev 119588)
+++ trunk/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp 2012-06-06 14:12:36 UTC (rev 119589)
@@ -49,7 +49,7 @@
namespace WebCore {
-ScriptObject InjectedScriptManager::createInjectedScript(const String& source, ScriptState* scriptState, int id)
+static ScriptObject injectAndExecuteFunction(const String& source, ScriptState* scriptState, const MarkedArgumentBuffer& args)
{
JSLock lock(SilenceAssertionsOnly);
@@ -68,21 +68,34 @@
if (callType == CallTypeNone)
return ScriptObject();
- MarkedArgumentBuffer args;
- args.append(toJS(scriptState, globalObject, m_injectedScriptHost.get()));
- args.append(globalThisValue);
- args.append(jsNumber(id));
JSValue result = JSC::call(scriptState, functionValue, callType, callData, globalThisValue, args);
if (result.isObject())
return ScriptObject(scriptState, result.getObject());
return ScriptObject();
}
+ScriptObject InjectedScriptManager::createInjectedScript(const String& source, ScriptState* scriptState, int id)
+{
+ JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
+ JSValue globalThisValue = scriptState->globalThisValue();
+
+ MarkedArgumentBuffer args;
+ args.append(toJS(scriptState, globalObject, m_injectedScriptHost.get()));
+ args.append(globalThisValue);
+ args.append(jsNumber(id));
+
+ return injectAndExecuteFunction(source, scriptState, args);
+}
+
#if ENABLE(WEBGL)
-ScriptObject InjectedScriptManager::injectWebGLScript(const String&, ScriptObject)
+ScriptObject InjectedScriptManager::injectWebGLScript(const String& source, const ScriptObject& glContext)
{
- // FIXME(87975): Implement this!
- return ScriptObject();
+ ScriptState* scriptState = glContext.scriptState();
+
+ MarkedArgumentBuffer args;
+ args.append(glContext.jsValue());
+
+ return injectAndExecuteFunction(source, scriptState, args);
}
#endif
Modified: trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptManager.cpp (119588 => 119589)
--- trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptManager.cpp 2012-06-06 13:09:04 UTC (rev 119588)
+++ trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptManager.cpp 2012-06-06 14:12:36 UTC (rev 119589)
@@ -114,7 +114,7 @@
}
#if ENABLE(WEBGL)
-ScriptObject InjectedScriptManager::injectWebGLScript(const String& scriptSource, ScriptObject glContext)
+ScriptObject InjectedScriptManager::injectWebGLScript(const String& scriptSource, const ScriptObject& glContext)
{
v8::HandleScope scope;
Modified: trunk/Source/WebCore/inspector/InjectedScriptManager.cpp (119588 => 119589)
--- trunk/Source/WebCore/inspector/InjectedScriptManager.cpp 2012-06-06 13:09:04 UTC (rev 119588)
+++ trunk/Source/WebCore/inspector/InjectedScriptManager.cpp 2012-06-06 14:12:36 UTC (rev 119589)
@@ -177,7 +177,7 @@
}
#if ENABLE(WEBGL)
-ScriptObject InjectedScriptManager::wrapWebGLRenderingContextForInstrumentation(ScriptObject glContext)
+ScriptObject InjectedScriptManager::wrapWebGLRenderingContextForInstrumentation(const ScriptObject& glContext)
{
return injectWebGLScript(injectedWebGLScriptSource(), glContext);
}
Modified: trunk/Source/WebCore/inspector/InjectedScriptManager.h (119588 => 119589)
--- trunk/Source/WebCore/inspector/InjectedScriptManager.h 2012-06-06 13:09:04 UTC (rev 119588)
+++ trunk/Source/WebCore/inspector/InjectedScriptManager.h 2012-06-06 14:12:36 UTC (rev 119589)
@@ -65,7 +65,7 @@
void releaseObjectGroup(const String& objectGroup);
#if ENABLE(WEBGL)
- ScriptObject wrapWebGLRenderingContextForInstrumentation(ScriptObject);
+ ScriptObject wrapWebGLRenderingContextForInstrumentation(const ScriptObject&);
#endif
private:
@@ -78,7 +78,7 @@
#if ENABLE(WEBGL)
String injectedWebGLScriptSource();
- ScriptObject injectWebGLScript(const String& source, ScriptObject);
+ ScriptObject injectWebGLScript(const String& source, const ScriptObject&);
#endif
static bool canAccessInspectedWindow(ScriptState*);
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (119588 => 119589)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2012-06-06 13:09:04 UTC (rev 119588)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2012-06-06 14:12:36 UTC (rev 119589)
@@ -238,7 +238,7 @@
#endif
#if ENABLE(WEBGL)
- static ScriptObject wrapWebGLRenderingContextForInstrumentation(Document*, ScriptObject);
+ static ScriptObject wrapWebGLRenderingContextForInstrumentation(Document*, const ScriptObject&);
#endif
static void networkStateChanged(Page*);
Modified: trunk/Source/WebCore/inspector/InspectorWebGLAgent.cpp (119588 => 119589)
--- trunk/Source/WebCore/inspector/InspectorWebGLAgent.cpp 2012-06-06 13:09:04 UTC (rev 119588)
+++ trunk/Source/WebCore/inspector/InspectorWebGLAgent.cpp 2012-06-06 14:12:36 UTC (rev 119589)
@@ -94,7 +94,7 @@
m_state->setBoolean(WebGLAgentState::webGLAgentEnabled, m_enabled);
}
-ScriptObject InspectorWebGLAgent::wrapWebGLRenderingContextForInstrumentation(ScriptObject glContext)
+ScriptObject InspectorWebGLAgent::wrapWebGLRenderingContextForInstrumentation(const ScriptObject& glContext)
{
return m_injectedScriptManager->wrapWebGLRenderingContextForInstrumentation(glContext);
}
Modified: trunk/Source/WebCore/inspector/InspectorWebGLAgent.h (119588 => 119589)
--- trunk/Source/WebCore/inspector/InspectorWebGLAgent.h 2012-06-06 13:09:04 UTC (rev 119588)
+++ trunk/Source/WebCore/inspector/InspectorWebGLAgent.h 2012-06-06 14:12:36 UTC (rev 119589)
@@ -63,7 +63,7 @@
bool enabled() { return m_enabled; }
- ScriptObject wrapWebGLRenderingContextForInstrumentation(ScriptObject);
+ ScriptObject wrapWebGLRenderingContextForInstrumentation(const ScriptObject&);
// Called from the front-end.
virtual void enable(ErrorString*);
Modified: trunk/Source/WebCore/inspector/InspectorWebGLInstrumentation.h (119588 => 119589)
--- trunk/Source/WebCore/inspector/InspectorWebGLInstrumentation.h 2012-06-06 13:09:04 UTC (rev 119588)
+++ trunk/Source/WebCore/inspector/InspectorWebGLInstrumentation.h 2012-06-06 14:12:36 UTC (rev 119589)
@@ -39,7 +39,7 @@
namespace WebCore {
#if ENABLE(WEBGL)
-ScriptObject InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(Document* document, ScriptObject glContext)
+ScriptObject InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(Document* document, const ScriptObject& glContext)
{
#if ENABLE(INSPECTOR)
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) {