Changeset 140509 in webkit


Ignore:
Timestamp:
Jan 22, 2013 10:49:45 PM (11 years ago)
Author:
mark.lam@apple.com
Message:

Change the Supplementable class to not use AtomicString.
https://bugs.webkit.org/show_bug.cgi?id=107535.

Reviewed by Adam Barth.

Replaced the use of AtomicString keys with literal const char* keys.
This simplifies the SupplementMap and makes it slightly leaner and faster.

Source/WebCore:

No new tests.

  • Modules/battery/BatteryController.cpp:

(WebCore::BatteryController::supplementName):

  • Modules/battery/BatteryController.h:

(BatteryController):

  • Modules/battery/NavigatorBattery.cpp:

(WebCore::NavigatorBattery::supplementName):
(WebCore):
(WebCore::NavigatorBattery::from):

  • Modules/battery/NavigatorBattery.h:

(NavigatorBattery):

  • Modules/filesystem/chromium/DraggedIsolatedFileSystem.cpp:

(WebCore::DraggedIsolatedFileSystem::supplementName):

  • Modules/filesystem/chromium/DraggedIsolatedFileSystem.h:

(DraggedIsolatedFileSystem):

  • Modules/gamepad/NavigatorGamepad.cpp:

(WebCore::NavigatorGamepad::supplementName):
(WebCore):
(WebCore::NavigatorGamepad::from):

  • Modules/gamepad/NavigatorGamepad.h:

(NavigatorGamepad):

  • Modules/geolocation/GeolocationController.cpp:

(WebCore::GeolocationController::supplementName):

  • Modules/geolocation/GeolocationController.h:

(GeolocationController):

  • Modules/geolocation/NavigatorGeolocation.cpp:

(WebCore::NavigatorGeolocation::supplementName):
(WebCore):
(WebCore::NavigatorGeolocation::from):

  • Modules/geolocation/NavigatorGeolocation.h:

(NavigatorGeolocation):

  • Modules/indexeddb/DOMWindowIndexedDatabase.cpp:

(WebCore::DOMWindowIndexedDatabase::supplementName):
(WebCore):
(WebCore::DOMWindowIndexedDatabase::from):

  • Modules/indexeddb/DOMWindowIndexedDatabase.h:

(DOMWindowIndexedDatabase):

  • Modules/indexeddb/PageGroupIndexedDatabase.cpp:

(WebCore::PageGroupIndexedDatabase::supplementName):
(WebCore):
(WebCore::PageGroupIndexedDatabase::from):

  • Modules/indexeddb/PageGroupIndexedDatabase.h:

(PageGroupIndexedDatabase):

  • Modules/indexeddb/WorkerContextIndexedDatabase.cpp:

(WebCore::WorkerContextIndexedDatabase::supplementName):
(WebCore):
(WebCore::WorkerContextIndexedDatabase::from):

  • Modules/indexeddb/WorkerContextIndexedDatabase.h:

(WorkerContextIndexedDatabase):

  • Modules/intents/DOMWindowIntents.cpp:

(WebCore::DOMWindowIntents::supplementName):
(WebCore):
(WebCore::DOMWindowIntents::from):

  • Modules/intents/DOMWindowIntents.h:

(DOMWindowIntents):

  • Modules/mediastream/UserMediaController.cpp:

(WebCore::UserMediaController::supplementName):

  • Modules/mediastream/UserMediaController.h:

(UserMediaController):

  • Modules/navigatorcontentutils/NavigatorContentUtils.cpp:

(WebCore::NavigatorContentUtils::supplementName):

  • Modules/navigatorcontentutils/NavigatorContentUtils.h:

(NavigatorContentUtils):

  • Modules/networkinfo/NavigatorNetworkInfoConnection.cpp:

(WebCore::NavigatorNetworkInfoConnection::supplementName):
(WebCore):
(WebCore::NavigatorNetworkInfoConnection::from):

  • Modules/networkinfo/NavigatorNetworkInfoConnection.h:

(NavigatorNetworkInfoConnection):

  • Modules/networkinfo/NetworkInfoController.cpp:

(WebCore::NetworkInfoController::supplementName):

  • Modules/networkinfo/NetworkInfoController.h:

(NetworkInfoController):

  • Modules/notifications/DOMWindowNotifications.cpp:

(WebCore::DOMWindowNotifications::supplementName):
(WebCore):
(WebCore::DOMWindowNotifications::from):

  • Modules/notifications/DOMWindowNotifications.h:

(DOMWindowNotifications):

  • Modules/notifications/NotificationController.cpp:

(WebCore::NotificationController::supplementName):

  • Modules/notifications/NotificationController.h:

(NotificationController):

  • Modules/notifications/WorkerContextNotifications.cpp:

(WebCore::WorkerContextNotifications::supplementName):
(WebCore):
(WebCore::WorkerContextNotifications::from):

  • Modules/notifications/WorkerContextNotifications.h:

(WorkerContextNotifications):

  • Modules/quota/DOMWindowQuota.cpp:

(WebCore::DOMWindowQuota::supplementName):
(WebCore):
(WebCore::DOMWindowQuota::from):

  • Modules/quota/DOMWindowQuota.h:

(DOMWindowQuota):

  • Modules/speech/DOMWindowSpeechSynthesis.cpp:

(WebCore::DOMWindowSpeechSynthesis::supplementName):
(WebCore):
(WebCore::DOMWindowSpeechSynthesis::from):

  • Modules/speech/DOMWindowSpeechSynthesis.h:

(DOMWindowSpeechSynthesis):

  • Modules/speech/SpeechRecognitionController.cpp:

(WebCore::SpeechRecognitionController::supplementName):

  • Modules/speech/SpeechRecognitionController.h:

(SpeechRecognitionController):

  • Modules/vibration/Vibration.cpp:

(WebCore::Vibration::supplementName):

  • Modules/vibration/Vibration.h:

(Vibration):

  • Modules/webdatabase/DatabaseContext.cpp:

(WebCore::DatabaseContext::supplementName):
(WebCore):
(WebCore::DatabaseContext::existingDatabaseContextFrom):
(WebCore::DatabaseContext::from):

  • Modules/webdatabase/DatabaseContext.h:

(DatabaseContext):

  • dom/ContextFeatures.cpp:

(WebCore::ContextFeatures::supplementName):

  • dom/ContextFeatures.h:
  • dom/DeviceMotionController.cpp:

(WebCore::DeviceMotionController::supplementName):

  • dom/DeviceMotionController.h:

(DeviceMotionController):

  • dom/DeviceOrientationController.cpp:

(WebCore::DeviceOrientationController::supplementName):

  • dom/DeviceOrientationController.h:

(DeviceOrientationController):

  • loader/PrerendererClient.cpp:

