Changeset 122197 in webkit


Ignore:
Timestamp:
Jul 9, 2012 11:42:40 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[EFL] Battery status code needs refactoring to be reused in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=90760

Patch by Christophe Dumez <Christophe Dumez> on 2012-07-09
Reviewed by Hajime Morita.

Source/WebCore:

Rename BatteryClientEfl to BatteryProviderEfl and remove dependency
on BatteryController by introducing the BatteryProviderEflClient
interface. This will allow reusing the BatteryProviderEfl class
in WebKit2.

No new tests. Already tested by batterystatus/*.

  • PlatformEfl.cmake:
  • platform/efl/BatteryProviderEfl.cpp: Renamed from Source/WebCore/platform/efl/BatteryClientEfl.cpp.

(WebCore):
(WebCore::BatteryProviderEfl::BatteryProviderEfl):
(WebCore::BatteryProviderEfl::batteryStatus):
(WebCore::BatteryProviderEfl::startUpdating):
(WebCore::BatteryProviderEfl::stopUpdating):
(WebCore::BatteryProviderEfl::setBatteryStatus):
(WebCore::BatteryProviderEfl::timerFired):
(WebCore::BatteryProviderEfl::getBatteryStatus):
(WebCore::BatteryProviderEfl::setBatteryClient):

  • platform/efl/BatteryProviderEfl.h: Copied from Source/WebCore/platform/efl/BatteryClientEfl.h.

(WebCore):
(BatteryProviderEfl):
(WebCore::BatteryProviderEfl::~BatteryProviderEfl):

  • platform/efl/BatteryProviderEflClient.h: Added.

(WebCore):
(BatteryProviderEflClient):

Source/WebKit:

Add BatteryClientEfl to PlatformEfl.cmake.

  • PlatformEfl.cmake:

Source/WebKit/efl:

Add BatteryClientEfl to WebKit, which uses BatteryProviderEfl from
WebCore internally.

  • WebCoreSupport/BatteryClientEfl.cpp: Added.

(BatteryClientEfl::BatteryClientEfl):
(BatteryClientEfl::setController):
(BatteryClientEfl::startUpdating):
(BatteryClientEfl::stopUpdating):
(BatteryClientEfl::batteryControllerDestroyed):
(BatteryClientEfl::didChangeBatteryStatus):

  • WebCoreSupport/BatteryClientEfl.h: Renamed from Source/WebCore/platform/efl/BatteryClientEfl.h.

(WebCore):
(BatteryClientEfl):
(BatteryClientEfl::~BatteryClientEfl):

  • ewk/ewk_view.cpp:

(_ewk_view_priv_new):

Location:
trunk/Source
Files:
2 added
6 edited
1 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r122196 r122197  
     12012-07-09  Christophe Dumez  <christophe.dumez@intel.com>
     2
     3        [EFL] Battery status code needs refactoring to be reused in WebKit2
     4        https://bugs.webkit.org/show_bug.cgi?id=90760
     5
     6        Reviewed by Hajime Morita.
     7
     8        Rename BatteryClientEfl to BatteryProviderEfl and remove dependency
     9        on BatteryController by introducing the BatteryProviderEflClient
     10        interface. This will allow reusing the BatteryProviderEfl class
     11        in WebKit2.
     12
     13        No new tests. Already tested by batterystatus/*.
     14
     15        * PlatformEfl.cmake:
     16        * platform/efl/BatteryProviderEfl.cpp: Renamed from Source/WebCore/platform/efl/BatteryClientEfl.cpp.
     17        (WebCore):
     18        (WebCore::BatteryProviderEfl::BatteryProviderEfl):
     19        (WebCore::BatteryProviderEfl::batteryStatus):
     20        (WebCore::BatteryProviderEfl::startUpdating):
     21        (WebCore::BatteryProviderEfl::stopUpdating):
     22        (WebCore::BatteryProviderEfl::setBatteryStatus):
     23        (WebCore::BatteryProviderEfl::timerFired):
     24        (WebCore::BatteryProviderEfl::getBatteryStatus):
     25        (WebCore::BatteryProviderEfl::setBatteryClient):
     26        * platform/efl/BatteryProviderEfl.h: Copied from Source/WebCore/platform/efl/BatteryClientEfl.h.
     27        (WebCore):
     28        (BatteryProviderEfl):
     29        (WebCore::BatteryProviderEfl::~BatteryProviderEfl):
     30        * platform/efl/BatteryProviderEflClient.h: Added.
     31        (WebCore):
     32        (BatteryProviderEflClient):
     33
    1342012-07-09  Hayato Ito  <hayato@chromium.org>
    235
  • trunk/Source/WebCore/PlatformEfl.cmake

    r121828 r122197  
    2424  page/efl/EventHandlerEfl.cpp
    2525  platform/Cursor.cpp
    26   platform/efl/BatteryClientEfl.cpp
     26  platform/efl/BatteryProviderEfl.cpp
    2727  platform/efl/ClipboardEfl.cpp
    2828  platform/efl/ColorChooserEfl.cpp
  • trunk/Source/WebCore/platform/efl/BatteryProviderEfl.cpp

    r122196 r122197  
    1919
    2020#include "config.h"
    21 #include "BatteryClientEfl.h"
     21#include "BatteryProviderEfl.h"
    2222
    2323#if ENABLE(BATTERY_STATUS)
    2424
    25 #include "BatteryController.h"
     25#include "BatteryProviderEflClient.h"
    2626#include "EventNames.h"
    2727#include <E_Ukit.h>
     
    3030namespace WebCore {
    3131
    32 BatteryClientEfl::BatteryClientEfl()
    33     : m_controller(0)
    34     , m_timer(this, &BatteryClientEfl::timerFired)
     32BatteryProviderEfl::BatteryProviderEfl(BatteryProviderEflClient* client)
     33    : m_client(client)
     34    , m_timer(this, &BatteryProviderEfl::timerFired)
    3535    , m_batteryStatusRefreshInterval(1.0)
    3636{
    3737}
    3838
    39 BatteryStatus* BatteryClientEfl::batteryStatus() const
     39BatteryStatus* BatteryProviderEfl::batteryStatus() const
    4040{
    4141    return m_batteryStatus.get();
    4242}
    4343
    44 void BatteryClientEfl::setController(BatteryController* controller)
    45 {
    46     m_controller = controller;
    47 }
    48 
    49 void BatteryClientEfl::startUpdating()
     44void BatteryProviderEfl::startUpdating()
    5045{
    5146    if (m_timer.isActive())
     
    6358}
    6459
    65 void BatteryClientEfl::stopUpdating()
     60void BatteryProviderEfl::stopUpdating()
    6661{
    6762    m_timer.stop();
     
    7065}
    7166
    72 void BatteryClientEfl::batteryControllerDestroyed()
     67void BatteryProviderEfl::setBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus> batteryStatus)
    7368{
    74     delete this;
     69    m_batteryStatus = batteryStatus;
     70    m_client->didChangeBatteryStatus(eventType, m_batteryStatus);
    7571}
    7672
    77 void BatteryClientEfl::setBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus> batteryStatus)
    78 {
    79     m_batteryStatus = batteryStatus;
    80     m_controller->didChangeBatteryStatus(eventType, m_batteryStatus);
    81 }
    82 
    83 void BatteryClientEfl::timerFired(Timer<BatteryClientEfl>* timer)
     73void BatteryProviderEfl::timerFired(Timer<BatteryProviderEfl>* timer)
    8474{
    8575    ASSERT_UNUSED(timer, timer == &m_timer);
     
    8979}
    9080
    91 void BatteryClientEfl::getBatteryStatus(void* data, void* replyData, DBusError* dBusError)
     81void BatteryProviderEfl::getBatteryStatus(void* data, void* replyData, DBusError* dBusError)
    9282{
    9383    E_Ukit_Get_All_Devices_Return* eukitDeviceNames = static_cast<E_Ukit_Get_All_Devices_Return*>(replyData);
     
    10494}
    10595
    106 void BatteryClientEfl::setBatteryClient(void* data, void* replyData, DBusError* dBusError)
     96void BatteryProviderEfl::setBatteryClient(void* data, void* replyData, DBusError* dBusError)
    10797{
    10898    E_Ukit_Get_All_Properties_Return* eukitPropertyNames = static_cast<E_Ukit_Get_All_Properties_Return*>(replyData);
     
    120110        return;
    121111
    122     BatteryClientEfl* client = static_cast<BatteryClientEfl*>(data);
     112    BatteryProviderEfl* client = static_cast<BatteryProviderEfl*>(data);
    123113    BatteryStatus* clientBatteryStatus = client->batteryStatus();
    124114    bool charging = false;
  • trunk/Source/WebCore/platform/efl/BatteryProviderEfl.h

    r122196 r122197  
    1818 */
    1919
    20 #ifndef BatteryClientEfl_h
    21 #define BatteryClientEfl_h
     20#ifndef BatteryProviderEfl_h
     21#define BatteryProviderEfl_h
    2222
    2323#if ENABLE(BATTERY_STATUS)
     
    3232namespace WebCore {
    3333
    34 class BatteryController;
     34class BatteryProviderEflClient;
    3535
    36 class BatteryClientEfl : public BatteryClient {
     36class BatteryProviderEfl {
    3737public:
    38     BatteryClientEfl();
    39     ~BatteryClientEfl() { };
     38    BatteryProviderEfl(BatteryProviderEflClient*);
     39    ~BatteryProviderEfl() { }
    4040
    41     virtual void setController(BatteryController*);
    4241    virtual void startUpdating();
    4342    virtual void stopUpdating();
    44     virtual void batteryControllerDestroyed();
    4543
    4644    void setBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus>);
     
    4846
    4947private:
    50     void timerFired(Timer<BatteryClientEfl>*);
     48    void timerFired(Timer<BatteryProviderEfl>*);
    5149    static void getBatteryStatus(void* data, void* replyData, DBusError*);
    5250    static void setBatteryClient(void* data, void* replyData, DBusError*);
    5351
    54     BatteryController* m_controller;
    55     Timer<BatteryClientEfl> m_timer;
     52    BatteryProviderEflClient* m_client;
     53    Timer<BatteryProviderEfl> m_timer;
    5654    RefPtr<BatteryStatus> m_batteryStatus;
    5755    const double m_batteryStatusRefreshInterval;
     
    6159
    6260#endif // ENABLE(BATTERY_STATUS)
    63 #endif // BatteryClientEfl_h
     61#endif // BatteryProviderEfl_h
    6462
  • trunk/Source/WebKit/ChangeLog

    r122073 r122197  
     12012-07-09  Christophe Dumez  <christophe.dumez@intel.com>
     2
     3        [EFL] Battery status code needs refactoring to be reused in WebKit2
     4        https://bugs.webkit.org/show_bug.cgi?id=90760
     5
     6        Reviewed by Hajime Morita.
     7
     8        Add BatteryClientEfl to PlatformEfl.cmake.
     9
     10        * PlatformEfl.cmake:
     11
    1122012-07-08  Kihong Kwon  <kihong.kwon@samsung.com>
    213
  • trunk/Source/WebKit/PlatformEfl.cmake

    r122073 r122197  
    9292LIST(APPEND WebKit_SOURCES
    9393    efl/WebCoreSupport/AssertMatchingEnums.cpp
     94    efl/WebCoreSupport/BatteryClientEfl.cpp
    9495    efl/WebCoreSupport/ChromeClientEfl.cpp
    9596    efl/WebCoreSupport/DeviceOrientationClientEfl.cpp
  • trunk/Source/WebKit/efl/ChangeLog

    r122159 r122197  
     12012-07-09  Christophe Dumez  <christophe.dumez@intel.com>
     2
     3        [EFL] Battery status code needs refactoring to be reused in WebKit2
     4        https://bugs.webkit.org/show_bug.cgi?id=90760
     5
     6        Reviewed by Hajime Morita.
     7
     8        Add BatteryClientEfl to WebKit, which uses BatteryProviderEfl from
     9        WebCore internally.
     10
     11        * WebCoreSupport/BatteryClientEfl.cpp: Added.
     12        (BatteryClientEfl::BatteryClientEfl):
     13        (BatteryClientEfl::setController):
     14        (BatteryClientEfl::startUpdating):
     15        (BatteryClientEfl::stopUpdating):
     16        (BatteryClientEfl::batteryControllerDestroyed):
     17        (BatteryClientEfl::didChangeBatteryStatus):
     18        * WebCoreSupport/BatteryClientEfl.h: Renamed from Source/WebCore/platform/efl/BatteryClientEfl.h.
     19        (WebCore):
     20        (BatteryClientEfl):
     21        (BatteryClientEfl::~BatteryClientEfl):
     22        * ewk/ewk_view.cpp:
     23        (_ewk_view_priv_new):
     24
    1252012-07-09  Adam Klein  <adamk@chromium.org>
    226
  • trunk/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.h

    r122196 r122197  
    11/*
    2  *  Copyright (C) 2012 Samsung Electronics
     2 *  Copyright (C) 2012 Samsung Electronics.  All rights reserved.
     3 *  Copyright (C) 2012 Intel Corporation. All rights reserved.
    34 *
    45 *  This library is free software; you can redistribute it and/or
     
    2425
    2526#include "BatteryClient.h"
     27#include "BatteryProviderEfl.h"
     28#include "BatteryProviderEflClient.h"
    2629#include "BatteryStatus.h"
    27 #include "Timer.h"
    28 #include <wtf/text/AtomicString.h>
    29 
    30 typedef struct DBusError DBusError;
     30#include <wtf/PassRefPtr.h>
    3131
    3232namespace WebCore {
     33class BatteryController;
     34}
    3335
    34 class BatteryController;
    35 
    36 class BatteryClientEfl : public BatteryClient {
     36class BatteryClientEfl : public WebCore::BatteryClient, public WebCore::BatteryProviderEflClient {
    3737public:
    3838    BatteryClientEfl();
    39     ~BatteryClientEfl() { };
     39    virtual ~BatteryClientEfl() { }
    4040
    41     virtual void setController(BatteryController*);
     41    // BatteryClient interface.
     42    virtual void setController(WebCore::BatteryController*);
    4243    virtual void startUpdating();
    4344    virtual void stopUpdating();
    4445    virtual void batteryControllerDestroyed();
    4546
    46     void setBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus>);
    47     BatteryStatus* batteryStatus() const;
     47private:
     48    // BatteryProviderEflClient interface.
     49    virtual void didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<WebCore::BatteryStatus>);
    4850
    49 private:
    50     void timerFired(Timer<BatteryClientEfl>*);
    51     static void getBatteryStatus(void* data, void* replyData, DBusError*);
    52     static void setBatteryClient(void* data, void* replyData, DBusError*);
    53 
    54     BatteryController* m_controller;
    55     Timer<BatteryClientEfl> m_timer;
    56     RefPtr<BatteryStatus> m_batteryStatus;
    57     const double m_batteryStatusRefreshInterval;
     51    WebCore::BatteryController* m_controller;
     52    WebCore::BatteryProviderEfl m_provider;
    5853};
    5954
    60 }
     55#endif // ENABLE(BATTERY_STATUS)
    6156
    62 #endif // ENABLE(BATTERY_STATUS)
    6357#endif // BatteryClientEfl_h
    64 
  • trunk/Source/WebKit/efl/ewk/ewk_view.cpp

    r121947 r122197  
    755755
    756756#if ENABLE(BATTERY_STATUS)
    757     WebCore::provideBatteryTo(priv->page.get(), new WebCore::BatteryClientEfl);
     757    WebCore::provideBatteryTo(priv->page.get(), new BatteryClientEfl);
    758758#endif
    759759
Note: See TracChangeset for help on using the changeset viewer.