Title: [149444] trunk/Source
Revision
149444
Author
[email protected]
Date
2013-05-01 11:59:21 -0700 (Wed, 01 May 2013)

Log Message

Add FunctionDispatcher class and make RunLoop derive from it
https://bugs.webkit.org/show_bug.cgi?id=115480

Reviewed by Sam Weinig.

Source/WebCore:

Change RunLoop to be a subclass of FunctionDispatcher.

* platform/RunLoop.h:
(RunLoop):

Source/WTF:

Add FunctionDispatcher files.

* WTF.pro:
* WTF.vcproj/WTF.vcproj:
* WTF.vcxproj/WTF.vcxproj:
* WTF.xcodeproj/project.pbxproj:
* wtf/FunctionDispatcher.cpp: Added.
(WTF::FunctionDispatcher::FunctionDispatcher):
(WTF::FunctionDispatcher::~FunctionDispatcher):
* wtf/FunctionDispatcher.h: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (149443 => 149444)


--- trunk/Source/WTF/ChangeLog	2013-05-01 18:55:32 UTC (rev 149443)
+++ trunk/Source/WTF/ChangeLog	2013-05-01 18:59:21 UTC (rev 149444)
@@ -1,3 +1,21 @@
+2013-05-01  Anders Carlsson  <[email protected]>
+
+        Add FunctionDispatcher class and make RunLoop derive from it
+        https://bugs.webkit.org/show_bug.cgi?id=115480
+
+        Reviewed by Sam Weinig.
+
+        Add FunctionDispatcher files.
+
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.vcxproj/WTF.vcxproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/FunctionDispatcher.cpp: Added.
+        (WTF::FunctionDispatcher::FunctionDispatcher):
+        (WTF::FunctionDispatcher::~FunctionDispatcher):
+        * wtf/FunctionDispatcher.h: Added.
+
 2013-05-01  Zoltan Arvai  <[email protected]>
 
         [Qt][Win] Fix build after r149416.

Modified: trunk/Source/WTF/GNUmakefile.list.am (149443 => 149444)


--- trunk/Source/WTF/GNUmakefile.list.am	2013-05-01 18:55:32 UTC (rev 149443)
+++ trunk/Source/WTF/GNUmakefile.list.am	2013-05-01 18:59:21 UTC (rev 149444)
@@ -58,6 +58,8 @@
     Source/WTF/wtf/Float32Array.h \
     Source/WTF/wtf/Float64Array.h \
     Source/WTF/wtf/Forward.h \
+    Source/WTF/wtf/FunctionDispatcher.cpp \
+    Source/WTF/wtf/FunctionDispatcher.h \
     Source/WTF/wtf/Functional.h \
     Source/WTF/wtf/GetPtr.h \
     Source/WTF/wtf/GregorianDateTime.cpp \

Modified: trunk/Source/WTF/WTF.pro (149443 => 149444)


--- trunk/Source/WTF/WTF.pro	2013-05-01 18:55:32 UTC (rev 149443)
+++ trunk/Source/WTF/WTF.pro	2013-05-01 18:59:21 UTC (rev 149444)
@@ -68,6 +68,7 @@
     Float32Array.h \
     Float64Array.h \
     Forward.h \
+    FunctionDispatcher.h \
     Functional.h \
     GetPtr.h \
     GregorianDateTime.h \
@@ -207,6 +208,7 @@
     dtoa/strtod.cc \
     FastMalloc.cpp \
     FilePrintStream.cpp \
+    FunctionDispatcher.cpp \
     GregorianDateTime.cpp \
     gobject/GOwnPtr.cpp \
     gobject/GRefPtr.cpp \

Modified: trunk/Source/WTF/WTF.vcproj/WTF.vcproj (149443 => 149444)


--- trunk/Source/WTF/WTF.vcproj/WTF.vcproj	2013-05-01 18:55:32 UTC (rev 149443)
+++ trunk/Source/WTF/WTF.vcproj/WTF.vcproj	2013-05-01 18:59:21 UTC (rev 149444)
@@ -819,6 +819,14 @@
 			>
 		</File>
 		<File
+			RelativePath="..\wtf\FunctionDispatcher.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\FunctionDispatcher.h"
+			>
+		</File>
+		<File
 			RelativePath="..\wtf\Functional.h"
 			>
 		</File>

Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj (149443 => 149444)


--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj	2013-05-01 18:55:32 UTC (rev 149443)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj	2013-05-01 18:59:21 UTC (rev 149444)
@@ -48,6 +48,7 @@
     <ClCompile Include="..\wtf\DynamicAnnotations.cpp" />
     <ClCompile Include="..\wtf\FastMalloc.cpp" />
     <ClCompile Include="..\wtf\FilePrintStream.cpp" />
