Title: [122743] trunk/Source
Revision
122743
Author
commit-qu...@webkit.org
Date
2012-07-16 11:28:29 -0700 (Mon, 16 Jul 2012)

Log Message

Remove setController from BatteryClient
https://bugs.webkit.org/show_bug.cgi?id=90944

Patch by Kihong Kwon <kihong.k...@samsung.com> on 2012-07-16
Reviewed by Adam Barth.

Source/WebCore:

BatteryClient doesn't need to keep m_controller,
because BatteryController can be accessed using BatteryController::from().
Remove BatteryClient::setController function.

No new tests. Covered by existing tests.

* Modules/battery/BatteryClient.h:
* Modules/battery/BatteryController.cpp:
(WebCore::BatteryController::BatteryController):

Source/WebKit/blackberry:

BatteryClient doesn't need to keep m_controller,
because BatteryController can be accessed using BatteryController::from().
Remove m_controller and Add webPagePrivate to BatteryClientBlackBerry.
And change all m_controller to BatteryController::from.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::init):
* WebCoreSupport/BatteryClientBlackBerry.cpp:
(WebCore::BatteryClientBlackBerry::BatteryClientBlackBerry):
(WebCore::BatteryClientBlackBerry::onLevelChange):
(WebCore::BatteryClientBlackBerry::onChargingChange):
(WebCore::BatteryClientBlackBerry::onChargingTimeChange):
(WebCore::BatteryClientBlackBerry::onDischargingTimeChange):
* WebCoreSupport/BatteryClientBlackBerry.h:
(BatteryClientBlackBerry):

Source/WebKit/chromium:

Remove virtual identifier from setController because setController is removed from WebCore::BatteryClient.
In addition, BatteryController is set to instance of BatteryClientImpl in the constructor of WebViewImpl.

* src/BatteryClientImpl.h:
(BatteryClientImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):

Source/WebKit/efl:

BatteryClient doesn't need to keep m_controller,
because BatteryController can be accessed using BatteryController::from().
Remove m_controller and Add ewk view evas object to BatteryClientEfl.
And change all m_controller to BatteryController::from.

* WebCoreSupport/BatteryClientEfl.cpp:
(BatteryClientEfl::BatteryClientEfl):
(BatteryClientEfl::didChangeBatteryStatus):
* WebCoreSupport/BatteryClientEfl.h:
(BatteryClientEfl):
* ewk/ewk_view.cpp:
(_ewk_view_priv_new):

Source/WebKit2:

Remove WebBatteryClient::setController function.

* WebProcess/WebCoreSupport/WebBatteryClient.cpp:
* WebProcess/WebCoreSupport/WebBatteryClient.h:
(WebBatteryClient):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122742 => 122743)


--- trunk/Source/WebCore/ChangeLog	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebCore/ChangeLog	2012-07-16 18:28:29 UTC (rev 122743)
@@ -1,3 +1,20 @@
+2012-07-16  Kihong Kwon  <kihong.k...@samsung.com>
+
+        Remove setController from BatteryClient
+        https://bugs.webkit.org/show_bug.cgi?id=90944
+
+        Reviewed by Adam Barth.
+
+        BatteryClient doesn't need to keep m_controller,
+        because BatteryController can be accessed using BatteryController::from().
+        Remove BatteryClient::setController function.
+
+        No new tests. Covered by existing tests.
+
+        * Modules/battery/BatteryClient.h:
+        * Modules/battery/BatteryController.cpp:
+        (WebCore::BatteryController::BatteryController):
+
 2012-07-16  Mike West  <mk...@chromium.org>
 
         Invalid `script-nonce` directives should block script execution.

Modified: trunk/Source/WebCore/Modules/battery/BatteryClient.h (122742 => 122743)


