Title: [120929] trunk/Source/WebCore
Revision
120929
Author
[email protected]
Date
2012-06-21 09:53:57 -0700 (Thu, 21 Jun 2012)

Log Message

Web Inspector: [WebGL] Add injected WebGL module class
https://bugs.webkit.org/show_bug.cgi?id=89592

Patch by Andrey Adaikin <[email protected]> on 2012-06-21
Reviewed by Pavel Feldman.

Adding a new InjectedScriptWebGLModule class and moving WebGL-related
stuff out of InjectedScriptManager class.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* inspector/InjectedScriptManager.cpp:
* inspector/InjectedScriptManager.h:
(InjectedScriptManager):
* inspector/InjectedScriptModule.cpp:
(WebCore::InjectedScriptModule::ensureInjected):
* inspector/InjectedScriptModule.h:
(InjectedScriptModule):
* inspector/InjectedScriptWebGLModule.cpp: Copied from Source/WebCore/inspector/InjectedScriptModule.cpp.
(WebCore):
(WebCore::InjectedScriptWebGLModule::InjectedScriptWebGLModule):
(WebCore::InjectedScriptWebGLModule::moduleForState):
(WebCore::InjectedScriptWebGLModule::source):
(WebCore::InjectedScriptWebGLModule::wrapWebGLContext):
(WebCore::InjectedScriptWebGLModule::captureFrame):
* inspector/InjectedScriptWebGLModule.h: Copied from Source/WebCore/inspector/InjectedScriptModule.h.
(WebCore):
(InjectedScriptWebGLModule):
* inspector/InspectorWebGLAgent.cpp:
(WebCore::InspectorWebGLAgent::wrapWebGLRenderingContextForInstrumentation):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (120928 => 120929)


--- trunk/Source/WebCore/CMakeLists.txt	2012-06-21 16:34:36 UTC (rev 120928)
+++ trunk/Source/WebCore/CMakeLists.txt	2012-06-21 16:53:57 UTC (rev 120929)
@@ -930,11 +930,12 @@
     inspector/DOMNodeHighlighter.cpp
     inspector/DOMPatchSupport.cpp
     inspector/IdentifiersFactory.cpp
-    inspector/InjectedScriptModule.cpp
     inspector/InjectedScript.cpp
     inspector/InjectedScriptBase.cpp
     inspector/InjectedScriptHost.cpp
     inspector/InjectedScriptManager.cpp
+    inspector/InjectedScriptModule.cpp
+    inspector/InjectedScriptWebGLModule.cpp
     inspector/InspectorAgent.cpp
     inspector/InspectorApplicationCacheAgent.cpp
     inspector/InspectorBaseAgent.cpp

Modified: trunk/Source/WebCore/ChangeLog (120928 => 120929)


--- trunk/Source/WebCore/ChangeLog	2012-06-21 16:34:36 UTC (rev 120928)
+++ trunk/Source/WebCore/ChangeLog	2012-06-21 16:53:57 UTC (rev 120929)
@@ -1,3 +1,39 @@
+2012-06-21  Andrey Adaikin  <[email protected]>
+
+        Web Inspector: [WebGL] Add injected WebGL module class
+        https://bugs.webkit.org/show_bug.cgi?id=89592
+
+        Reviewed by Pavel Feldman.
+
+        Adding a new InjectedScriptWebGLModule class and moving WebGL-related
+        stuff out of InjectedScriptManager class.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * inspector/InjectedScriptManager.cpp:
+        * inspector/InjectedScriptManager.h:
+        (InjectedScriptManager):
+        * inspector/InjectedScriptModule.cpp:
+        (WebCore::InjectedScriptModule::ensureInjected):
+        * inspector/InjectedScriptModule.h:
+        (InjectedScriptModule):
+        * inspector/InjectedScriptWebGLModule.cpp: Copied from Source/WebCore/inspector/InjectedScriptModule.cpp.
+        (WebCore):
+        (WebCore::InjectedScriptWebGLModule::InjectedScriptWebGLModule):
+        (WebCore::InjectedScriptWebGLModule::moduleForState):
+        (WebCore::InjectedScriptWebGLModule::source):
+        (WebCore::InjectedScriptWebGLModule::wrapWebGLContext):
+        (WebCore::InjectedScriptWebGLModule::captureFrame):
+        * inspector/InjectedScriptWebGLModule.h: Copied from Source/WebCore/inspector/InjectedScriptModule.h.
+        (WebCore):
+        (InjectedScriptWebGLModule):
+        * inspector/InspectorWebGLAgent.cpp:
+        (WebCore::InspectorWebGLAgent::wrapWebGLRenderingContextForInstrumentation):
+
 2012-06-21  Pavel Feldman  <[email protected]>
 
         Web Inspector: do not add separator to the end of the context menu.