+    <ClCompile Include="..\wtf\FunctionDispatcher.cpp" />
     <ClCompile Include="..\wtf\GregorianDateTime.cpp" />
     <ClCompile Include="..\wtf\HashTable.cpp" />
     <ClCompile Include="..\wtf\MainThread.cpp" />
@@ -143,6 +144,7 @@
     <ClInclude Include="..\wtf\Float32Array.h" />
     <ClInclude Include="..\wtf\Float64Array.h" />
     <ClInclude Include="..\wtf\Forward.h" />
+    <ClInclude Include="..\wtf\FunctionDispatcher.h" />
     <ClInclude Include="..\wtf\Functional.h" />
     <ClInclude Include="..\wtf\GetPtr.h" />
     <ClInclude Include="..\wtf\GregorianDateTime.h" />

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (149443 => 149444)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2013-05-01 18:55:32 UTC (rev 149443)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2013-05-01 18:59:21 UTC (rev 149444)
@@ -42,6 +42,8 @@
 		1469419D16EAB10A0024E146 /* AutodrainedPoolMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1469419B16EAB10A0024E146 /* AutodrainedPoolMac.mm */; };
 		149EF16316BBFE0D000A4331 /* TriState.h in Headers */ = {isa = PBXBuildFile; fileRef = 149EF16216BBFE0D000A4331 /* TriState.h */; settings = {ATTRIBUTES = (); }; };
 		14F3B0F715E45E4600210069 /* SaturatedArithmetic.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */; settings = {ATTRIBUTES = (); }; };
+		1A1D8B9C173186CE00141DA4 /* FunctionDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1D8B9B173186CE00141DA4 /* FunctionDispatcher.h */; };
+		1A1D8B9E1731879800141DA4 /* FunctionDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1D8B9D1731879800141DA4 /* FunctionDispatcher.cpp */; };
 		1A6BB769162F300500DD16DB /* StreamBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6BB768162F300500DD16DB /* StreamBuffer.h */; };
 		26147B0A15DDCCDC00DDB907 /* IntegerToStringConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */; };
 		2C05385415BC819000F21B96 /* GregorianDateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C05385315BC819000F21B96 /* GregorianDateTime.h */; };
@@ -307,6 +309,8 @@
 		1469419B16EAB10A0024E146 /* AutodrainedPoolMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AutodrainedPoolMac.mm; sourceTree = "<group>"; };
 		149EF16216BBFE0D000A4331 /* TriState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TriState.h; sourceTree = "<group>"; };
 		14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SaturatedArithmetic.h; sourceTree = "<group>"; };
+		1A1D8B9B173186CE00141DA4 /* FunctionDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionDispatcher.h; sourceTree = "<group>"; };
+		1A1D8B9D1731879800141DA4 /* FunctionDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FunctionDispatcher.cpp; sourceTree = "<group>"; };
 		1A6BB768162F300500DD16DB /* StreamBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamBuffer.h; sourceTree = "<group>"; };
 		26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntegerToStringConversion.h; sourceTree = "<group>"; };
 		2C05385315BC819000F21B96 /* GregorianDateTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GregorianDateTime.h; sourceTree = "<group>"; };
@@ -665,6 +669,8 @@
 				A8A472A4151A825A004123FF /* Float32Array.h */,
 				A8A472A5151A825A004123FF /* Float64Array.h */,
 				A8A472A6151A825A004123FF /* Forward.h */,
+				1A1D8B9D1731879800141DA4 /* FunctionDispatcher.cpp */,
+				1A1D8B9B173186CE00141DA4 /* FunctionDispatcher.h */,
 				A8A472A7151A825A004123FF /* Functional.h */,
 				A8A472A8151A825A004123FF /* GetPtr.h */,
 				2CCD892915C0390200285083 /* GregorianDateTime.cpp */,
@@ -978,6 +984,7 @@
 				A8A473C5151A825B004123FF /* FixedArray.h in Headers */,
 				A8A473C6151A825B004123FF /* Float32Array.h in Headers */,
 				A8A473C7151A825B004123FF /* Float64Array.h in Headers */,
+				1A1D8B9C173186CE00141DA4 /* FunctionDispatcher.h in Headers */,
 				A8A473C8151A825B004123FF /* Forward.h in Headers */,
 				A8A473C9151A825B004123FF /* Functional.h in Headers */,
 				A8A473CA151A825B004123FF /* GetPtr.h in Headers */,
@@ -1180,6 +1187,7 @@
 				A8A47435151A825B004123FF /* AtomicString.cpp in Sources */,
 				8134013815B092FD001FF0B8 /* Base64.cpp in Sources */,
 				A8A473A8151A825B004123FF /* bignum-dtoa.cc in Sources */,