--- trunk/Source/WebCore/Modules/battery/BatteryClient.h	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebCore/Modules/battery/BatteryClient.h	2012-07-16 18:28:29 UTC (rev 122743)
@@ -24,14 +24,12 @@
 
 namespace WebCore {
 
-class BatteryController;
 class Page;
 
 class BatteryClient {
 public:
     virtual ~BatteryClient() { }
 
-    virtual void setController(BatteryController*) = 0;
     virtual void startUpdating() = 0;
     virtual void stopUpdating() = 0;
     virtual void batteryControllerDestroyed() = 0;

Modified: trunk/Source/WebCore/Modules/battery/BatteryController.cpp (122742 => 122743)


--- trunk/Source/WebCore/Modules/battery/BatteryController.cpp	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebCore/Modules/battery/BatteryController.cpp	2012-07-16 18:28:29 UTC (rev 122743)
@@ -33,7 +33,6 @@
     : m_client(client)
 {
     ASSERT(m_client);
-    m_client->setController(this);
 }
 
 BatteryController::~BatteryController()

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (122742 => 122743)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-07-16 18:28:29 UTC (rev 122743)
@@ -520,7 +520,7 @@
 #endif
 
 #if ENABLE(BATTERY_STATUS)
-    WebCore::provideBatteryTo(m_page, new WebCore::BatteryClientBlackBerry);
+    WebCore::provideBatteryTo(m_page, new WebCore::BatteryClientBlackBerry(this));
 #endif
 
 #if ENABLE(MEDIA_STREAM)

Modified: trunk/Source/WebKit/blackberry/ChangeLog (122742 => 122743)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-07-16 18:28:29 UTC (rev 122743)
@@ -1,3 +1,26 @@
+2012-07-16  Kihong Kwon  <kihong.k...@samsung.com>
+
+        Remove setController from BatteryClient
+        https://bugs.webkit.org/show_bug.cgi?id=90944
+
+        Reviewed by Adam Barth.
+
+        BatteryClient doesn't need to keep m_controller,
+        because BatteryController can be accessed using BatteryController::from().
+        Remove m_controller and Add webPagePrivate to BatteryClientBlackBerry.
+        And change all m_controller to BatteryController::from.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::init):
+        * WebCoreSupport/BatteryClientBlackBerry.cpp:
+        (WebCore::BatteryClientBlackBerry::BatteryClientBlackBerry):
+        (WebCore::BatteryClientBlackBerry::onLevelChange):
+        (WebCore::BatteryClientBlackBerry::onChargingChange):
+        (WebCore::BatteryClientBlackBerry::onChargingTimeChange):
+        (WebCore::BatteryClientBlackBerry::onDischargingTimeChange):
+        * WebCoreSupport/BatteryClientBlackBerry.h:
+        (BatteryClientBlackBerry):
+
 2012-07-16  Yongxin Dai  <yo...@rim.com>
 
         [BlackBerry] Text selection with touch hold does not start on text field in some cases

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.cpp (122742 => 122743)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.cpp	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.cpp	2012-07-16 18:28:29 UTC (rev 122743)
@@ -26,17 +26,12 @@
 
 namespace WebCore {
 
-BatteryClientBlackBerry::BatteryClientBlackBerry()
+BatteryClientBlackBerry::BatteryClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate)
+    : m_webPagePrivate(webPagePrivate)
     : m_tracker(0)
-    , m_controller(0)
 {
 }
 
-void BatteryClientBlackBerry::setController(BatteryController* controller)
-{
-    m_controller = controller;
-}
-
 void BatteryClientBlackBerry::startUpdating()
 {
     if (m_tracker)
@@ -58,34 +53,22 @@
 
 void BatteryClientBlackBerry::onLevelChange(bool charging, double chargingTime, double dischargingTime, double level)
 {
-    if (!m_controller)
-        return;
-
-    m_controller->didChangeBatteryStatus("levelchange", BatteryStatus::create(charging, chargingTime, dischargingTime, level));
+    BatteryController::from(m_webPagePrivate->m_page)->didChangeBatteryStatus("levelchange", BatteryStatus::create(charging, chargingTime, dischargingTime, level));
 }
 
 void BatteryClientBlackBerry::onChargingChange(bool charging, double chargingTime, double dischargingTime, double level)
 {
-    if (!m_controller)
-        return;
-
-    m_controller->didChangeBatteryStatus("chargingchange", BatteryStatus::create(charging, chargingTime, dischargingTime, level));
+    BatteryController::from(m_webPagePrivate->m_page)->didChangeBatteryStatus("chargingchange", BatteryStatus::create(charging, chargingTime, dischargingTime, level));
 }
 
 void BatteryClientBlackBerry::onChargingTimeChange(bool charging, double chargingTime, double dischargingTime, double level)
 {
-    if (!m_controller)
-        return;
-
-    m_controller->didChangeBatteryStatus("chargingtimechange", BatteryStatus::create(charging, chargingTime, dischargingTime, level));
+    BatteryController::from(m_webPagePrivate->m_page)->didChangeBatteryStatus("chargingtimechange", BatteryStatus::create(charging, chargingTime, dischargingTime, level));
 }
 
 void BatteryClientBlackBerry::onDischargingTimeChange(bool charging, double chargingTime, double dischargingTime, double level)
 {
-    if (!m_controller)
-        return;
-
-    m_controller->didChangeBatteryStatus("dischargingtimechange", BatteryStatus::create(charging, chargingTime, dischargingTime, level));
+    BatteryController::from(m_webPagePrivate->m_page)->didChangeBatteryStatus("dischargingtimechange", BatteryStatus::create(charging, chargingTime, dischargingTime, level));
 }
 
 }

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.h (122742 => 122743)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.h	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/BatteryClientBlackBerry.h	2012-07-16 18:28:29 UTC (rev 122743)
@@ -28,15 +28,13 @@
 
 namespace WebCore {
 
-class BatteryController;
 class BatteryStatus;
 
 class BatteryClientBlackBerry : public BatteryClient, public BlackBerry::Platform::BatteryStatusTrackerListener {
 public:
-    BatteryClientBlackBerry();
+    explicit BatteryClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*);
     ~BatteryClientBlackBerry() { }
 
-    virtual void setController(BatteryController*);
     virtual void startUpdating();
     virtual void stopUpdating();
     virtual void batteryControllerDestroyed();
@@ -47,8 +45,8 @@
     void onDischargingTimeChange(bool charging, double chargingTime, double dischargingTime, double level);
 
 private:
+    BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate;
     BlackBerry::Platform::BatteryStatusTracker* m_tracker;
-    BatteryController* m_controller;
 };
 
 }