Modified: trunk/Source/WebCore/GNUmakefile.list.am (120928 => 120929)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-06-21 16:34:36 UTC (rev 120928)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-06-21 16:53:57 UTC (rev 120929)
@@ -2653,8 +2653,6 @@
 	Source/WebCore/inspector/DOMWrapperVisitor.h \
 	Source/WebCore/inspector/IdentifiersFactory.cpp \
 	Source/WebCore/inspector/IdentifiersFactory.h \
-	Source/WebCore/inspector/InjectedScriptModule.cpp \
-	Source/WebCore/inspector/InjectedScriptModule.h \
 	Source/WebCore/inspector/InjectedScript.cpp \
 	Source/WebCore/inspector/InjectedScript.h \
 	Source/WebCore/inspector/InjectedScriptBase.cpp \
@@ -2663,6 +2661,10 @@
 	Source/WebCore/inspector/InjectedScriptHost.h \
 	Source/WebCore/inspector/InjectedScriptManager.cpp \
 	Source/WebCore/inspector/InjectedScriptManager.h \
+	Source/WebCore/inspector/InjectedScriptModule.cpp \
+	Source/WebCore/inspector/InjectedScriptModule.h \
+	Source/WebCore/inspector/InjectedScriptWebGLModule.cpp \
+	Source/WebCore/inspector/InjectedScriptWebGLModule.h \
 	Source/WebCore/inspector/InspectorAgent.cpp \
 	Source/WebCore/inspector/InspectorAgent.h \
 	Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp \

Modified: trunk/Source/WebCore/Target.pri (120928 => 120929)


--- trunk/Source/WebCore/Target.pri	2012-06-21 16:34:36 UTC (rev 120928)
+++ trunk/Source/WebCore/Target.pri	2012-06-21 16:53:57 UTC (rev 120929)
@@ -890,11 +890,12 @@
     inspector/DOMNodeHighlighter.cpp \
     inspector/DOMPatchSupport.cpp \
     inspector/IdentifiersFactory.cpp \
-    inspector/InjectedScriptModule.cpp \
     inspector/InjectedScript.cpp \
     inspector/InjectedScriptBase.cpp \
     inspector/InjectedScriptHost.cpp \
     inspector/InjectedScriptManager.cpp \
+    inspector/InjectedScriptModule.cpp \
+    inspector/InjectedScriptWebGLModule.cpp \
     inspector/InspectorAgent.cpp \
     inspector/InspectorApplicationCacheAgent.cpp \
     inspector/InspectorBaseAgent.cpp \
@@ -2040,11 +2041,12 @@
     inspector/DOMPatchSupport.h \
     inspector/DOMWrapperVisitor.h \
     inspector/IdentifiersFactory.h \
-    inspector/InjectedScriptModule.h \
     inspector/InjectedScript.h \
     inspector/InjectedScriptBase.h \
     inspector/InjectedScriptHost.h \
     inspector/InjectedScriptManager.h \
+    inspector/InjectedScriptModule.h \
+    inspector/InjectedScriptWebGLModule.h \
     inspector/InspectorAgent.h \
     inspector/InspectorApplicationCacheAgent.h \
     inspector/InspectorBaseAgent.h \

Modified: trunk/Source/WebCore/WebCore.gypi (120928 => 120929)


--- trunk/Source/WebCore/WebCore.gypi	2012-06-21 16:34:36 UTC (rev 120928)
+++ trunk/Source/WebCore/WebCore.gypi	2012-06-21 16:53:57 UTC (rev 120929)
@@ -2766,8 +2766,6 @@
             'inspector/DOMWrapperVisitor.h',
             'inspector/IdentifiersFactory.cpp',
             'inspector/IdentifiersFactory.h',
-            'inspector/InjectedScriptModule.cpp',
-            'inspector/InjectedScriptModule.h',
             'inspector/InjectedScript.cpp',
             'inspector/InjectedScript.h',
             'inspector/InjectedScriptBase.cpp',