+				1A1D8B9E1731879800141DA4 /* FunctionDispatcher.cpp in Sources */,
 				A8A473AA151A825B004123FF /* bignum.cc in Sources */,
 				A8A47451151A825B004123FF /* BinarySemaphore.cpp in Sources */,
 				A8A4738B151A825B004123FF /* BitVector.cpp in Sources */,

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (149443 => 149444)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2013-05-01 18:55:32 UTC (rev 149443)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2013-05-01 18:59:21 UTC (rev 149444)
@@ -30,6 +30,8 @@
     FilePrintStream.h
     FixedArray.h
     Forward.h
+    FunctionDispatcher.h
+    Functional.h
     GetPtr.h
     GregorianDateTime.h
     HashCountedSet.h
@@ -159,6 +161,7 @@
     DynamicAnnotations.cpp
     FastMalloc.cpp
     FilePrintStream.cpp
+    FunctionDispatcher.cpp
     GregorianDateTime.cpp
     HashTable.cpp
     MD5.cpp

Added: trunk/Source/WTF/wtf/FunctionDispatcher.cpp (0 => 149444)


--- trunk/Source/WTF/wtf/FunctionDispatcher.cpp	                        (rev 0)
+++ trunk/Source/WTF/wtf/FunctionDispatcher.cpp	2013-05-01 18:59:21 UTC (rev 149444)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2013 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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"
+#include "FunctionDispatcher.h"
+
+namespace WTF {
+
+FunctionDispatcher::FunctionDispatcher()
+{
+}
+
+FunctionDispatcher::~FunctionDispatcher()
+{
+}
+
+} // namespace WTF

Added: trunk/Source/WTF/wtf/FunctionDispatcher.h (0 => 149444)


--- trunk/Source/WTF/wtf/FunctionDispatcher.h	                        (rev 0)
+++ trunk/Source/WTF/wtf/FunctionDispatcher.h	2013-05-01 18:59:21 UTC (rev 149444)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2013 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 <wtf/Forward.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace WTF {
+
+// FunctionDispatcher is an abstract representation of something that functions can be
+// dispatched to. This can for example be a run loop or a work queue.
+
+class FunctionDispatcher : public ThreadSafeRefCounted<FunctionDispatcher> {
+public:
+    WTF_EXPORT_PRIVATE virtual ~FunctionDispatcher();
+
+    virtual void dispatch(const Function<void ()>&) = 0;
+
+protected:
+    WTF_EXPORT_PRIVATE FunctionDispatcher();
+};
+
+} // namespace WTF
+
+using WTF::FunctionDispatcher;

Modified: trunk/Source/WebCore/ChangeLog (149443 => 149444)


--- trunk/Source/WebCore/ChangeLog	2013-05-01 18:55:32 UTC (rev 149443)
+++ trunk/Source/WebCore/ChangeLog	2013-05-01 18:59:21 UTC (rev 149444)
@@ -1,3 +1,15 @@
+2013-05-01  Anders Carlsson  <[email protected]>
+
+        Add FunctionDispatcher class and make RunLoop derive from it
+        https://bugs.webkit.org/show_bug.cgi?id=115480
+
+        Reviewed by Sam Weinig.
+
+        Change RunLoop to be a subclass of FunctionDispatcher.
+
+        * platform/RunLoop.h:
+        (RunLoop):
+
 2013-05-01  Eric Carlson  <[email protected]>
 
         HTMLMediaElement::updateActiveTextTrackCues can do unnecessary work

Modified: trunk/Source/WebCore/platform/RunLoop.h (149443 => 149444)


--- trunk/Source/WebCore/platform/RunLoop.h	2013-05-01 18:55:32 UTC (rev 149443)
+++ trunk/Source/WebCore/platform/RunLoop.h	2013-05-01 18:59:21 UTC (rev 149444)
@@ -30,6 +30,7 @@
 
 #include <wtf/Deque.h>
 #include <wtf/Forward.h>
+#include <wtf/FunctionDispatcher.h>
 #include <wtf/Functional.h>
 #include <wtf/HashMap.h>
 #include <wtf/RetainPtr.h>
@@ -45,7 +46,7 @@
 
 namespace WebCore {
 
-class RunLoop : public ThreadSafeRefCounted<RunLoop> {
+class RunLoop : public FunctionDispatcher {
 public:
     // Must be called from the main thread (except for the Mac platform, where it
     // can be called from any thread).
@@ -58,7 +59,7 @@
     static RunLoop* main();
     ~RunLoop();
 
-    void dispatch(const Function<void()>&);
+    virtual void dispatch(const Function<void()>&) OVERRIDE;
 
     static void run();
     void stop();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to