Modified: trunk/Source/WebKit/chromium/ChangeLog (122742 => 122743)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-07-16 18:28:29 UTC (rev 122743)
@@ -1,3 +1,18 @@
+2012-07-16  Kihong Kwon  <kihong.k...@samsung.com>
+
+        Remove setController from BatteryClient
+        https://bugs.webkit.org/show_bug.cgi?id=90944
+
+        Reviewed by Adam Barth.
+
+        Remove virtual identifier from setController because setController is removed from WebCore::BatteryClient.
+        In addition, BatteryController is set to instance of BatteryClientImpl in the constructor of WebViewImpl.
+
+        * src/BatteryClientImpl.h:
+        (BatteryClientImpl):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::WebViewImpl):
+
 2012-07-16  Dana Jansens  <dan...@chromium.org>
 
         [chromium] Incorrect assertion: Replicas will cause a RenderPass to be removed twice

Modified: trunk/Source/WebKit/chromium/src/BatteryClientImpl.h (122742 => 122743)


--- trunk/Source/WebKit/chromium/src/BatteryClientImpl.h	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit/chromium/src/BatteryClientImpl.h	2012-07-16 18:28:29 UTC (rev 122743)
@@ -36,6 +36,8 @@
 #include "BatteryClient.h"
 #include "WebBatteryStatus.h"
 