@@ -2776,6 +2774,10 @@
             'inspector/InjectedScriptHost.h',
             'inspector/InjectedScriptManager.cpp',
             'inspector/InjectedScriptManager.h',
+            'inspector/InjectedScriptModule.cpp',
+            'inspector/InjectedScriptModule.h',
+            'inspector/InjectedScriptWebGLModule.cpp',
+            'inspector/InjectedScriptWebGLModule.h',
             'inspector/InspectorAgent.cpp',
             'inspector/InspectorApplicationCacheAgent.cpp',
             'inspector/InspectorApplicationCacheAgent.h',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (120928 => 120929)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-06-21 16:34:36 UTC (rev 120928)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-06-21 16:53:57 UTC (rev 120929)
@@ -73315,7 +73315,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\inspector\InjectedScriptModule.cpp"
+				RelativePath="..\inspector\InjectedScript.cpp"
 				>
 				<FileConfiguration
 					Name="Release|Win32"
@@ -73335,11 +73335,11 @@
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\inspector\InjectedScriptModule.h"
+				RelativePath="..\inspector\InjectedScript.h"
 				>
 			</File>
 			<File
-				RelativePath="..\inspector\InjectedScript.cpp"
+				RelativePath="..\inspector\InjectedScriptBase.cpp"
 				>
 				<FileConfiguration
 					Name="Release|Win32"
@@ -73359,11 +73359,11 @@
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\inspector\InjectedScript.h"
+				RelativePath="..\inspector\InjectedScriptBase.h"
 				>
 			</File>
 			<File
-				RelativePath="..\inspector\InjectedScriptBase.cpp"
+				RelativePath="..\inspector\InjectedScriptHost.cpp"
 				>
 				<FileConfiguration
 					Name="Release|Win32"
@@ -73383,11 +73383,11 @@
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\inspector\InjectedScriptBase.h"
+				RelativePath="..\inspector\InjectedScriptHost.h"
 				>
 			</File>
 			<File
-				RelativePath="..\inspector\InjectedScriptHost.cpp"
+				RelativePath="..\inspector\InjectedScriptManager.cpp"
 				>
 				<FileConfiguration
 					Name="Release|Win32"
@@ -73407,11 +73407,11 @@
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\inspector\InjectedScriptHost.h"
+				RelativePath="..\inspector\InjectedScriptManager.h"
 				>
 			</File>
 			<File
-				RelativePath="..\inspector\InjectedScriptManager.cpp"
+				RelativePath="..\inspector\InjectedScriptModule.cpp"
 				>
 				<FileConfiguration
 					Name="Release|Win32"
@@ -73431,10 +73431,34 @@
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\inspector\InjectedScriptManager.h"
+				RelativePath="..\inspector\InjectedScriptModule.h"
 				>
 			</File>
 			<File
+				RelativePath="..\inspector\InjectedScriptWebGLModule.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Production|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\inspector\InjectedScriptWebGLModule.h"
+				>
+			</File>
+			<File
 				RelativePath="..\inspector\InspectorAgent.cpp"
 				>
 				<FileConfiguration

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (120928 => 120929)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-06-21 16:34:36 UTC (rev 120928)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-06-21 16:53:57 UTC (rev 120929)
@@ -4465,6 +4465,8 @@
 		AA21ECCD0ABF0FC6002B834C /* CSSCursorImageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0978EE0ABAA6E100874480 /* CSSCursorImageValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		AA4C3A760B2B1679002334A2 /* StyleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA4C3A740B2B1679002334A2 /* StyleElement.cpp */; };
 		AA4C3A770B2B1679002334A2 /* StyleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = AA4C3A750B2B1679002334A2 /* StyleElement.h */; };
+		AA73183E159255B900A93E6E /* InjectedScriptWebGLModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA73183C159255B900A93E6E /* InjectedScriptWebGLModule.cpp */; };
+		AA73183F159255B900A93E6E /* InjectedScriptWebGLModule.h in Headers */ = {isa = PBXBuildFile; fileRef = AA73183D159255B900A93E6E /* InjectedScriptWebGLModule.h */; };
 		AAB6054E15874C58007B5031 /* InjectedScriptBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAB6054A15874C58007B5031 /* InjectedScriptBase.cpp */; };
 		AAB6054F15874C58007B5031 /* InjectedScriptBase.h in Headers */ = {isa = PBXBuildFile; fileRef = AAB6054B15874C58007B5031 /* InjectedScriptBase.h */; };
 		AAB6055015874C58007B5031 /* InjectedScriptModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAB6054C15874C58007B5031 /* InjectedScriptModule.cpp */; };
