Title: [132358] trunk/Source
Revision
132358
Author
[email protected]
Date
2012-10-24 08:28:27 -0700 (Wed, 24 Oct 2012)

Log Message

[BlackBerry] Extending existing ThreadUnsafe singletons in webkit to
Generic ThreadUnsafe Singleton
https://bugs.webkit.org/show_bug.cgi?id=100145

Patch by Parth Patel <[email protected]> on 2012-10-24
Reviewed by Rob Buis.

Extending the singletons to generic singleton and changing
getInstance() in IconDatabaseClientBlackBerry to instance()
to match the generic singleton template.

Reviewed Internally by Yong Li.

Source/WebCore:

Tests are not modified and added as there was no behavioural change.

* platform/blackberry/SharedTimerBlackBerry.cpp:
(SharedTimerBlackBerry):
(WebCore):

Source/WebKit/blackberry:

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPage::initializeIconDataBase):
* WebCoreSupport/IconDatabaseClientBlackBerry.cpp:
(WebCore):
* WebCoreSupport/IconDatabaseClientBlackBerry.h:
(IconDatabaseClientBlackBerry):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (132357 => 132358)


--- trunk/Source/WebCore/ChangeLog	2012-10-24 15:08:24 UTC (rev 132357)
+++ trunk/Source/WebCore/ChangeLog	2012-10-24 15:28:27 UTC (rev 132358)
@@ -1,3 +1,23 @@
+2012-10-24  Parth Patel  <[email protected]>
+
+        [BlackBerry] Extending existing ThreadUnsafe singletons in webkit to
+        Generic ThreadUnsafe Singleton
+        https://bugs.webkit.org/show_bug.cgi?id=100145
+
+        Reviewed by Rob Buis.
+
+        Extending the singletons to generic singleton and changing
+        getInstance() in IconDatabaseClientBlackBerry to instance()
+        to match the generic singleton template.
+
+        Reviewed Internally by Yong Li.
+
+        Tests are not modified and added as there was no behavioural change.
+
+        * platform/blackberry/SharedTimerBlackBerry.cpp:
+        (SharedTimerBlackBerry):
+        (WebCore):
+
 2012-10-24  Ilya Tikhonovsky  <[email protected]>
 
         Web Inspector: NMI add instrumentation for ResourceBuffer. It gives us 10mb on gmail

Modified: trunk/Source/WebCore/platform/blackberry/SharedTimerBlackBerry.cpp (132357 => 132358)


--- trunk/Source/WebCore/platform/blackberry/SharedTimerBlackBerry.cpp	2012-10-24 15:08:24 UTC (rev 132357)
+++ trunk/Source/WebCore/platform/blackberry/SharedTimerBlackBerry.cpp	2012-10-24 15:28:27 UTC (rev 132358)
@@ -19,18 +19,17 @@
 #include "config.h"
 #include "SharedTimer.h"
 
+#include <BlackBerryPlatformSingleton.h>
+#include <BlackBerryPlatformTimer.h>
 #include <wtf/CurrentTime.h>
 