+namespace WebCore { class BatteryController; }
+
 namespace WebKit {
 
 class WebBatteryStatusClient;
@@ -46,9 +48,9 @@
     virtual ~BatteryClientImpl() { }
 
     void updateBatteryStatus(const WebBatteryStatus&);
+    void setController(WebCore::BatteryController*);
 
     // WebCore::BatteryClient methods:
-    virtual void setController(WebCore::BatteryController*) OVERRIDE;
     virtual void startUpdating() OVERRIDE;
     virtual void stopUpdating() OVERRIDE;
     virtual void batteryControllerDestroyed() OVERRIDE;

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (122742 => 122743)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-07-16 18:28:29 UTC (rev 122743)
@@ -36,6 +36,7 @@
 #include "AutofillPopupMenuClient.h"
 #include "BackForwardListChromium.h"
 #include "BatteryClientImpl.h"
+#include "BatteryController.h"
 #include "CSSValueKeywords.h"
 #include "Chrome.h"
 #include "Color.h"
@@ -464,6 +465,7 @@
 
 #if ENABLE(BATTERY_STATUS)
     provideBatteryTo(m_page.get(), m_batteryClient.get());
+    m_batteryClient->setController(BatteryController::from(m_page.get()));
 #endif
 
     m_page->setGroupName(pageGroupName);

Modified: trunk/Source/WebKit/efl/ChangeLog (122742 => 122743)


--- trunk/Source/WebKit/efl/ChangeLog	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-07-16 18:28:29 UTC (rev 122743)
@@ -1,3 +1,23 @@
+2012-07-16  Kihong Kwon  <kihong.k...@samsung.com>
+
+        Remove setController from BatteryClient
+        https://bugs.webkit.org/show_bug.cgi?id=90944
+
+        Reviewed by Adam Barth.
+
+        BatteryClient doesn't need to keep m_controller,
+        because BatteryController can be accessed using BatteryController::from().
+        Remove m_controller and Add ewk view evas object to BatteryClientEfl.
+        And change all m_controller to BatteryController::from.
+
+        * WebCoreSupport/BatteryClientEfl.cpp:
+        (BatteryClientEfl::BatteryClientEfl):
+        (BatteryClientEfl::didChangeBatteryStatus):
+        * WebCoreSupport/BatteryClientEfl.h:
+        (BatteryClientEfl):
+        * ewk/ewk_view.cpp:
+        (_ewk_view_priv_new):
+
 2012-07-15  Kihong Kwon  <kihong.k...@samsung.com>
 
         [EFL] Add a API for getting security origin string

Modified: trunk/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.cpp (122742 => 122743)


--- trunk/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.cpp	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.cpp	2012-07-16 18:28:29 UTC (rev 122743)
@@ -24,18 +24,14 @@
 #if ENABLE(BATTERY_STATUS)
 
 #include "BatteryController.h"
+#include "ewk_view_private.h"
 
-BatteryClientEfl::BatteryClientEfl()
-    : m_controller(0)
+BatteryClientEfl::BatteryClientEfl(Evas_Object* view)
+    : m_view(view)
     , m_provider(this)
 {
 }
 
-void BatteryClientEfl::setController(WebCore::BatteryController* controller)
-{
-    m_controller = controller;
-}
-
 void BatteryClientEfl::startUpdating()
 {
     m_provider.startUpdating();
@@ -53,8 +49,7 @@
 
 void BatteryClientEfl::didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<WebCore::BatteryStatus> status)
 {
-    ASSERT(m_controller);
-    m_controller->didChangeBatteryStatus(eventType, status);
+    WebCore::BatteryController::from(EWKPrivate::corePage(m_view))->didChangeBatteryStatus(eventType, status);
 }
 
 #endif // ENABLE(BATTERY_STATUS)

Modified: trunk/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.h (122742 => 122743)


--- trunk/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.h	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.h	2012-07-16 18:28:29 UTC (rev 122743)
@@ -35,11 +35,10 @@
 
 class BatteryClientEfl : public WebCore::BatteryClient, public WebCore::BatteryProviderEflClient {
 public:
-    BatteryClientEfl();
+    explicit BatteryClientEfl(Evas_Object* view);
     virtual ~BatteryClientEfl() { }
 
     // BatteryClient interface.
-    virtual void setController(WebCore::BatteryController*);
     virtual void startUpdating();
     virtual void stopUpdating();
     virtual void batteryControllerDestroyed();
@@ -48,7 +47,7 @@
     // BatteryProviderEflClient interface.
     virtual void didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<WebCore::BatteryStatus>);
 
-    WebCore::BatteryController* m_controller;
+    Evas_Object* m_view;
     WebCore::BatteryProviderEfl m_provider;
 };
 

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (122742 => 122743)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2012-07-16 18:28:29 UTC (rev 122743)
@@ -754,7 +754,7 @@
 #endif
 
 #if ENABLE(BATTERY_STATUS)
-    WebCore::provideBatteryTo(priv->page.get(), new BatteryClientEfl);
+    WebCore::provideBatteryTo(priv->page.get(), new BatteryClientEfl(smartData->self));
 #endif
 
     priv->pageSettings = priv->page->settings();

Modified: trunk/Source/WebKit2/ChangeLog (122742 => 122743)


--- trunk/Source/WebKit2/ChangeLog	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-16 18:28:29 UTC (rev 122743)
@@ -1,3 +1,16 @@
+2012-07-16  Kihong Kwon  <kihong.k...@samsung.com>
+
+        Remove setController from BatteryClient
+        https://bugs.webkit.org/show_bug.cgi?id=90944
+
+        Reviewed by Adam Barth.
+
+        Remove WebBatteryClient::setController function.
+
+        * WebProcess/WebCoreSupport/WebBatteryClient.cpp:
+        * WebProcess/WebCoreSupport/WebBatteryClient.h:
+        (WebBatteryClient):
+
 2012-07-16  Christophe Dumez  <christophe.du...@intel.com>
 
         [EFL][WK2] Make Ewk_Navigation_Policy_Decision ref counted

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.cpp (122742 => 122743)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.cpp	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.cpp	2012-07-16 18:28:29 UTC (rev 122743)
@@ -36,14 +36,6 @@
 
 namespace WebKit {
 
-void WebBatteryClient::setController(WebCore::BatteryController*)
-{
-    // We provide an empty implementation for this method so that
-    // it compiles. We don't need it since WebBatteryManager
-    // retrieves the controller directly from the page by calling
-    // BatteryController::from().
-}
-
 void WebBatteryClient::startUpdating()
 {
     WebProcess::shared().batteryManager().registerWebPage(m_page);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.h (122742 => 122743)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.h	2012-07-16 18:21:26 UTC (rev 122742)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.h	2012-07-16 18:28:29 UTC (rev 122743)
@@ -44,7 +44,6 @@
     virtual ~WebBatteryClient() { }
 
 private:
-    virtual void setController(WebCore::BatteryController*) OVERRIDE;
     virtual void startUpdating() OVERRIDE;
     virtual void stopUpdating() OVERRIDE;
     virtual void batteryControllerDestroyed() OVERRIDE;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to