Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (120956 => 120957)
--- trunk/Source/WebCore/CMakeLists.txt 2012-06-21 19:20:00 UTC (rev 120956)
+++ trunk/Source/WebCore/CMakeLists.txt 2012-06-21 19:26:37 UTC (rev 120957)
@@ -2678,14 +2678,14 @@
LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/InjectedScriptSource.h)
-# Generate InjectedWebGLScriptSource.h
+# Generate InjectedScriptWebGLModuleSource.h
IF (ENABLE_WEBGL)
ADD_CUSTOM_COMMAND(
- OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/InjectedWebGLScriptSource.h
- MAIN_DEPENDENCY inspector/InjectedWebGLScriptSource.js
- COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/inspector/xxd.pl InjectedWebGLScriptSource_js ${WEBCORE_DIR}/inspector/InjectedWebGLScriptSource.js ${DERIVED_SOURCES_WEBCORE_DIR}/InjectedWebGLScriptSource.h
+ OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/InjectedScriptWebGLModuleSource.h
+ MAIN_DEPENDENCY inspector/InjectedScriptWebGLModuleSource.js
+ COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/inspector/xxd.pl InjectedScriptWebGLModuleSource_js ${WEBCORE_DIR}/inspector/InjectedScriptWebGLModuleSource.js ${DERIVED_SOURCES_WEBCORE_DIR}/InjectedScriptWebGLModuleSource.h
VERBATIM)
- LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/InjectedWebGLScriptSource.h)
+ LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/InjectedScriptWebGLModuleSource.h)
ENDIF ()
Modified: trunk/Source/WebCore/ChangeLog (120956 => 120957)
--- trunk/Source/WebCore/ChangeLog 2012-06-21 19:20:00 UTC (rev 120956)
+++ trunk/Source/WebCore/ChangeLog 2012-06-21 19:26:37 UTC (rev 120957)
@@ -1,3 +1,24 @@
+2012-06-21 Andrey Adaikin <[email protected]>
+
+ Web Inspector: [WebGL] Rename InjectedWebGLScriptSource.js -> InjectedScriptWebGLModuleSource.js
+ https://bugs.webkit.org/show_bug.cgi?id=89675
+
+ Reviewed by Pavel Feldman.
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * DerivedSources.pri:
+ * GNUmakefile.am:
+ * GNUmakefile.list.am:
+ * WebCore.gyp/WebCore.gyp:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * inspector/InjectedScriptWebGLModule.cpp:
+ (WebCore::InjectedScriptWebGLModule::source):
+ * inspector/InjectedScriptWebGLModuleSource.js: Renamed from Source/WebCore/inspector/InjectedWebGLScriptSource.js.
+ (.):
+
2012-06-21 Kalev Lember <[email protected]>
[GTK] Fix NPAPI plugins on Windows
Modified: trunk/Source/WebCore/DerivedSources.make (120956 => 120957)
--- trunk/Source/WebCore/DerivedSources.make 2012-06-21 19:20:00 UTC (rev 120956)
+++ trunk/Source/WebCore/DerivedSources.make 2012-06-21 19:26:37 UTC (rev 120957)
@@ -991,10 +991,10 @@
InjectedScriptSource.h : InjectedScriptSource.js
perl $(WebCore)/inspector/xxd.pl InjectedScriptSource_js $(WebCore)/inspector/InjectedScriptSource.js InjectedScriptSource.h
-all : InjectedWebGLScriptSource.h
+all : InjectedScriptWebGLModuleSource.h
-InjectedWebGLScriptSource.h : InjectedWebGLScriptSource.js
- perl $(WebCore)/inspector/xxd.pl InjectedWebGLScriptSource_js $(WebCore)/inspector/InjectedWebGLScriptSource.js InjectedWebGLScriptSource.h
+InjectedScriptWebGLModuleSource.h : InjectedScriptWebGLModuleSource.js
+ perl $(WebCore)/inspector/xxd.pl InjectedScriptWebGLModuleSource_js $(WebCore)/inspector/InjectedScriptWebGLModuleSource.js InjectedScriptWebGLModuleSource.h
-include $(JS_DOM_HEADERS:.h=.dep)
Modified: trunk/Source/WebCore/DerivedSources.pri (120956 => 120957)
--- trunk/Source/WebCore/DerivedSources.pri 2012-06-21 19:20:00 UTC (rev 120956)
+++ trunk/Source/WebCore/DerivedSources.pri 2012-06-21 19:26:37 UTC (rev 120957)
@@ -61,7 +61,7 @@
INJECTED_SCRIPT_SOURCE = $$PWD/inspector/InjectedScriptSource.js
-INJECTED_WEBGL_SCRIPT_SOURCE = $$PWD/inspector/InjectedWebGLScriptSource.js
+INJECTED_SCRIPT_WEBGL_MODULE_SOURCE = $$PWD/inspector/InjectedScriptWebGLModuleSource.js
DEBUGGER_SCRIPT_SOURCE = $$PWD/bindings/v8/DebuggerScript.js
@@ -778,11 +778,11 @@
GENERATORS += injectedScriptSource
# GENERATOR 2-b: inspector webgl injected script source compiler
-InjectedWebGLScriptSource.output = InjectedWebGLScriptSource.h
-InjectedWebGLScriptSource.input = INJECTED_WEBGL_SCRIPT_SOURCE
-InjectedWebGLScriptSource.commands = perl $$PWD/inspector/xxd.pl InjectedWebGLScriptSource_js ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
-InjectedWebGLScriptSource.add_output_to_sources = false
-GENERATORS += InjectedWebGLScriptSource
+InjectedScriptWebGLModuleSource.output = InjectedScriptWebGLModuleSource.h
+InjectedScriptWebGLModuleSource.input = INJECTED_SCRIPT_WEBGL_MODULE_SOURCE
+InjectedScriptWebGLModuleSource.commands = perl $$PWD/inspector/xxd.pl InjectedScriptWebGLModuleSource_js ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
+InjectedScriptWebGLModuleSource.add_output_to_sources = false
+GENERATORS += InjectedScriptWebGLModuleSource
# GENERATOR 2-c: inspector debugger script source compiler
debuggerScriptSource.output = DebuggerScriptSource.h
Modified: trunk/Source/WebCore/GNUmakefile.am (120956 => 120957)
--- trunk/Source/WebCore/GNUmakefile.am 2012-06-21 19:20:00 UTC (rev 120956)
+++ trunk/Source/WebCore/GNUmakefile.am 2012-06-21 19:26:37 UTC (rev 120957)
@@ -846,8 +846,8 @@
DerivedSources/WebCore/InspectorBackendDispatcher.h: DerivedSources/WebCore/InspectorBackendDispatcher.cpp
DerivedSources/WebCore/InjectedScriptSource.h: $(WebCore)/inspector/InjectedScriptSource.js
$(AM_V_GEN)$(PERL) $(WebCore)/inspector/xxd.pl InjectedScriptSource_js $(WebCore)/inspector/InjectedScriptSource.js $(GENSOURCES_WEBCORE)/InjectedScriptSource.h
-DerivedSources/WebCore/InjectedWebGLScriptSource.h: $(WebCore)/inspector/InjectedWebGLScriptSource.js
- $(AM_V_GEN)$(PERL) $(WebCore)/inspector/xxd.pl InjectedWebGLScriptSource_js $(WebCore)/inspector/InjectedWebGLScriptSource.js $(GENSOURCES_WEBCORE)/InjectedWebGLScriptSource.h
+DerivedSources/WebCore/InjectedScriptWebGLModuleSource.h: $(WebCore)/inspector/InjectedScriptWebGLModuleSource.js
+ $(AM_V_GEN)$(PERL) $(WebCore)/inspector/xxd.pl InjectedScriptWebGLModuleSource_js $(WebCore)/inspector/InjectedScriptWebGLModuleSource.js $(GENSOURCES_WEBCORE)/InjectedScriptWebGLModuleSource.h
if ENABLE_WEB_AUDIO
# Installing HRTF database wav files
@@ -1104,7 +1104,7 @@
Source/WebCore/icu/LICENSE \
Source/WebCore/inspector/CodeGeneratorInspector.py \
Source/WebCore/inspector/InjectedScriptSource.js \
- Source/WebCore/inspector/InjectedWebGLScriptSource.js \
+ Source/WebCore/inspector/InjectedScriptWebGLModuleSource.js \
Source/WebCore/inspector/Inspector.json \
Source/WebCore/inspector/Inspector-1.0.json \
Source/WebCore/inspector/generate-inspector-protocol-version \
Modified: trunk/Source/WebCore/GNUmakefile.list.am (120956 => 120957)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-06-21 19:20:00 UTC (rev 120956)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-06-21 19:26:37 UTC (rev 120957)
@@ -20,7 +20,7 @@
DerivedSources/WebCore/HTMLNames.cpp \
DerivedSources/WebCore/HTMLNames.h \
DerivedSources/WebCore/InjectedScriptSource.h \
- DerivedSources/WebCore/InjectedWebGLScriptSource.h \
+ DerivedSources/WebCore/InjectedScriptWebGLModuleSource.h \
DerivedSources/WebCore/InspectorBackendDispatcher.cpp \
DerivedSources/WebCore/InspectorBackendDispatcher.h \
DerivedSources/WebCore/InspectorFrontend.cpp \
Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (120956 => 120957)
--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2012-06-21 19:20:00 UTC (rev 120956)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2012-06-21 19:26:37 UTC (rev 120957)
@@ -441,21 +441,21 @@
'type': 'none',
'actions': [
{
- 'action_name': 'generateInjectedWebGLScriptSource',
+ 'action_name': 'generateInjectedScriptWebGLModuleSource',
'inputs': [
- '../inspector/InjectedWebGLScriptSource.js',
+ '../inspector/InjectedScriptWebGLModuleSource.js',
],
'outputs': [
- '<(SHARED_INTERMEDIATE_DIR)/webkit/InjectedWebGLScriptSource.h',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/InjectedScriptWebGLModuleSource.h',
],
'action': [
'perl',
'../inspector/xxd.pl',
- 'InjectedWebGLScriptSource_js',
+ 'InjectedScriptWebGLModuleSource_js',
'<@(_inputs)',
'<@(_outputs)'
],
- 'message': 'Generating InjectedWebGLScriptSource.h from InjectedWebGLScriptSource.js',
+ 'message': 'Generating InjectedScriptWebGLModuleSource.h from InjectedScriptWebGLModuleSource.js',
},
]
},
Modified: trunk/Source/WebCore/WebCore.gypi (120956 => 120957)
--- trunk/Source/WebCore/WebCore.gypi 2012-06-21 19:20:00 UTC (rev 120956)
+++ trunk/Source/WebCore/WebCore.gypi 2012-06-21 19:26:37 UTC (rev 120957)
@@ -7268,7 +7268,7 @@
'<(PRODUCT_DIR)/DerivedSources/WebCore/HTMLNames.cpp',
'<(PRODUCT_DIR)/DerivedSources/WebCore/HeaderDetection.h',
'<(PRODUCT_DIR)/DerivedSources/WebCore/InjectedScriptSource.h',
- '<(PRODUCT_DIR)/DerivedSources/WebCore/InjectedWebGLScriptSource.h',
+ '<(PRODUCT_DIR)/DerivedSources/WebCore/InjectedScriptWebGLModuleSource.h',
'<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorBackendDispatcher.cpp',
'<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorBackendDispatcher.h',
'<(PRODUCT_DIR)/DerivedSources/WebCore/InspectorBackendCommands.js',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (120956 => 120957)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-06-21 19:20:00 UTC (rev 120956)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-06-21 19:26:37 UTC (rev 120957)
@@ -594,7 +594,7 @@
>
</File>
<File
- RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\InjectedWebGLScriptSource.h"
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\InjectedScriptWebGLModuleSource.h"
>
</File>
<File
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (120956 => 120957)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-06-21 19:20:00 UTC (rev 120956)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-06-21 19:26:37 UTC (rev 120957)
@@ -11482,8 +11482,8 @@
AA4C3A750B2B1679002334A2 /* StyleElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StyleElement.h; sourceTree = "<group>"; };
AA73183C159255B900A93E6E /* InjectedScriptWebGLModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScriptWebGLModule.cpp; sourceTree = "<group>"; };
AA73183D159255B900A93E6E /* InjectedScriptWebGLModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScriptWebGLModule.h; sourceTree = "<group>"; };
- AA9030FE157E16A000276247 /* InjectedWebGLScriptSource.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = InjectedWebGLScriptSource.js; sourceTree = "<group>"; };
- AA912750157E35A500454E54 /* InjectedWebGLScriptSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedWebGLScriptSource.h; sourceTree = "<group>"; };
+ AA9030FE157E16A000276247 /* InjectedScriptWebGLModuleSource.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = InjectedScriptWebGLModuleSource.js; sourceTree = "<group>"; };
+ AA912750157E35A500454E54 /* InjectedScriptWebGLModuleSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScriptWebGLModuleSource.h; sourceTree = "<group>"; };
AAB6054A15874C58007B5031 /* InjectedScriptBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScriptBase.cpp; sourceTree = "<group>"; };
AAB6054B15874C58007B5031 /* InjectedScriptBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScriptBase.h; sourceTree = "<group>"; };
AAB6054C15874C58007B5031 /* InjectedScriptModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScriptModule.cpp; sourceTree = "<group>"; };
@@ -14377,7 +14377,7 @@
isa = PBXGroup;
children = (
7A563E5412DE32B000F4536D /* InjectedScriptSource.h */,
- AA912750157E35A500454E54 /* InjectedWebGLScriptSource.h */,
+ AA912750157E35A500454E54 /* InjectedScriptWebGLModuleSource.h */,
4F707A9711EF679400ACDA69 /* InspectorBackendDispatcher.cpp */,
4F707A9811EF679400ACDA69 /* InspectorBackendDispatcher.h */,
4F4F5FFA11CBD2D200A186BF /* InspectorFrontend.cpp */,
@@ -14429,7 +14429,7 @@
7A563F9512DF5C9100F4536D /* InjectedScriptSource.js */,
AA73183C159255B900A93E6E /* InjectedScriptWebGLModule.cpp */,
AA73183D159255B900A93E6E /* InjectedScriptWebGLModule.h */,
- AA9030FE157E16A000276247 /* InjectedWebGLScriptSource.js */,
+ AA9030FE157E16A000276247 /* InjectedScriptWebGLModuleSource.js */,
1C435CD414E8545B004E10EA /* Inspector-0.1.json */,
1C435CD514E8545B004E10EA /* Inspector-1.0.json */,
1C435CD314E8544F004E10EA /* Inspector.json */,
Modified: trunk/Source/WebCore/inspector/InjectedScriptWebGLModule.cpp (120956 => 120957)
--- trunk/Source/WebCore/inspector/InjectedScriptWebGLModule.cpp 2012-06-21 19:20:00 UTC (rev 120956)
+++ trunk/Source/WebCore/inspector/InjectedScriptWebGLModule.cpp 2012-06-21 19:26:37 UTC (rev 120957)
@@ -36,7 +36,7 @@
#include "InjectedScript.h"
#include "InjectedScriptManager.h"
-#include "InjectedWebGLScriptSource.h"
+#include "InjectedScriptWebGLModuleSource.h"
#include "ScriptFunctionCall.h"
#include "ScriptObject.h"
@@ -56,7 +56,7 @@
String InjectedScriptWebGLModule::source() const
{
- return String(reinterpret_cast<const char*>(InjectedWebGLScriptSource_js), sizeof(InjectedWebGLScriptSource_js));
+ return String(reinterpret_cast<const char*>(InjectedScriptWebGLModuleSource_js), sizeof(InjectedScriptWebGLModuleSource_js));
}
ScriptObject InjectedScriptWebGLModule::wrapWebGLContext(const ScriptObject& glContext)
Copied: trunk/Source/WebCore/inspector/InjectedScriptWebGLModuleSource.js (from rev 120956, trunk/Source/WebCore/inspector/InjectedWebGLScriptSource.js) (0 => 120957)
--- trunk/Source/WebCore/inspector/InjectedScriptWebGLModuleSource.js (rev 0)
+++ trunk/Source/WebCore/inspector/InjectedScriptWebGLModuleSource.js 2012-06-21 19:26:37 UTC (rev 120957)
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @param {InjectedScriptHost} InjectedScriptHost
+ */
+(function (InjectedScriptHost, inspectedWindow, injectedScriptId) {
+
+/**
+ * @constructor
+ */
+var InjectedScript = function()
+{
+ this._lastBoundObjectId = 0;
+ this._idToWrapperProxy = {};
+ this._idToRealWebGLContext = {};
+ this._capturingFrameInfo = null;
+}
+
+InjectedScript.prototype = {
+ wrapWebGLContext: function(glContext)
+ {
+ for (var id in this._idToRealWebGLContext) {
+ if (this._idToRealWebGLContext[id] === glContext)
+ return this._idToWrapperProxy[id];
+ }
+
+ var proxy = {};
+ var nameProcessed = {};
+ nameProcessed.__proto__ = null;
+ nameProcessed.constructor = true;
+
+ function processName(name) {
+ if (nameProcessed[name])
+ return;
+ nameProcessed[name] = true;
+ if (typeof glContext[name] === "function")
+ proxy[name] = injectedScript._wrappedFunction.bind(injectedScript, glContext, name);
+ else
+ Object.defineProperty(proxy, name, {
+ get: function()
+ {
+ return glContext[name];
+ },
+ set: function(value)
+ {
+ glContext[name] = value;
+ }
+ });
+ }
+
+ for (var o = glContext; o; o = o.__proto__)
+ Object.getOwnPropertyNames(o).forEach(processName);
+
+ // In order to emulate "instanceof".
+ proxy.__proto__ = glContext.__proto__;
+ proxy.constructor = glContext.constructor;
+
+ var contextId = this._generateObjectId();
+ this._idToWrapperProxy[contextId] = proxy;
+ this._idToRealWebGLContext[contextId] = glContext;
+ InjectedScriptHost.webGLContextCreated(contextId);
+
+ return proxy;
+ },
+
+ _generateObjectId: function()
+ {
+ var id = ++this._lastBoundObjectId;
+ var objectId = "{\"injectedScriptId\":" + injectedScriptId + ",\"webGLId\":" + id + "}";
+ return objectId;
+ },
+
+ captureFrame: function(contextId)
+ {
+ this._capturingFrameInfo = {
+ contextId: contextId,
+ capturedCallsNum: 0
+ };
+ },
+
+ _stopCapturing: function(info)
+ {
+ if (this._capturingFrameInfo === info)
+ this._capturingFrameInfo = null;
+ },
+
+ _wrappedFunction: function(glContext, functionName)
+ {
+ // Call real WebGL function.
+ var args = Array.prototype.slice.call(arguments, 2);
+ var result = glContext[functionName].apply(glContext, args);
+
+ if (this._capturingFrameInfo && this._idToRealWebGLContext[this._capturingFrameInfo.contextId] === glContext) {
+ var capturedCallsNum = ++this._capturingFrameInfo.capturedCallsNum;
+ if (capturedCallsNum === 1)
+ this._setZeroTimeouts(this._stopCapturing.bind(this, this._capturingFrameInfo));
+ InjectedScriptHost.webGLReportFunctionCall(this._capturingFrameInfo.contextId, functionName, "[" + args.join(", ") + "]", result + "");
+ }
+
+ return result;
+ },
+
+ _setZeroTimeouts: function(callback)
+ {
+ // We need a fastest async callback, whatever fires first.
+ // Usually a postMessage should be faster than a setTimeout(0).
+ var channel = new MessageChannel();
+ channel.port1._onmessage_ = callback;
+ channel.port2.postMessage("");
+ inspectedWindow.setTimeout(callback, 0);
+ }
+};
+
+var injectedScript = new InjectedScript();
+return injectedScript;
+
+})
Deleted: trunk/Source/WebCore/inspector/InjectedWebGLScriptSource.js (120956 => 120957)
--- trunk/Source/WebCore/inspector/InjectedWebGLScriptSource.js 2012-06-21 19:20:00 UTC (rev 120956)
+++ trunk/Source/WebCore/inspector/InjectedWebGLScriptSource.js 2012-06-21 19:26:37 UTC (rev 120957)
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @param {InjectedScriptHost} InjectedScriptHost
- */
-(function (InjectedScriptHost, inspectedWindow, injectedScriptId) {
-
-/**
- * @constructor
- */
-var InjectedScript = function()
-{
- this._lastBoundObjectId = 0;
- this._idToWrapperProxy = {};
- this._idToRealWebGLContext = {};
- this._capturingFrameInfo = null;
-}
-
-InjectedScript.prototype = {
- wrapWebGLContext: function(glContext)
- {
- for (var id in this._idToRealWebGLContext) {
- if (this._idToRealWebGLContext[id] === glContext)
- return this._idToWrapperProxy[id];
- }
-
- var proxy = {};
- var nameProcessed = {};
- nameProcessed.__proto__ = null;
- nameProcessed.constructor = true;
-
- function processName(name) {
- if (nameProcessed[name])
- return;
- nameProcessed[name] = true;
- if (typeof glContext[name] === "function")
- proxy[name] = injectedScript._wrappedFunction.bind(injectedScript, glContext, name);
- else
- Object.defineProperty(proxy, name, {
- get: function()
- {
- return glContext[name];
- },
- set: function(value)
- {
- glContext[name] = value;
- }
- });
- }
-
- for (var o = glContext; o; o = o.__proto__)
- Object.getOwnPropertyNames(o).forEach(processName);
-
- // In order to emulate "instanceof".
- proxy.__proto__ = glContext.__proto__;
- proxy.constructor = glContext.constructor;
-
- var contextId = this._generateObjectId();
- this._idToWrapperProxy[contextId] = proxy;
- this._idToRealWebGLContext[contextId] = glContext;
- InjectedScriptHost.webGLContextCreated(contextId);
-
- return proxy;
- },
-
- _generateObjectId: function()
- {
- var id = ++this._lastBoundObjectId;
- var objectId = "{\"injectedScriptId\":" + injectedScriptId + ",\"webGLId\":" + id + "}";
- return objectId;
- },
-
- captureFrame: function(contextId)
- {
- this._capturingFrameInfo = {
- contextId: contextId,
- capturedCallsNum: 0
- };
- },
-
- _stopCapturing: function(info)
- {
- if (this._capturingFrameInfo === info)
- this._capturingFrameInfo = null;
- },
-
- _wrappedFunction: function(glContext, functionName)
- {
- // Call real WebGL function.
- var args = Array.prototype.slice.call(arguments, 2);
- var result = glContext[functionName].apply(glContext, args);
-
- if (this._capturingFrameInfo && this._idToRealWebGLContext[this._capturingFrameInfo.contextId] === glContext) {
- var capturedCallsNum = ++this._capturingFrameInfo.capturedCallsNum;
- if (capturedCallsNum === 1)
- this._setZeroTimeouts(this._stopCapturing.bind(this, this._capturingFrameInfo));
- InjectedScriptHost.webGLReportFunctionCall(this._capturingFrameInfo.contextId, functionName, "[" + args.join(", ") + "]", result + "");
- }
-
- return result;
- },
-
- _setZeroTimeouts: function(callback)
- {
- // We need a fastest async callback, whatever fires first.
- // Usually a postMessage should be faster than a setTimeout(0).
- var channel = new MessageChannel();
- channel.port1._onmessage_ = callback;
- channel.port2.postMessage("");
- inspectedWindow.setTimeout(callback, 0);
- }
-};
-
-var injectedScript = new InjectedScript();
-return injectedScript;
-
-})