(WebCore::PrerendererClient::supplementName):

  • loader/PrerendererClient.h:

(PrerendererClient):

  • page/DOMWindowPagePopup.cpp:

(WebCore::DOMWindowPagePopup::supplementName):

  • page/DOMWindowPagePopup.h:

(DOMWindowPagePopup):

  • page/SpeechInput.cpp:

(WebCore::SpeechInput::supplementName):

  • page/SpeechInput.h:

(SpeechInput):

  • platform/RefCountedSupplement.h:

(WebCore::RefCountedSupplement::provideTo):
(WebCore::RefCountedSupplement::from):

  • platform/Supplementable.h:

(WebCore):
(WebCore::Supplement::provideTo):
(WebCore::Supplement::from):
(WebCore::Supplementable::provideSupplement):
(WebCore::Supplementable::removeSupplement):
(WebCore::Supplementable::requireSupplement):
(Supplementable):

  • testing/InternalSettings.cpp:

(WebCore::InternalSettings::supplementName):
(WebCore):
(WebCore::InternalSettings::from):

  • testing/InternalSettings.h:

(InternalSettings):

Source/WebKit/chromium:

  • src/ContextFeaturesClientImpl.cpp:

(ContextFeaturesCache):
(WebKit::ContextFeaturesCache::supplementName):

