Title: [161769] trunk/Source
Revision
161769
Author
[email protected]
Date
2014-01-11 11:16:14 -0800 (Sat, 11 Jan 2014)

Log Message

Simplify Timer and DeferrableOneShotTimer using std::function
https://bugs.webkit.org/show_bug.cgi?id=126816

Reviewed by Sam Weinig.

Source/WebCore:

* platform/Timer.h:
(WebCore::Timer::Timer):

Source/WebKit2:

Add another unexported symbol.

* Configurations/WebKit2.xcconfig:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (161768 => 161769)


--- trunk/Source/WebCore/ChangeLog	2014-01-11 18:19:04 UTC (rev 161768)
+++ trunk/Source/WebCore/ChangeLog	2014-01-11 19:16:14 UTC (rev 161769)
@@ -1,5 +1,15 @@
 2014-01-11  Anders Carlsson  <[email protected]>
 
+        Simplify Timer and DeferrableOneShotTimer using std::function
+        https://bugs.webkit.org/show_bug.cgi?id=126816
+
+        Reviewed by Sam Weinig.
+
+        * platform/Timer.h:
+        (WebCore::Timer::Timer):
+
+2014-01-11  Anders Carlsson  <[email protected]>
+
         CTTE Timer and DeferrableOneShotTimer
         https://bugs.webkit.org/show_bug.cgi?id=126814
 

Modified: trunk/Source/WebCore/platform/Timer.h (161768 => 161769)


--- trunk/Source/WebCore/platform/Timer.h	2014-01-11 18:19:04 UTC (rev 161768)
+++ trunk/Source/WebCore/platform/Timer.h	2014-01-11 19:16:14 UTC (rev 161769)
@@ -26,6 +26,7 @@
 #ifndef Timer_h
 #define Timer_h
 
+#include <functional>
 #include <wtf/Noncopyable.h>
 #include <wtf/Threading.h>
 #include <wtf/Vector.h>
@@ -113,34 +114,23 @@
     typedef void (TimerFiredClass::*TimerFiredFunction)(Timer&);
     typedef void (TimerFiredClass::*DeprecatedTimerFiredFunction)(Timer*);
 
-    Timer(TimerFiredClass* object, TimerFiredFunction function)
-        : m_object(object)
-        , m_deprecatedFunction(nullptr)
-        , m_function(function)
+    Timer(TimerFiredClass* object , TimerFiredFunction function)
+        : m_function(std::bind(function, object, std::ref(*this)))
     {
     }
 
     Timer(TimerFiredClass* object, DeprecatedTimerFiredFunction function)
-        : m_object(object)
-        , m_deprecatedFunction(function)
-        , m_function(nullptr)
+        : m_function(std::bind(function, object, this))
     {
     }
 
 private:
     virtual void fired() OVERRIDE
     {
-        if (m_deprecatedFunction) {
-            (m_object->*m_deprecatedFunction)(this);
-            return;
-        }
-
-        (m_object->*m_function)(*this);
+        m_function();
     }
 
-    TimerFiredClass* m_object;
-    DeprecatedTimerFiredFunction m_deprecatedFunction;
-    TimerFiredFunction m_function;
+    std::function<void ()> m_function;
 };
 
 inline bool TimerBase::isActive() const

Modified: trunk/Source/WebKit2/ChangeLog (161768 => 161769)


--- trunk/Source/WebKit2/ChangeLog	2014-01-11 18:19:04 UTC (rev 161768)
+++ trunk/Source/WebKit2/ChangeLog	2014-01-11 19:16:14 UTC (rev 161769)
@@ -1,3 +1,14 @@
+2014-01-11  Anders Carlsson  <[email protected]>
+
+        Simplify Timer and DeferrableOneShotTimer using std::function
+        https://bugs.webkit.org/show_bug.cgi?id=126816
+
+        Reviewed by Sam Weinig.
+
+        Add another unexported symbol.
+
+        * Configurations/WebKit2.xcconfig:
+
 2014-01-11  Jinwoo Song  <[email protected]>
 
         [EFL][WK2] Use nullptr instead of 0 in EFL API layer

Modified: trunk/Source/WebKit2/Configurations/WebKit2.xcconfig (161768 => 161769)


--- trunk/Source/WebKit2/Configurations/WebKit2.xcconfig	2014-01-11 18:19:04 UTC (rev 161768)
+++ trunk/Source/WebKit2/Configurations/WebKit2.xcconfig	2014-01-11 19:16:14 UTC (rev 161769)
@@ -32,7 +32,7 @@
 FRAMEWORK_AND_LIBRARY_LDFLAGS = -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreServices -framework IOKit -framework _javascript_Core -licucore -framework QuartzCore -framework WebCore -framework CoreAudio -framework IOSurface;
 
 // Prevent C++ standard library operator new, delete and their related exception types from being exported as weak symbols.
-UNEXPORTED_SYMBOL_LDFLAGS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv -Wl,-unexported_symbol -Wl,__Znwm -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2EOS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1EOS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSEDn -Wl,-unexported_symbol, -Wl,__ZNKSt3__18functionIFvN7WebCore12PolicyActionEEEclES2_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEE4swapERS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1ERKS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2ERKS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEED1Ev -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEED2Ev -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSERKS4_;
+UNEXPORTED_SYMBOL_LDFLAGS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv -Wl,-unexported_symbol -Wl,__Znwm -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2EOS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1EOS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSEDn -Wl,-unexported_symbol, -Wl,__ZNKSt3__18functionIFvN7WebCore12PolicyActionEEEclES2_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEE4swapERS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1ERKS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2ERKS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEED1Ev -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEED2Ev -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSERKS4_ -Wl,-unexported_symbol, -Wl,__ZTVNSt3__117bad_function_callE;
 
 OTHER_LDFLAGS = $(inherited) $(UNEXPORTED_SYMBOL_LDFLAGS) $(OTHER_LDFLAGS_$(PLATFORM_NAME));
 OTHER_LDFLAGS_macosx = $(FRAMEWORK_AND_LIBRARY_LDFLAGS);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to