-#include <BlackBerryPlatformTimer.h>
-
 namespace WebCore {
 
-class SharedTimerBlackBerry {
+class SharedTimerBlackBerry : public BlackBerry::Platform::ThreadUnsafeSingleton<SharedTimerBlackBerry> {
     friend void setSharedTimerFiredFunction(void (*f)());
+    SINGLETON_DEFINITION_THREADUNSAFE(SharedTimerBlackBerry)
 
 public:
-    static SharedTimerBlackBerry* instance();
-
     void start(double);
     void stop();
 
@@ -42,6 +41,8 @@
     void (*m_timerFunction)();
 };
 
+SINGLETON_INITIALIZER_THREADUNSAFE(SharedTimerBlackBerry)
+
 SharedTimerBlackBerry::SharedTimerBlackBerry()
     : m_started(false)
     , m_timerFunction(0)
@@ -54,14 +55,6 @@
         stop();
 }
 
-SharedTimerBlackBerry* SharedTimerBlackBerry::instance()
-{
-    static SharedTimerBlackBerry* timer = 0;
-    if (!timer)
-        timer = new SharedTimerBlackBerry;
-    return timer;
-}
-
 void SharedTimerBlackBerry::start(double interval)
 {
     BlackBerry::Platform::timerStart(interval, m_timerFunction);

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (132357 => 132358)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-10-24 15:08:24 UTC (rev 132357)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-10-24 15:28:27 UTC (rev 132358)
@@ -1731,7 +1731,7 @@
 
 void WebPage::initializeIconDataBase()
 {
-    IconDatabaseClientBlackBerry::getInstance()->initIconDatabase(d->m_webSettings);
+    IconDatabaseClientBlackBerry::instance()->initIconDatabase(d->m_webSettings);
 }
 
 bool WebPage::isUserScalable() const

Modified: trunk/Source/WebKit/blackberry/ChangeLog (132357 => 132358)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-10-24 15:08:24 UTC (rev 132357)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-10-24 15:28:27 UTC (rev 132358)
@@ -1,3 +1,24 @@
+2012-10-24  Parth Patel  <[email protected]>
+
+        [BlackBerry] Extending existing ThreadUnsafe singletons in webkit to
+        Generic ThreadUnsafe Singleton
+        https://bugs.webkit.org/show_bug.cgi?id=100145
+
+        Reviewed by Rob Buis.
+
+        Extending the singletons to generic singleton and changing
+        getInstance() in IconDatabaseClientBlackBerry to instance()
+        to match the generic singleton template.
+
+        Reviewed Internally by Yong Li.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPage::initializeIconDataBase):
+        * WebCoreSupport/IconDatabaseClientBlackBerry.cpp:
+        (WebCore):
+        * WebCoreSupport/IconDatabaseClientBlackBerry.h:
+        (IconDatabaseClientBlackBerry):
+
 2012-10-23  Robin Cao  <[email protected]>
 
         [BlackBerry] Web page renders at the wrong zoom level after viewport changes

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp (132357 => 132358)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp	2012-10-24 15:08:24 UTC (rev 132357)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp	2012-10-24 15:28:27 UTC (rev 132358)
@@ -25,13 +25,7 @@
 
 namespace WebCore {
 
-IconDatabaseClientBlackBerry* IconDatabaseClientBlackBerry::getInstance()
-{
-    static IconDatabaseClientBlackBerry* instance = 0;
-    if (!instance)
-        instance = new IconDatabaseClientBlackBerry();
-    return instance;
-}
+SINGLETON_INITIALIZER_THREADUNSAFE(IconDatabaseClientBlackBerry)
 
 bool IconDatabaseClientBlackBerry::initIconDatabase(const BlackBerry::WebKit::WebSettings* settings)
 {

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.h (132357 => 132358)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.h	2012-10-24 15:08:24 UTC (rev 132357)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.h	2012-10-24 15:28:27 UTC (rev 132358)
@@ -19,6 +19,7 @@
 #ifndef IconDatabaseClientBlackBerry_h
 #define IconDatabaseClientBlackBerry_h
 
+#include "BlackBerryPlatformSingleton.h"
 #include "IconDatabaseClient.h"
 
 namespace BlackBerry {
@@ -29,9 +30,11 @@
 
 namespace WebCore {
 
-class IconDatabaseClientBlackBerry : public IconDatabaseClient {
+class IconDatabaseClientBlackBerry : public BlackBerry::Platform::ThreadUnsafeSingleton<IconDatabaseClientBlackBerry>
+    , public IconDatabaseClient {
+
+    SINGLETON_DEFINITION_THREADUNSAFE(IconDatabaseClientBlackBerry)
 public:
-    static IconDatabaseClientBlackBerry* getInstance();
     bool initIconDatabase(const BlackBerry::WebKit::WebSettings*);
 
     virtual void didRemoveAllIcons();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to