@@ -11478,6 +11480,8 @@
 		AA0978EE0ABAA6E100874480 /* CSSCursorImageValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSCursorImageValue.h; sourceTree = "<group>"; };
 		AA4C3A740B2B1679002334A2 /* StyleElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StyleElement.cpp; sourceTree = "<group>"; };
 		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>"; };
 		AAB6054A15874C58007B5031 /* InjectedScriptBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScriptBase.cpp; sourceTree = "<group>"; };
@@ -14423,6 +14427,8 @@
 				AAB6054C15874C58007B5031 /* InjectedScriptModule.cpp */,
 				AAB6054D15874C58007B5031 /* InjectedScriptModule.h */,
 				7A563F9512DF5C9100F4536D /* InjectedScriptSource.js */,
+				AA73183C159255B900A93E6E /* InjectedScriptWebGLModule.cpp */,
+				AA73183D159255B900A93E6E /* InjectedScriptWebGLModule.h */,
 				AA9030FE157E16A000276247 /* InjectedWebGLScriptSource.js */,
 				1C435CD414E8545B004E10EA /* Inspector-0.1.json */,
 				1C435CD514E8545B004E10EA /* Inspector-1.0.json */,
@@ -23339,6 +23345,7 @@
 				7A0E76FA10BF08ED00A0276E /* InjectedScriptHost.h in Headers */,
 				F316396C1329481A00A649CB /* InjectedScriptManager.h in Headers */,
 				AAB6055115874C58007B5031 /* InjectedScriptModule.h in Headers */,
+				AA73183F159255B900A93E6E /* InjectedScriptWebGLModule.h in Headers */,
 				A8CFF5E50A155A05000A4234 /* InlineBox.h in Headers */,
 				A8CFF5E30A155A05000A4234 /* InlineFlowBox.h in Headers */,
 				BCE789161120D6080060ECE5 /* InlineIterator.h in Headers */,
@@ -26479,6 +26486,7 @@
 				7A0E76F910BF08ED00A0276E /* InjectedScriptHost.cpp in Sources */,
 				F316396B1329481A00A649CB /* InjectedScriptManager.cpp in Sources */,
 				AAB6055015874C58007B5031 /* InjectedScriptModule.cpp in Sources */,
+				AA73183E159255B900A93E6E /* InjectedScriptWebGLModule.cpp in Sources */,
 				A8CFF5E60A155A05000A4234 /* InlineBox.cpp in Sources */,
 				A8CFF5E40A155A05000A4234 /* InlineFlowBox.cpp in Sources */,
 				BCEA4859097D93020094C9E4 /* InlineTextBox.cpp in Sources */,

Modified: trunk/Source/WebCore/inspector/InjectedScriptManager.cpp (120928 => 120929)


--- trunk/Source/WebCore/inspector/InjectedScriptManager.cpp	2012-06-21 16:34:36 UTC (rev 120928)
+++ trunk/Source/WebCore/inspector/InjectedScriptManager.cpp	2012-06-21 16:53:57 UTC (rev 120929)
@@ -37,9 +37,6 @@
 #include "InjectedScript.h"
 #include "InjectedScriptHost.h"
 #include "InjectedScriptSource.h"
-#if ENABLE(WEBGL)
-#include "InjectedWebGLScriptSource.h"
-#endif
 #include "InspectorValues.h"
 #include "ScriptObject.h"
 #include <wtf/PassOwnPtr.h>
@@ -190,19 +187,6 @@
     return result;
 }
 
-#if ENABLE(WEBGL)
-ScriptObject InjectedScriptManager::wrapWebGLRenderingContextForInstrumentation(const ScriptObject&)
-{
-    // FIXME(88973): Inject via this.injectScript()
-    return ScriptObject();
-}
-
-String InjectedScriptManager::injectedWebGLScriptSource()
-{
-    return String(reinterpret_cast<const char*>(InjectedWebGLScriptSource_js), sizeof(InjectedWebGLScriptSource_js));
-}
-#endif
-
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)