Location:
trunk/Source
Files:
63 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r140506 r140509  
     12013-01-22  Mark Lam  <mark.lam@apple.com>
     2
     3        Change the Supplementable class to not use AtomicString.
     4        https://bugs.webkit.org/show_bug.cgi?id=107535.
     5
     6        Reviewed by Adam Barth.
     7
     8        Replaced the use of AtomicString keys with literal const char* keys.
     9        This simplifies the SupplementMap and makes it slightly leaner and faster.
     10
     11        No new tests.
     12
     13        * Modules/battery/BatteryController.cpp:
     14        (WebCore::BatteryController::supplementName):
     15        * Modules/battery/BatteryController.h:
     16        (BatteryController):
     17        * Modules/battery/NavigatorBattery.cpp:
     18        (WebCore::NavigatorBattery::supplementName):
     19        (WebCore):
     20        (WebCore::NavigatorBattery::from):
     21        * Modules/battery/NavigatorBattery.h:
     22        (NavigatorBattery):
     23        * Modules/filesystem/chromium/DraggedIsolatedFileSystem.cpp:
     24        (WebCore::DraggedIsolatedFileSystem::supplementName):
     25        * Modules/filesystem/chromium/DraggedIsolatedFileSystem.h:
     26        (DraggedIsolatedFileSystem):
     27        * Modules/gamepad/NavigatorGamepad.cpp:
     28        (WebCore::NavigatorGamepad::supplementName):
     29        (WebCore):
     30        (WebCore::NavigatorGamepad::from):
     31        * Modules/gamepad/NavigatorGamepad.h:
     32        (NavigatorGamepad):
     33        * Modules/geolocation/GeolocationController.cpp:
     34        (WebCore::GeolocationController::supplementName):
     35        * Modules/geolocation/GeolocationController.h:
     36        (GeolocationController):
     37        * Modules/geolocation/NavigatorGeolocation.cpp:
     38        (WebCore::NavigatorGeolocation::supplementName):
     39        (WebCore):
     40        (WebCore::NavigatorGeolocation::from):
     41        * Modules/geolocation/NavigatorGeolocation.h:
     42        (NavigatorGeolocation):
     43        * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
     44        (WebCore::DOMWindowIndexedDatabase::supplementName):
     45        (WebCore):
     46        (WebCore::DOMWindowIndexedDatabase::from):
     47        * Modules/indexeddb/DOMWindowIndexedDatabase.h:
     48        (DOMWindowIndexedDatabase):
     49        * Modules/indexeddb/PageGroupIndexedDatabase.cpp:
     50        (WebCore::PageGroupIndexedDatabase::supplementName):
     51        (WebCore):
     52        (WebCore::PageGroupIndexedDatabase::from):
     53        * Modules/indexeddb/PageGroupIndexedDatabase.h:
     54        (PageGroupIndexedDatabase):
     55        * Modules/indexeddb/WorkerContextIndexedDatabase.cpp:
     56        (WebCore::WorkerContextIndexedDatabase::supplementName):
     57        (WebCore):
     58        (WebCore::WorkerContextIndexedDatabase::from):
     59        * Modules/indexeddb/WorkerContextIndexedDatabase.h:
     60        (WorkerContextIndexedDatabase):
     61        * Modules/intents/DOMWindowIntents.cpp:
     62        (WebCore::DOMWindowIntents::supplementName):
     63        (WebCore):
     64        (WebCore::DOMWindowIntents::from):
     65        * Modules/intents/DOMWindowIntents.h:
     66        (DOMWindowIntents):
     67        * Modules/mediastream/UserMediaController.cpp:
     68        (WebCore::UserMediaController::supplementName):
     69        * Modules/mediastream/UserMediaController.h:
     70        (UserMediaController):
     71        * Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
     72        (WebCore::NavigatorContentUtils::supplementName):
     73        * Modules/navigatorcontentutils/NavigatorContentUtils.h:
     74        (NavigatorContentUtils):
     75        * Modules/networkinfo/NavigatorNetworkInfoConnection.cpp:
     76        (WebCore::NavigatorNetworkInfoConnection::supplementName):
     77        (WebCore):
     78        (WebCore::NavigatorNetworkInfoConnection::from):
     79        * Modules/networkinfo/NavigatorNetworkInfoConnection.h:
     80        (NavigatorNetworkInfoConnection):
     81        * Modules/networkinfo/NetworkInfoController.cpp:
     82        (WebCore::NetworkInfoController::supplementName):
     83        * Modules/networkinfo/NetworkInfoController.h:
     84        (NetworkInfoController):
     85        * Modules/notifications/DOMWindowNotifications.cpp:
     86        (WebCore::DOMWindowNotifications::supplementName):
     87        (WebCore):
     88        (WebCore::DOMWindowNotifications::from):
     89        * Modules/notifications/DOMWindowNotifications.h:
     90        (DOMWindowNotifications):
     91        * Modules/notifications/NotificationController.cpp:
     92        (WebCore::NotificationController::supplementName):
     93        * Modules/notifications/NotificationController.h:
     94        (NotificationController):
     95        * Modules/notifications/WorkerContextNotifications.cpp:
     96        (WebCore::WorkerContextNotifications::supplementName):
     97        (WebCore):
     98        (WebCore::WorkerContextNotifications::from):
     99        * Modules/notifications/WorkerContextNotifications.h:
     100        (WorkerContextNotifications):
     101        * Modules/quota/DOMWindowQuota.cpp:
     102        (WebCore::DOMWindowQuota::supplementName):
     103        (WebCore):
     104        (WebCore::DOMWindowQuota::from):
     105        * Modules/quota/DOMWindowQuota.h:
     106        (DOMWindowQuota):
     107        * Modules/speech/DOMWindowSpeechSynthesis.cpp:
     108        (WebCore::DOMWindowSpeechSynthesis::supplementName):
     109        (WebCore):
     110        (WebCore::DOMWindowSpeechSynthesis::from):
     111        * Modules/speech/DOMWindowSpeechSynthesis.h:
     112        (DOMWindowSpeechSynthesis):
     113        * Modules/speech/SpeechRecognitionController.cpp:
     114        (WebCore::SpeechRecognitionController::supplementName):
     115        * Modules/speech/SpeechRecognitionController.h:
     116        (SpeechRecognitionController):
     117        * Modules/vibration/Vibration.cpp:
     118        (WebCore::Vibration::supplementName):
     119        * Modules/vibration/Vibration.h:
     120        (Vibration):
     121        * Modules/webdatabase/DatabaseContext.cpp:
     122        (WebCore::DatabaseContext::supplementName):
     123        (WebCore):
     124        (WebCore::DatabaseContext::existingDatabaseContextFrom):
     125        (WebCore::DatabaseContext::from):
     126        * Modules/webdatabase/DatabaseContext.h:
     127        (DatabaseContext):
     128        * dom/ContextFeatures.cpp:
     129        (WebCore::ContextFeatures::supplementName):
     130        * dom/ContextFeatures.h:
     131        * dom/DeviceMotionController.cpp:
     132        (WebCore::DeviceMotionController::supplementName):
     133        * dom/DeviceMotionController.h:
     134        (DeviceMotionController):
     135        * dom/DeviceOrientationController.cpp:
     136        (WebCore::DeviceOrientationController::supplementName):
     137        * dom/DeviceOrientationController.h:
     138        (DeviceOrientationController):
     139        * loader/PrerendererClient.cpp:
     140        (WebCore::PrerendererClient::supplementName):
     141        * loader/PrerendererClient.h:
     142        (PrerendererClient):
     143        * page/DOMWindowPagePopup.cpp:
     144        (WebCore::DOMWindowPagePopup::supplementName):
     145        * page/DOMWindowPagePopup.h:
     146        (DOMWindowPagePopup):
     147        * page/SpeechInput.cpp:
     148        (WebCore::SpeechInput::supplementName):
     149        * page/SpeechInput.h:
     150        (SpeechInput):
     151        * platform/RefCountedSupplement.h:
     152        (WebCore::RefCountedSupplement::provideTo):
     153        (WebCore::RefCountedSupplement::from):
     154        * platform/Supplementable.h:
     155        (WebCore):
     156        (WebCore::Supplement::provideTo):
     157        (WebCore::Supplement::from):
     158        (WebCore::Supplementable::provideSupplement):
     159        (WebCore::Supplementable::removeSupplement):
     160        (WebCore::Supplementable::requireSupplement):
     161        (Supplementable):
     162        * testing/InternalSettings.cpp:
     163        (WebCore::InternalSettings::supplementName):
     164        (WebCore):
     165        (WebCore::InternalSettings::from):
     166        * testing/InternalSettings.h:
     167        (InternalSettings):
     168
    11692013-01-22  Hajime Morrita  <morrita@google.com>
    2170
  • trunk/Source/WebCore/Modules/battery/BatteryController.cpp

    r133976 r140509  
    9090}
    9191
    92 const AtomicString& BatteryController::supplementName()
     92const char* BatteryController::supplementName()
    9393{
    94     DEFINE_STATIC_LOCAL(AtomicString, name, ("BatteryController", AtomicString::ConstructFromLiteral));
    95     return name;
     94    return "BatteryController";
    9695}
    9796
  • trunk/Source/WebCore/Modules/battery/BatteryController.h

    r113845 r140509  
    4444    BatteryClient* client() const { return m_client; }
    4545
    46     static const AtomicString& supplementName();
     46    static const char* supplementName();
    4747    static BatteryController* from(Page* page) { return static_cast<BatteryController*>(Supplement<Page>::from(page, supplementName())); }
    4848    static bool isActive(Page*);
  • trunk/Source/WebCore/Modules/battery/NavigatorBattery.cpp

    r133976 r140509  
    4949}
    5050
     51const char* NavigatorBattery::supplementName()
     52{
     53    return "NavigatorBattery";
     54}
     55
    5156NavigatorBattery* NavigatorBattery::from(Navigator* navigator)
    5257{
    53     DEFINE_STATIC_LOCAL(AtomicString, name, ("NavigatorBattery", AtomicString::ConstructFromLiteral));
    54     NavigatorBattery* supplement = static_cast<NavigatorBattery*>(Supplement<Navigator>::from(navigator, name));
     58    NavigatorBattery* supplement = static_cast<NavigatorBattery*>(Supplement<Navigator>::from(navigator, supplementName()));
    5559    if (!supplement) {
    5660        supplement = new NavigatorBattery();
    57         provideTo(navigator, name, adoptPtr(supplement));
     61        provideTo(navigator, supplementName(), adoptPtr(supplement));
    5862    }
    5963    return supplement;
  • trunk/Source/WebCore/Modules/battery/NavigatorBattery.h

    r112495 r140509  
    4242 private:
    4343    NavigatorBattery();
     44    static const char* supplementName();
    4445
    4546    RefPtr<BatteryManager> m_batteryManager;
  • trunk/Source/WebCore/Modules/filesystem/chromium/DraggedIsolatedFileSystem.cpp

    r133976 r140509  
    5757
    5858// static
    59 const AtomicString& DraggedIsolatedFileSystem::supplementName()
     59const char* DraggedIsolatedFileSystem::supplementName()
    6060{
    6161    ASSERT(isMainThread());
    62     DEFINE_STATIC_LOCAL(AtomicString, name, ("DraggedIsolatedFileSystem", AtomicString::ConstructFromLiteral));
    63     return name;
     62    return "DraggedIsolatedFileSystem";
    6463}
    6564
  • trunk/Source/WebCore/Modules/filesystem/chromium/DraggedIsolatedFileSystem.h

    r113297 r140509  
    3636#include "ChromiumDataObject.h"
    3737#include <wtf/Forward.h>
    38 #include <wtf/text/AtomicString.h>
    3938#include <wtf/text/WTFString.h>
    4039
     
    5554    DOMFileSystem* getDOMFileSystem(ScriptExecutionContext*);
    5655
    57     static const AtomicString& supplementName();
     56    static const char* supplementName();
    5857    static DraggedIsolatedFileSystem* from(ChromiumDataObject* dataObject) { return static_cast<DraggedIsolatedFileSystem*>(Supplement<ChromiumDataObject>::from(dataObject, supplementName())); }
    5958
  • trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp

    r133976 r140509  
    4444}
    4545
     46const char* NavigatorGamepad::supplementName()
     47{
     48    return "NavigatorGamepad";
     49}
     50
    4651NavigatorGamepad* NavigatorGamepad::from(Navigator* navigator)
    4752{
    48     DEFINE_STATIC_LOCAL(AtomicString, name, ("NavigatorGamepad", AtomicString::ConstructFromLiteral));
    49     NavigatorGamepad* supplement = static_cast<NavigatorGamepad*>(Supplement<Navigator>::from(navigator, name));
     53    NavigatorGamepad* supplement = static_cast<NavigatorGamepad*>(Supplement<Navigator>::from(navigator, supplementName()));
    5054    if (!supplement) {
    5155        supplement = new NavigatorGamepad();
    52         provideTo(navigator, name, adoptPtr(supplement));
     56        provideTo(navigator, supplementName(), adoptPtr(supplement));
    5357    }
    5458    return supplement;
  • trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.h

    r123937 r140509  
    4747private:
    4848    NavigatorGamepad();
     49    static const char* supplementName();
    4950
    5051    RefPtr<GamepadList> m_gamepads;
  • trunk/Source/WebCore/Modules/geolocation/GeolocationController.cpp

    r139005 r140509  
    133133}
    134134
    135 const AtomicString& GeolocationController::supplementName()
     135const char* GeolocationController::supplementName()
    136136{
    137     DEFINE_STATIC_LOCAL(AtomicString, name, ("GeolocationController", AtomicString::ConstructFromLiteral));
    138     return name;
     137    return "GeolocationController";
    139138}
    140139
  • trunk/Source/WebCore/Modules/geolocation/GeolocationController.h

    r123634 r140509  
    6262    GeolocationClient* client() { return m_client; }
    6363
    64     static const AtomicString& supplementName();
     64    static const char* supplementName();
    6565    static GeolocationController* from(Page* page) { return static_cast<GeolocationController*>(Supplement<Page>::from(page, supplementName())); }
    6666
  • trunk/Source/WebCore/Modules/geolocation/NavigatorGeolocation.cpp

    r133976 r140509  
    4343}
    4444
     45const char* NavigatorGeolocation::supplementName()
     46{
     47    return "NavigatorGeolocation";
     48}
     49
    4550NavigatorGeolocation* NavigatorGeolocation::from(Navigator* navigator)
    4651{
    47     DEFINE_STATIC_LOCAL(AtomicString, name, ("NavigatorGeolocation", AtomicString::ConstructFromLiteral));
    48     NavigatorGeolocation* supplement = static_cast<NavigatorGeolocation*>(Supplement<Navigator>::from(navigator, name));
     52    NavigatorGeolocation* supplement = static_cast<NavigatorGeolocation*>(Supplement<Navigator>::from(navigator, supplementName()));
    4953    if (!supplement) {
    5054        supplement = new NavigatorGeolocation(navigator->frame());
    51         provideTo(navigator, name, adoptPtr(supplement));
     55        provideTo(navigator, supplementName(), adoptPtr(supplement));
    5256    }
    5357    return supplement;
  • trunk/Source/WebCore/Modules/geolocation/NavigatorGeolocation.h

    r109875 r140509  
    4242private:
    4343    NavigatorGeolocation(Frame*);
     44    static const char* supplementName();
    4445
    4546    mutable RefPtr<Geolocation> m_geolocation;
  • trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp

    r133976 r140509  
    4848}
    4949
     50const char* DOMWindowIndexedDatabase::supplementName()
     51{
     52    return "DOMWindowIndexedDatabase";
     53}
     54
    5055DOMWindowIndexedDatabase* DOMWindowIndexedDatabase::from(DOMWindow* window)
    5156{
    52     DEFINE_STATIC_LOCAL(AtomicString, name, ("DOMWindowIndexedDatabase", AtomicString::ConstructFromLiteral));
    53     DOMWindowIndexedDatabase* supplement = static_cast<DOMWindowIndexedDatabase*>(Supplement<DOMWindow>::from(window, name));
     57    DOMWindowIndexedDatabase* supplement = static_cast<DOMWindowIndexedDatabase*>(Supplement<DOMWindow>::from(window, supplementName()));
    5458    if (!supplement) {
    5559        supplement = new DOMWindowIndexedDatabase(window);
    56         provideTo(window, name, adoptPtr(supplement));
     60        provideTo(window, supplementName(), adoptPtr(supplement));
    5761    }
    5862    return supplement;
  • trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h

    r129385 r140509  
    5454
    5555    IDBFactory* indexedDB();
     56    static const char* supplementName();
    5657
    5758    DOMWindow* m_window;
  • trunk/Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.cpp

    r133976 r140509  
    4242}
    4343
     44const char* PageGroupIndexedDatabase::supplementName()
     45{
     46    return "PageGroupIndexedDatabase";
     47}
     48
    4449PageGroupIndexedDatabase* PageGroupIndexedDatabase::from(PageGroup& group)
    4550{
    46     DEFINE_STATIC_LOCAL(AtomicString, name, ("PageGroupIndexedDatabase", AtomicString::ConstructFromLiteral));
    47     PageGroupIndexedDatabase* supplement = static_cast<PageGroupIndexedDatabase*>(Supplement<PageGroup>::from(&group, name));
     51    PageGroupIndexedDatabase* supplement = static_cast<PageGroupIndexedDatabase*>(Supplement<PageGroup>::from(&group, supplementName()));
    4852    if (!supplement) {
    4953        supplement = new PageGroupIndexedDatabase();
    50         provideTo(&group, name, adoptPtr(supplement));
     54        provideTo(&group, supplementName(), adoptPtr(supplement));
    5155    }
    5256    return supplement;
  • trunk/Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.h

    r109463 r140509  
    4545private:
    4646    PageGroupIndexedDatabase();
     47    static const char* supplementName();
    4748
    4849    RefPtr<IDBFactoryBackendInterface> m_factoryBackend;
  • trunk/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.cpp

    r129385 r140509  
    4848}
    4949
     50const char* WorkerContextIndexedDatabase::supplementName()
     51{
     52    return "WorkerContextIndexedDatabase";
     53}
     54
    5055WorkerContextIndexedDatabase* WorkerContextIndexedDatabase::from(ScriptExecutionContext* context)
    5156{
    52     AtomicString name = "WorkderContextIndexedDatabase";
    53     WorkerContextIndexedDatabase* supplement = static_cast<WorkerContextIndexedDatabase*>(Supplement<ScriptExecutionContext>::from(context, name));
     57    WorkerContextIndexedDatabase* supplement = static_cast<WorkerContextIndexedDatabase*>(Supplement<ScriptExecutionContext>::from(context, supplementName()));
    5458    if (!supplement) {
    5559        supplement = new WorkerContextIndexedDatabase(context);
    56         provideTo(context, name, adoptPtr(supplement));
     60        provideTo(context, supplementName(), adoptPtr(supplement));
    5761    }
    5862    return supplement;
  • trunk/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.h

    r129385 r140509  
    4949
    5050    IDBFactory* indexedDB();
     51    static const char* supplementName();
    5152
    5253    ScriptExecutionContext* m_context;
  • trunk/Source/WebCore/Modules/intents/DOMWindowIntents.cpp

    r133976 r140509  
    4444}
    4545
     46const char* DOMWindowIntents::supplementName()
     47{
     48    return "DOMWindowIntents";
     49}
     50
    4651DOMWindowIntents* DOMWindowIntents::from(DOMWindow* window)
    4752{
    4853    ASSERT(window);
    49     DEFINE_STATIC_LOCAL(AtomicString, name, ("DOMWindowIntents", AtomicString::ConstructFromLiteral));
    50     DOMWindowIntents* supplement = static_cast<DOMWindowIntents*>(Supplement<DOMWindow>::from(window, name));
     54    DOMWindowIntents* supplement = static_cast<DOMWindowIntents*>(Supplement<DOMWindow>::from(window, supplementName()));
    5155    if (!supplement) {
    5256        supplement = new DOMWindowIntents(window);
    53         provideTo(window, name, adoptPtr(supplement));
     57        provideTo(window, supplementName(), adoptPtr(supplement));
    5458    }
    5559    return supplement;
  • trunk/Source/WebCore/Modules/intents/DOMWindowIntents.h

    r117384 r140509  
    5151
    5252    DeliveredIntent* webkitIntent();
     53    static const char* supplementName();
    5354
    5455    RefPtr<DeliveredIntent> m_intent;
  • trunk/Source/WebCore/Modules/mediastream/UserMediaController.cpp

    r133976 r140509  
    3030namespace WebCore {
    3131
    32 const AtomicString& UserMediaController::supplementName()
     32const char* UserMediaController::supplementName()
    3333{
    34     DEFINE_STATIC_LOCAL(AtomicString, name, ("UserMediaController", AtomicString::ConstructFromLiteral));
    35     return name;
     34    return "UserMediaController";
    3635}
    3736
  • trunk/Source/WebCore/Modules/mediastream/UserMediaController.h

    r123945 r140509  
    4343
    4444    static PassOwnPtr<UserMediaController> create(UserMediaClient*);
    45     static const AtomicString& supplementName();
     45    static const char* supplementName();
    4646    static UserMediaController* from(Page* page) { return static_cast<UserMediaController*>(Supplement<Page>::from(page, supplementName())); }
    4747
  • trunk/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.cpp

    r133976 r140509  
    202202#endif
    203203
    204 const AtomicString& NavigatorContentUtils::supplementName()
    205 {
    206     DEFINE_STATIC_LOCAL(AtomicString, name, ("NavigatorContentUtils", AtomicString::ConstructFromLiteral));
    207     return name;
     204const char* NavigatorContentUtils::supplementName()
     205{
     206    return "NavigatorContentUtils";
    208207}
    209208
  • trunk/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h

    r126735 r140509  
    4646    virtual ~NavigatorContentUtils();
    4747
    48     static const AtomicString& supplementName();
     48    static const char* supplementName();
    4949    static NavigatorContentUtils* from(Page*);
    5050
  • trunk/Source/WebCore/Modules/networkinfo/NavigatorNetworkInfoConnection.cpp

    r133976 r140509  
    4444}
    4545
     46const char* NavigatorNetworkInfoConnection::supplementName()
     47{
     48    return "NavigatorNetworkInfoConnection";
     49}
     50
    4651NavigatorNetworkInfoConnection* NavigatorNetworkInfoConnection::from(Navigator* navigator)
    4752{
    48     DEFINE_STATIC_LOCAL(AtomicString, name, ("NavigatorNetworkInfoConnection", AtomicString::ConstructFromLiteral));
    49     NavigatorNetworkInfoConnection* supplement = static_cast<NavigatorNetworkInfoConnection*>(Supplement<Navigator>::from(navigator, name));
     53    NavigatorNetworkInfoConnection* supplement = static_cast<NavigatorNetworkInfoConnection*>(Supplement<Navigator>::from(navigator, supplementName()));
    5054    if (!supplement) {
    5155        supplement = new NavigatorNetworkInfoConnection();
    52         provideTo(navigator, name, adoptPtr(supplement));
     56        provideTo(navigator, supplementName(), adoptPtr(supplement));
    5357    }
    5458    return supplement;
  • trunk/Source/WebCore/Modules/networkinfo/NavigatorNetworkInfoConnection.h

    r112815 r140509  
    4545private:
    4646    NavigatorNetworkInfoConnection();
     47    static const char* supplementName();
    4748
    4849    RefPtr<NetworkInfoConnection> m_connection;
  • trunk/Source/WebCore/Modules/networkinfo/NetworkInfoController.cpp

    r137568 r140509  
    8080}
    8181
    82 const AtomicString& NetworkInfoController::supplementName()
     82const char* NetworkInfoController::supplementName()
    8383{
    84     DEFINE_STATIC_LOCAL(AtomicString, name, ("NetworkInfoController", AtomicString::ConstructFromLiteral));
    85     return name;
     84    return "NetworkInfoController";
    8685}
    8786
  • trunk/Source/WebCore/Modules/networkinfo/NetworkInfoController.h

    r112815 r140509  
    4545    static PassOwnPtr<NetworkInfoController> create(Page*, NetworkInfoClient*);
    4646
    47     static const AtomicString& supplementName();
     47    static const char* supplementName();
    4848    static NetworkInfoController* from(Page* page) { return static_cast<NetworkInfoController*>(Supplement<Page>::from(page, supplementName())); }
    4949   
  • trunk/Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp

    r133976 r140509  
    4848}
    4949
     50const char* DOMWindowNotifications::supplementName()
     51{
     52    return "DOMWindowNotifications";
     53}
     54
    5055DOMWindowNotifications* DOMWindowNotifications::from(DOMWindow* window)
    5156{
    52     DEFINE_STATIC_LOCAL(AtomicString, supplementName, ("DOMWindowNotifications", AtomicString::ConstructFromLiteral));
    53     DOMWindowNotifications* supplement = static_cast<DOMWindowNotifications*>(Supplement<DOMWindow>::from(window, supplementName));
     57    DOMWindowNotifications* supplement = static_cast<DOMWindowNotifications*>(Supplement<DOMWindow>::from(window, supplementName()));
    5458    if (!supplement) {
    5559        supplement = new DOMWindowNotifications(window);
    56         Supplement<DOMWindow>::provideTo(window, supplementName, adoptPtr(supplement));
     60        Supplement<DOMWindow>::provideTo(window, supplementName(), adoptPtr(supplement));
    5761    }
    5862    return supplement;
  • trunk/Source/WebCore/Modules/notifications/DOMWindowNotifications.h

    r127757 r140509  
    5656
    5757    NotificationCenter* webkitNotifications();
     58    static const char* supplementName();
    5859
    5960    DOMWindow* m_window;
  • trunk/Source/WebCore/Modules/notifications/NotificationController.cpp

    r133976 r140509  
    5757}
    5858
    59 const AtomicString& NotificationController::supplementName()
     59const char* NotificationController::supplementName()
    6060{
    61     DEFINE_STATIC_LOCAL(AtomicString, name, ("NotificationController", AtomicString::ConstructFromLiteral));
    62     return name;
     61    return "NotificationController";
    6362}
    6463
  • trunk/Source/WebCore/Modules/notifications/NotificationController.h

    r123945 r140509  
    4343
    4444    static PassOwnPtr<NotificationController> create(NotificationClient*);
    45     static const AtomicString& supplementName();
     45    static const char* supplementName();
    4646    static NotificationController* from(Page* page) { return static_cast<NotificationController*>(Supplement<Page>::from(page, supplementName())); }
    4747    static NotificationClient* clientFrom(Page*);
  • trunk/Source/WebCore/Modules/notifications/WorkerContextNotifications.cpp

    r139005 r140509  
    4646}
    4747
     48const char* WorkerContextNotifications::supplementName()
     49{
     50    return "WorkerContextNotifications";
     51}
     52
    4853WorkerContextNotifications* WorkerContextNotifications::from(WorkerContext* context)
    4954{
    50     DEFINE_STATIC_LOCAL(AtomicString, supplementName, ("WorkerContextNotifications", AtomicString::ConstructFromLiteral));
    51     WorkerContextNotifications* supplement = static_cast<WorkerContextNotifications*>(Supplement<ScriptExecutionContext>::from(context, supplementName));
     55    WorkerContextNotifications* supplement = static_cast<WorkerContextNotifications*>(Supplement<ScriptExecutionContext>::from(context, supplementName()));
    5256    if (!supplement) {
    5357        supplement = new WorkerContextNotifications(context);
    54         Supplement<ScriptExecutionContext>::provideTo(context, supplementName, adoptPtr(supplement));
     58        Supplement<ScriptExecutionContext>::provideTo(context, supplementName(), adoptPtr(supplement));
    5559    }
    5660    return supplement;
  • trunk/Source/WebCore/Modules/notifications/WorkerContextNotifications.h

    r121882 r140509  
    4949
    5050    NotificationCenter* webkitNotifications();
     51    static const char* supplementName();
    5152
    5253    WorkerContext* m_context;
  • trunk/Source/WebCore/Modules/quota/DOMWindowQuota.cpp

    r133976 r140509  
    4949}
    5050
     51const char* DOMWindowQuota::supplementName()
     52{
     53    return "DOMWindowQuota";
     54}
     55
    5156// static
    5257DOMWindowQuota* DOMWindowQuota::from(DOMWindow* window)
    5358{
    54     DEFINE_STATIC_LOCAL(AtomicString, name, ("DOMWindowQuota", AtomicString::ConstructFromLiteral));
    55     DOMWindowQuota* supplement = static_cast<DOMWindowQuota*>(Supplement<DOMWindow>::from(window, name));
     59    DOMWindowQuota* supplement = static_cast<DOMWindowQuota*>(Supplement<DOMWindow>::from(window, supplementName()));
    5660    if (!supplement) {
    5761        supplement = new DOMWindowQuota(window);
    58         provideTo(window, name, adoptPtr(supplement));
     62        provideTo(window, supplementName(), adoptPtr(supplement));
    5963    }
    6064    return supplement;
  • trunk/Source/WebCore/Modules/quota/DOMWindowQuota.h

    r119954 r140509  
    5151private:
    5252    explicit DOMWindowQuota(DOMWindow*);
     53    static const char* supplementName();
     54
    5355    mutable RefPtr<StorageInfo> m_storageInfo;
    5456};
  • trunk/Source/WebCore/Modules/speech/DOMWindowSpeechSynthesis.cpp

    r139918 r140509  
    4848}
    4949
     50const char* DOMWindowSpeechSynthesis::supplementName()
     51{
     52    return "DOMWindowSpeechSynthesis";
     53}
     54
    5055// static
    5156DOMWindowSpeechSynthesis* DOMWindowSpeechSynthesis::from(DOMWindow* window)
    5257{
    53     DEFINE_STATIC_LOCAL(AtomicString, name, ("DOMWindowSpeechSynthesis", AtomicString::ConstructFromLiteral));
    54     DOMWindowSpeechSynthesis* supplement = static_cast<DOMWindowSpeechSynthesis*>(Supplement<DOMWindow>::from(window, name));
     58    DOMWindowSpeechSynthesis* supplement = static_cast<DOMWindowSpeechSynthesis*>(Supplement<DOMWindow>::from(window, upplementName()));
    5559    if (!supplement) {
    5660        supplement = new DOMWindowSpeechSynthesis(window);
    57         provideTo(window, name, adoptPtr(supplement));
     61        provideTo(window, supplementName(), adoptPtr(supplement));
    5862    }
    5963    return supplement;
  • trunk/Source/WebCore/Modules/speech/DOMWindowSpeechSynthesis.h

    r139918 r140509  
    4848   
    4949    SpeechSynthesis* speechSynthesis();
     50    static const char* supplementName();
    5051   
    5152    RefPtr<SpeechSynthesis> m_speechSynthesis;
  • trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.cpp

    r133976 r140509  
    3131namespace WebCore {
    3232
    33 const AtomicString& SpeechRecognitionController::supplementName()
     33const char* SpeechRecognitionController::supplementName()
    3434{
    35     DEFINE_STATIC_LOCAL(AtomicString, name, ("SpeechRecognitionController", AtomicString::ConstructFromLiteral));
    36     return name;
     35    return "SpeechRecognitionController";
    3736}
    3837
  • trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.h

    r130308 r140509  
    4848
    4949    static PassOwnPtr<SpeechRecognitionController> create(SpeechRecognitionClient*);
    50     static const AtomicString& supplementName();
     50    static const char* supplementName();
    5151    static SpeechRecognitionController* from(Page* page) { return static_cast<SpeechRecognitionController*>(Supplement<Page>::from(page, supplementName())); }
    5252
  • trunk/Source/WebCore/Modules/vibration/Vibration.cpp

    r137410 r140509  
    127127}
    128128
    129 const AtomicString& Vibration::supplementName()
     129const char* Vibration::supplementName()
    130130{
    131     DEFINE_STATIC_LOCAL(AtomicString, name, ("Vibration", AtomicString::ConstructFromLiteral));
    132     return name;
     131    return "Vibration";
    133132}
    134133
  • trunk/Source/WebCore/Modules/vibration/Vibration.h

    r137410 r140509  
    5050    void timerStopFired(Timer<Vibration>*);
    5151
    52     static const AtomicString& supplementName();
     52    static const char* supplementName();
    5353    static Vibration* from(Page* page) { return static_cast<Vibration*>(Supplement<Page>::from(page, supplementName())); }
    5454    static bool isActive(Page*);
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp

    r139078 r140509  
    4545namespace WebCore {
    4646
    47 static DatabaseContext* existingDatabaseContextFrom(ScriptExecutionContext* context)
     47const char* DatabaseContext::supplementName()
    4848{
    49     return static_cast<DatabaseContext*>(Supplement<ScriptExecutionContext>::from(context, "DatabaseContext"));
     49    return "DatabaseContext";
     50}
     51
     52DatabaseContext* DatabaseContext::existingDatabaseContextFrom(ScriptExecutionContext* context)
     53{
     54    return static_cast<DatabaseContext*>(Supplement<ScriptExecutionContext>::from(context, supplementName()));
    5055}
    5156
     
    6974    if (!supplement) {
    7075        supplement = new DatabaseContext(context);
    71         provideTo(context, "DatabaseContext", adoptPtr(supplement));
     76        provideTo(context, supplementName(), adoptPtr(supplement));
    7277        ASSERT(supplement == existingDatabaseContextFrom(context));
    7378    }
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.h

    r139078 r140509  
    6060private:
    6161    explicit DatabaseContext(ScriptExecutionContext*);
     62    static const char* supplementName();
     63    static DatabaseContext* existingDatabaseContextFrom(ScriptExecutionContext*);
    6264
    6365    ScriptExecutionContext* m_scriptExecutionContext;
  • trunk/Source/WebCore/dom/ContextFeatures.cpp

    r133976 r140509  
    4040}
    4141
    42 const AtomicString& ContextFeatures::supplementName()
     42const char* ContextFeatures::supplementName()
    4343{
    44     DEFINE_STATIC_LOCAL(AtomicString, name, ("ContextFeatures", AtomicString::ConstructFromLiteral));
    45     return name;
     44    return "ContextFeatures";
    4645}
    4746
  • trunk/Source/WebCore/dom/ContextFeatures.h

    r133904 r140509  
    4949    };
    5050
    51     static const AtomicString& supplementName();
     51    static const char* supplementName();
    5252    static ContextFeatures* defaultSwitch();
    5353    static PassRefPtr<ContextFeatures> create(ContextFeaturesClient*);
  • trunk/Source/WebCore/dom/DeviceMotionController.cpp

    r135268 r140509  
    6767}
    6868
    69 const AtomicString& DeviceMotionController::supplementName()
     69const char* DeviceMotionController::supplementName()
    7070{
    71     DEFINE_STATIC_LOCAL(AtomicString, name, ("DeviceMotionController", AtomicString::ConstructFromLiteral));
    72     return name;
     71    return "DeviceMotionController";
    7372}
    7473
  • trunk/Source/WebCore/dom/DeviceMotionController.h

    r135268 r140509  
    4747    virtual PassRefPtr<Event> getLastEvent() OVERRIDE;
    4848
    49     static const AtomicString& supplementName();
     49    static const char* supplementName();
    5050    static DeviceMotionController* from(Page*);
    5151    static bool isActiveAt(Page*);
  • trunk/Source/WebCore/dom/DeviceOrientationController.cpp

    r134918 r140509  
    6969}
    7070
    71 const AtomicString& DeviceOrientationController::supplementName()
     71const char* DeviceOrientationController::supplementName()
    7272{
    73     DEFINE_STATIC_LOCAL(AtomicString, name, ("DeviceOrientationController", AtomicString::ConstructFromLiteral));
    74     return name;
     73    return "DeviceOrientationController";
    7574}
    7675
  • trunk/Source/WebCore/dom/DeviceOrientationController.h

    r134918 r140509  
    4848    virtual PassRefPtr<Event> getLastEvent() OVERRIDE;
    4949
    50     static const AtomicString& supplementName();
     50    static const char* supplementName();
    5151    static DeviceOrientationController* from(Page*);
    5252    static bool isActiveAt(Page*);
  • trunk/Source/WebCore/loader/PrerendererClient.cpp

    r133976 r140509  
    3535#include "Page.h"
    3636#include "Supplementable.h"
    37 #include <wtf/text/AtomicString.h>
    3837
    3938#if ENABLE(LINK_PRERENDER)
     
    4241
    4342// static
    44 const AtomicString& PrerendererClient::supplementName()
     43const char* PrerendererClient::supplementName()
    4544{
    46     DEFINE_STATIC_LOCAL(AtomicString, name, ("PrerendererClient", AtomicString::ConstructFromLiteral));
    47     return name;
     45    return "PrerendererClient";
    4846}
    4947
  • trunk/Source/WebCore/loader/PrerendererClient.h

    r117029 r140509  
    5050    virtual void willAddPrerender(PrerenderHandle*) = 0;
    5151
    52     static const AtomicString& supplementName();
     52    static const char* supplementName();
    5353    static PrerendererClient* from(Page*);
    5454
  • trunk/Source/WebCore/page/DOMWindowPagePopup.cpp

    r133976 r140509  
    4949}
    5050
    51 const AtomicString& DOMWindowPagePopup::supplementName()
     51const char* DOMWindowPagePopup::supplementName()
    5252{
    53     DEFINE_STATIC_LOCAL(AtomicString, name, ("DOMWindowPagePopup", AtomicString::ConstructFromLiteral));
    54     return name;
     53    return "DOMWindowPagePopup";
    5554}
    5655
  • trunk/Source/WebCore/page/DOMWindowPagePopup.h

    r132031 r140509  
    5050private:
    5151    explicit DOMWindowPagePopup(PagePopupClient*);
    52     static const AtomicString& supplementName();
     52    static const char* supplementName();
    5353
    5454    RefPtr<PagePopupController> m_controller;
  • trunk/Source/WebCore/page/SpeechInput.cpp

    r133976 r140509  
    118118}
    119119
    120 const AtomicString& SpeechInput::supplementName()
     120const char* SpeechInput::supplementName()
    121121{
    122     DEFINE_STATIC_LOCAL(AtomicString, name, ("SpeechInput", AtomicString::ConstructFromLiteral));
    123     return name;
     122    return "SpeechInput";
    124123}
    125124
  • trunk/Source/WebCore/page/SpeechInput.h

    r123451 r140509  
    5656
    5757    static PassOwnPtr<SpeechInput> create(SpeechInputClient*);
    58     static const AtomicString& supplementName();
     58    static const char* supplementName();
    5959    static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(Supplement<Page>::from(page, supplementName())); }
    6060
  • trunk/Source/WebCore/platform/RefCountedSupplement.h

    r120276 r140509  
    5454    };
    5555
    56     static void provideTo(Supplementable<T>* host, const AtomicString& key, PassRefPtr<ThisType> supplement)
     56    static void provideTo(Supplementable<T>* host, const char* key, PassRefPtr<ThisType> supplement)
    5757    {
    5858        host->provideSupplement(key, adoptPtr(new Wrapper(supplement)));
    5959    }
    6060
    61     static ThisType* from(Supplementable<T>* host, const AtomicString& key)
     61    static ThisType* from(Supplementable<T>* host, const char* key)
    6262    {
    6363        Supplement<T>* found = host->requireSupplement(key);
  • trunk/Source/WebCore/platform/Supplementable.h

    r132031 r140509  
    2828
    2929#include <wtf/HashMap.h>
     30#include <wtf/OwnPtr.h>
    3031#include <wtf/PassOwnPtr.h>
    31 #include <wtf/text/AtomicString.h>
    32 #include <wtf/text/AtomicStringHash.h>
    3332
    3433namespace WebCore {
     34
     35// What you should know about the Supplement keys
     36// ==============================================
     37// The Supplement is expected to use the same const char* string instance
     38// as its key. The Supplementable's SupplementMap will use the address of the
     39// string as the key and not the characters themselves. Hence, 2 strings with
     40// the same characters will be treated as 2 different keys.
     41//
     42// In practice, it is recommended that Supplements implements a static method
     43// for returning its key to use. For example:
     44//
     45//     class MyClass : public Supplement<MySupplementable> {
     46//         ...
     47//         static const char* supplementName();
     48//     }
     49//
     50//     const char* MyClass::supplementName()
     51//     {
     52//         return "MyClass";
     53//     }
     54//
     55// An example of the using the key:
     56//
     57//     MyClass* MyClass::from(MySupplementable* host)
     58//     {
     59//         return reinterpret_cast<MyClass*>(Supplement<MySupplementable>::from(host, supplementName()));
     60//     }
    3561
    3662template<typename T>
     
    4571#endif
    4672
    47     static void provideTo(Supplementable<T>* host, const AtomicString& key, PassOwnPtr<Supplement<T> > supplement)
     73    static void provideTo(Supplementable<T>* host, const char* key, PassOwnPtr<Supplement<T> > supplement)
    4874    {
    4975        host->provideSupplement(key, supplement);
    5076    }
    5177
    52     static Supplement<T>* from(Supplementable<T>* host, const AtomicString& key)
     78    static Supplement<T>* from(Supplementable<T>* host, const char* key)
    5379    {
    5480        return host ? host->requireSupplement(key) : 0;
     
    5985class Supplementable {
    6086public:
    61     void provideSupplement(const AtomicString& key, PassOwnPtr<Supplement<T> > supplement)
     87    void provideSupplement(const char* key, PassOwnPtr<Supplement<T> > supplement)
    6288    {
    63         ASSERT(!m_supplements.get(key.impl()));
     89        ASSERT(!m_supplements.get(key));
    6490        m_supplements.set(key, supplement);
    6591    }
    6692
    67     void removeSupplement(const AtomicString& key)
     93    void removeSupplement(const char* key)
    6894    {
    6995        m_supplements.remove(key);
    7096    }
    7197
    72     Supplement<T>* requireSupplement(const AtomicString& key)
     98    Supplement<T>* requireSupplement(const char* key)
    7399    {
    74100        return m_supplements.get(key);
     
    76102
    77103private:
    78     typedef HashMap<AtomicString, OwnPtr<Supplement<T> > > SupplementMap;
     104    typedef HashMap<const char*, OwnPtr<Supplement<T> >, PtrHash<const char*> > SupplementMap;
    79105    SupplementMap m_supplements;
    80106};
  • trunk/Source/WebCore/testing/InternalSettings.cpp

    r139202 r140509  
    146146};
    147147
     148const char* InternalSettings::supplementName()
     149{
     150    return "InternalSettings";
     151}
     152
    148153InternalSettings* InternalSettings::from(Page* page)
    149154{
    150     DEFINE_STATIC_LOCAL(AtomicString, name, ("InternalSettings", AtomicString::ConstructFromLiteral));
    151     if (!Supplement<Page>::from(page, name))
    152         Supplement<Page>::provideTo(page, name, adoptPtr(new InternalSettingsWrapper(page)));
    153     return static_cast<InternalSettingsWrapper*>(Supplement<Page>::from(page, name))->internalSettings();
     155    if (!Supplement<Page>::from(page, supplementName()))
     156        Supplement<Page>::provideTo(page, supplementName(), adoptPtr(new InternalSettingsWrapper(page)));
     157    return static_cast<InternalSettingsWrapper*>(Supplement<Page>::from(page, supplementName()))->internalSettings();
    154158}
    155159
  • trunk/Source/WebCore/testing/InternalSettings.h

    r139202 r140509  
    130130    Settings* settings() const;
    131131    Page* page() const { return m_page; }
     132    static const char* supplementName();
    132133
    133134    Page* m_page;
  • trunk/Source/WebKit/chromium/ChangeLog

    r140495 r140509  
     12013-01-22  Mark Lam  <mark.lam@apple.com>
     2
     3        Change the Supplementable class to not use AtomicString.
     4        https://bugs.webkit.org/show_bug.cgi?id=107535.
     5
     6        Reviewed by Adam Barth.
     7
     8        Replaced the use of AtomicString keys with literal const char* keys.
     9        This simplifies the SupplementMap and makes it slightly leaner and faster.
     10
     11        * src/ContextFeaturesClientImpl.cpp:
     12        (ContextFeaturesCache):
     13        (WebKit::ContextFeaturesCache::supplementName):
     14
    1152013-01-22  Leandro Gracia Gil  <leandrogracia@chromium.org>
    216
  • trunk/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp

    r133904 r140509  
    7878    };
    7979
    80     static const AtomicString& supplementName();
     80    static const char* supplementName();
    8181    static ContextFeaturesCache* from(Document*);
    8282
     
    9595};
    9696
    97 const AtomicString& ContextFeaturesCache::supplementName()
     97const char* ContextFeaturesCache::supplementName()
    9898{
    99     DEFINE_STATIC_LOCAL(AtomicString, name, ("ContextFeaturesCache"));
    100     return name;
     99    return "ContextFeaturesCache";
    101100}
    102101
Note: See TracChangeset for help on using the changeset viewer.