Modified: trunk/Source/WebCore/inspector/InjectedScriptManager.h (120928 => 120929)


--- trunk/Source/WebCore/inspector/InjectedScriptManager.h	2012-06-21 16:34:36 UTC (rev 120928)
+++ trunk/Source/WebCore/inspector/InjectedScriptManager.h	2012-06-21 16:53:57 UTC (rev 120929)
@@ -64,10 +64,6 @@
     void discardInjectedScriptsFor(DOMWindow*);
     void releaseObjectGroup(const String& objectGroup);
 
-#if ENABLE(WEBGL)
-    ScriptObject wrapWebGLRenderingContextForInstrumentation(const ScriptObject&);
-#endif
-
     typedef bool (*InspectedStateAccessCheck)(ScriptState*);
     InspectedStateAccessCheck inspectedStateAccessCheck() const { return m_inspectedStateAccessCheck; }
 
@@ -77,10 +73,6 @@
     String injectedScriptSource();
     ScriptObject createInjectedScript(const String& source, ScriptState*, int id);
 
-#if ENABLE(WEBGL)
-    String injectedWebGLScriptSource();
-#endif
-
     static bool canAccessInspectedWindow(ScriptState*);
     static bool canAccessInspectedWorkerContext(ScriptState*);
 

Modified: trunk/Source/WebCore/inspector/InjectedScriptModule.cpp (120928 => 120929)


--- trunk/Source/WebCore/inspector/InjectedScriptModule.cpp	2012-06-21 16:34:36 UTC (rev 120928)
+++ trunk/Source/WebCore/inspector/InjectedScriptModule.cpp	2012-06-21 16:53:57 UTC (rev 120929)
@@ -46,9 +46,9 @@
 {
 }
 
-void InjectedScriptModule::ensureInjected(InjectedScriptManager& injectedScriptManager, ScriptState* scriptState)
+void InjectedScriptModule::ensureInjected(InjectedScriptManager* injectedScriptManager, ScriptState* scriptState)
 {
-    InjectedScript injectedScript = injectedScriptManager.injectedScriptFor(scriptState);
+    InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(scriptState);
     ASSERT(!injectedScript.hasNoValue());
     if (injectedScript.hasNoValue())
         return;
@@ -71,7 +71,7 @@
     }
 
     ScriptObject moduleObject(scriptState, resultValue);
-    initialize(moduleObject, injectedScriptManager.inspectedStateAccessCheck());
+    initialize(moduleObject, injectedScriptManager->inspectedStateAccessCheck());
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/inspector/InjectedScriptModule.h (120928 => 120929)


--- trunk/Source/WebCore/inspector/InjectedScriptModule.h	2012-06-21 16:34:36 UTC (rev 120928)
+++ trunk/Source/WebCore/inspector/InjectedScriptModule.h	2012-06-21 16:53:57 UTC (rev 120929)
@@ -50,7 +50,7 @@
     // a static factory method that would create a new instance of the class
     // and call its ensureInjected() method immediately.
     InjectedScriptModule(const String& name);
-    void ensureInjected(InjectedScriptManager&, ScriptState*);
+    void ensureInjected(InjectedScriptManager*, ScriptState*);
 };
 
 #endif

Copied: trunk/Source/WebCore/inspector/InjectedScriptWebGLModule.cpp (from rev 120928, trunk/Source/WebCore/inspector/InjectedScriptModule.cpp) (0 => 120929)


--- trunk/Source/WebCore/inspector/InjectedScriptWebGLModule.cpp	                        (rev 0)
+++ trunk/Source/WebCore/inspector/InjectedScriptWebGLModule.cpp	2012-06-21 16:53:57 UTC (rev 120929)
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(INSPECTOR) && ENABLE(WEBGL)
+
+#include "InjectedScriptWebGLModule.h"
+
+#include "InjectedScript.h"
+#include "InjectedScriptManager.h"
+#include "InjectedWebGLScriptSource.h"
+#include "ScriptFunctionCall.h"
+#include "ScriptObject.h"
+
+namespace WebCore {
+
+InjectedScriptWebGLModule::InjectedScriptWebGLModule()
+    : InjectedScriptModule("InjectedScriptWebGLModule")
+{
+}
+
+InjectedScriptWebGLModule InjectedScriptWebGLModule::moduleForState(InjectedScriptManager* injectedScriptManager, ScriptState* scriptState)
+{
+    InjectedScriptWebGLModule result;
+    result.ensureInjected(injectedScriptManager, scriptState);
+    return result;
+}
+
+String InjectedScriptWebGLModule::source() const
+{
+    return String(reinterpret_cast<const char*>(InjectedWebGLScriptSource_js), sizeof(InjectedWebGLScriptSource_js));
+}
+
+ScriptObject InjectedScriptWebGLModule::wrapWebGLContext(const ScriptObject& glContext)
+{
+    ScriptFunctionCall function(injectedScriptObject(), "wrapWebGLContext");
+    function.appendArgument(glContext);
+    bool hadException = false;
+    ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException);
+    if (hadException || resultValue.hasNoValue() || !resultValue.isObject()) {
+        ASSERT_NOT_REACHED();
+        return ScriptObject();
+    }
+    return ScriptObject(glContext.scriptState(), resultValue);
+}
+
+void InjectedScriptWebGLModule::captureFrame(ErrorString* errorString, const String& contextId)
+{
+    ScriptFunctionCall function(injectedScriptObject(), "captureFrame");
+    function.appendArgument(contextId);
+    bool hadException = false;
+    callFunctionWithEvalEnabled(function, hadException);
+    ASSERT(!hadException);
+    if (hadException)
+        *errorString = "Internal error";
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR) && ENABLE(WEBGL)

Copied: trunk/Source/WebCore/inspector/InjectedScriptWebGLModule.h (from rev 120928, trunk/Source/WebCore/inspector/InjectedScriptModule.h) (0 => 120929)


--- trunk/Source/WebCore/inspector/InjectedScriptWebGLModule.h	                        (rev 0)
+++ trunk/Source/WebCore/inspector/InjectedScriptWebGLModule.h	2012-06-21 16:53:57 UTC (rev 120929)
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+#ifndef InjectedScriptWebGLModule_h
+#define InjectedScriptWebGLModule_h
+
+#include "InjectedScriptModule.h"
+#include "PlatformString.h"
+#include "ScriptState.h"
+
+namespace WebCore {
+
+class InjectedScriptManager;
+class ScriptObject;
+
+#if ENABLE(INSPECTOR) && ENABLE(WEBGL)
+
+class InjectedScriptWebGLModule : public InjectedScriptModule {
+public:
+    virtual String source() const;
+
+    static InjectedScriptWebGLModule moduleForState(InjectedScriptManager*, ScriptState*);
+
+    ScriptObject wrapWebGLContext(const ScriptObject& glContext);
+    void captureFrame(ErrorString*, const String& contextId);
+
+private:
+    InjectedScriptWebGLModule();
+};
+
+#endif
+
+} // namespace WebCore
+
+#endif

Modified: trunk/Source/WebCore/inspector/InspectorWebGLAgent.cpp (120928 => 120929)


--- trunk/Source/WebCore/inspector/InspectorWebGLAgent.cpp	2012-06-21 16:34:36 UTC (rev 120928)
+++ trunk/Source/WebCore/inspector/InspectorWebGLAgent.cpp	2012-06-21 16:53:57 UTC (rev 120929)
@@ -35,6 +35,7 @@
 #include "InspectorWebGLAgent.h"
 
 #include "InjectedScriptManager.h"
+#include "InjectedScriptWebGLModule.h" 
 #include "InspectorFrontend.h"
 #include "InspectorState.h"
 #include "InstrumentingAgents.h"
@@ -96,7 +97,16 @@
 
 ScriptObject InspectorWebGLAgent::wrapWebGLRenderingContextForInstrumentation(const ScriptObject& glContext)
 {
-    return m_injectedScriptManager->wrapWebGLRenderingContextForInstrumentation(glContext);
+    if (glContext.hasNoValue()) {
+        ASSERT_NOT_REACHED();
+        return ScriptObject();
+    }
+    InjectedScriptWebGLModule module = InjectedScriptWebGLModule::moduleForState(m_injectedScriptManager, glContext.scriptState());
+    if (module.hasNoValue()) {
+        ASSERT_NOT_REACHED();
+        return ScriptObject();
+    }
+    return module.wrapWebGLContext(glContext);
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to