Changeset 140509 in webkit
- Timestamp:
- Jan 22, 2013 10:49:45 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 63 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r140506 r140509 1 2013-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 1 169 2013-01-22 Hajime Morrita <morrita@google.com> 2 170 -
trunk/Source/WebCore/Modules/battery/BatteryController.cpp
r133976 r140509 90 90 } 91 91 92 const AtomicString&BatteryController::supplementName()92 const char* BatteryController::supplementName() 93 93 { 94 DEFINE_STATIC_LOCAL(AtomicString, name, ("BatteryController", AtomicString::ConstructFromLiteral)); 95 return name; 94 return "BatteryController"; 96 95 } 97 96 -
trunk/Source/WebCore/Modules/battery/BatteryController.h
r113845 r140509 44 44 BatteryClient* client() const { return m_client; } 45 45 46 static const AtomicString&supplementName();46 static const char* supplementName(); 47 47 static BatteryController* from(Page* page) { return static_cast<BatteryController*>(Supplement<Page>::from(page, supplementName())); } 48 48 static bool isActive(Page*); -
trunk/Source/WebCore/Modules/battery/NavigatorBattery.cpp
r133976 r140509 49 49 } 50 50 51 const char* NavigatorBattery::supplementName() 52 { 53 return "NavigatorBattery"; 54 } 55 51 56 NavigatorBattery* NavigatorBattery::from(Navigator* navigator) 52 57 { 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())); 55 59 if (!supplement) { 56 60 supplement = new NavigatorBattery(); 57 provideTo(navigator, name, adoptPtr(supplement));61 provideTo(navigator, supplementName(), adoptPtr(supplement)); 58 62 } 59 63 return supplement; -
trunk/Source/WebCore/Modules/battery/NavigatorBattery.h
r112495 r140509 42 42 private: 43 43 NavigatorBattery(); 44 static const char* supplementName(); 44 45 45 46 RefPtr<BatteryManager> m_batteryManager; -
trunk/Source/WebCore/Modules/filesystem/chromium/DraggedIsolatedFileSystem.cpp
r133976 r140509 57 57 58 58 // static 59 const AtomicString&DraggedIsolatedFileSystem::supplementName()59 const char* DraggedIsolatedFileSystem::supplementName() 60 60 { 61 61 ASSERT(isMainThread()); 62 DEFINE_STATIC_LOCAL(AtomicString, name, ("DraggedIsolatedFileSystem", AtomicString::ConstructFromLiteral)); 63 return name; 62 return "DraggedIsolatedFileSystem"; 64 63 } 65 64 -
trunk/Source/WebCore/Modules/filesystem/chromium/DraggedIsolatedFileSystem.h
r113297 r140509 36 36 #include "ChromiumDataObject.h" 37 37 #include <wtf/Forward.h> 38 #include <wtf/text/AtomicString.h>39 38 #include <wtf/text/WTFString.h> 40 39 … … 55 54 DOMFileSystem* getDOMFileSystem(ScriptExecutionContext*); 56 55 57 static const AtomicString&supplementName();56 static const char* supplementName(); 58 57 static DraggedIsolatedFileSystem* from(ChromiumDataObject* dataObject) { return static_cast<DraggedIsolatedFileSystem*>(Supplement<ChromiumDataObject>::from(dataObject, supplementName())); } 59 58 -
trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp
r133976 r140509 44 44 } 45 45 46 const char* NavigatorGamepad::supplementName() 47 { 48 return "NavigatorGamepad"; 49 } 50 46 51 NavigatorGamepad* NavigatorGamepad::from(Navigator* navigator) 47 52 { 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())); 50 54 if (!supplement) { 51 55 supplement = new NavigatorGamepad(); 52 provideTo(navigator, name, adoptPtr(supplement));56 provideTo(navigator, supplementName(), adoptPtr(supplement)); 53 57 } 54 58 return supplement; -
trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.h
r123937 r140509 47 47 private: 48 48 NavigatorGamepad(); 49 static const char* supplementName(); 49 50 50 51 RefPtr<GamepadList> m_gamepads; -
trunk/Source/WebCore/Modules/geolocation/GeolocationController.cpp
r139005 r140509 133 133 } 134 134 135 const AtomicString&GeolocationController::supplementName()135 const char* GeolocationController::supplementName() 136 136 { 137 DEFINE_STATIC_LOCAL(AtomicString, name, ("GeolocationController", AtomicString::ConstructFromLiteral)); 138 return name; 137 return "GeolocationController"; 139 138 } 140 139 -
trunk/Source/WebCore/Modules/geolocation/GeolocationController.h
r123634 r140509 62 62 GeolocationClient* client() { return m_client; } 63 63 64 static const AtomicString&supplementName();64 static const char* supplementName(); 65 65 static GeolocationController* from(Page* page) { return static_cast<GeolocationController*>(Supplement<Page>::from(page, supplementName())); } 66 66 -
trunk/Source/WebCore/Modules/geolocation/NavigatorGeolocation.cpp
r133976 r140509 43 43 } 44 44 45 const char* NavigatorGeolocation::supplementName() 46 { 47 return "NavigatorGeolocation"; 48 } 49 45 50 NavigatorGeolocation* NavigatorGeolocation::from(Navigator* navigator) 46 51 { 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())); 49 53 if (!supplement) { 50 54 supplement = new NavigatorGeolocation(navigator->frame()); 51 provideTo(navigator, name, adoptPtr(supplement));55 provideTo(navigator, supplementName(), adoptPtr(supplement)); 52 56 } 53 57 return supplement; -
trunk/Source/WebCore/Modules/geolocation/NavigatorGeolocation.h
r109875 r140509 42 42 private: 43 43 NavigatorGeolocation(Frame*); 44 static const char* supplementName(); 44 45 45 46 mutable RefPtr<Geolocation> m_geolocation; -
trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp
r133976 r140509 48 48 } 49 49 50 const char* DOMWindowIndexedDatabase::supplementName() 51 { 52 return "DOMWindowIndexedDatabase"; 53 } 54 50 55 DOMWindowIndexedDatabase* DOMWindowIndexedDatabase::from(DOMWindow* window) 51 56 { 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())); 54 58 if (!supplement) { 55 59 supplement = new DOMWindowIndexedDatabase(window); 56 provideTo(window, name, adoptPtr(supplement));60 provideTo(window, supplementName(), adoptPtr(supplement)); 57 61 } 58 62 return supplement; -
trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h
r129385 r140509 54 54 55 55 IDBFactory* indexedDB(); 56 static const char* supplementName(); 56 57 57 58 DOMWindow* m_window; -
trunk/Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.cpp
r133976 r140509 42 42 } 43 43 44 const char* PageGroupIndexedDatabase::supplementName() 45 { 46 return "PageGroupIndexedDatabase"; 47 } 48 44 49 PageGroupIndexedDatabase* PageGroupIndexedDatabase::from(PageGroup& group) 45 50 { 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())); 48 52 if (!supplement) { 49 53 supplement = new PageGroupIndexedDatabase(); 50 provideTo(&group, name, adoptPtr(supplement));54 provideTo(&group, supplementName(), adoptPtr(supplement)); 51 55 } 52 56 return supplement; -
trunk/Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.h
r109463 r140509 45 45 private: 46 46 PageGroupIndexedDatabase(); 47 static const char* supplementName(); 47 48 48 49 RefPtr<IDBFactoryBackendInterface> m_factoryBackend; -
trunk/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.cpp
r129385 r140509 48 48 } 49 49 50 const char* WorkerContextIndexedDatabase::supplementName() 51 { 52 return "WorkerContextIndexedDatabase"; 53 } 54 50 55 WorkerContextIndexedDatabase* WorkerContextIndexedDatabase::from(ScriptExecutionContext* context) 51 56 { 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())); 54 58 if (!supplement) { 55 59 supplement = new WorkerContextIndexedDatabase(context); 56 provideTo(context, name, adoptPtr(supplement));60 provideTo(context, supplementName(), adoptPtr(supplement)); 57 61 } 58 62 return supplement; -
trunk/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.h
r129385 r140509 49 49 50 50 IDBFactory* indexedDB(); 51 static const char* supplementName(); 51 52 52 53 ScriptExecutionContext* m_context; -
trunk/Source/WebCore/Modules/intents/DOMWindowIntents.cpp
r133976 r140509 44 44 } 45 45 46 const char* DOMWindowIntents::supplementName() 47 { 48 return "DOMWindowIntents"; 49 } 50 46 51 DOMWindowIntents* DOMWindowIntents::from(DOMWindow* window) 47 52 { 48 53 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())); 51 55 if (!supplement) { 52 56 supplement = new DOMWindowIntents(window); 53 provideTo(window, name, adoptPtr(supplement));57 provideTo(window, supplementName(), adoptPtr(supplement)); 54 58 } 55 59 return supplement; -
trunk/Source/WebCore/Modules/intents/DOMWindowIntents.h
r117384 r140509 51 51 52 52 DeliveredIntent* webkitIntent(); 53 static const char* supplementName(); 53 54 54 55 RefPtr<DeliveredIntent> m_intent; -
trunk/Source/WebCore/Modules/mediastream/UserMediaController.cpp
r133976 r140509 30 30 namespace WebCore { 31 31 32 const AtomicString&UserMediaController::supplementName()32 const char* UserMediaController::supplementName() 33 33 { 34 DEFINE_STATIC_LOCAL(AtomicString, name, ("UserMediaController", AtomicString::ConstructFromLiteral)); 35 return name; 34 return "UserMediaController"; 36 35 } 37 36 -
trunk/Source/WebCore/Modules/mediastream/UserMediaController.h
r123945 r140509 43 43 44 44 static PassOwnPtr<UserMediaController> create(UserMediaClient*); 45 static const AtomicString&supplementName();45 static const char* supplementName(); 46 46 static UserMediaController* from(Page* page) { return static_cast<UserMediaController*>(Supplement<Page>::from(page, supplementName())); } 47 47 -
trunk/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.cpp
r133976 r140509 202 202 #endif 203 203 204 const AtomicString& NavigatorContentUtils::supplementName() 205 { 206 DEFINE_STATIC_LOCAL(AtomicString, name, ("NavigatorContentUtils", AtomicString::ConstructFromLiteral)); 207 return name; 204 const char* NavigatorContentUtils::supplementName() 205 { 206 return "NavigatorContentUtils"; 208 207 } 209 208 -
trunk/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h
r126735 r140509 46 46 virtual ~NavigatorContentUtils(); 47 47 48 static const AtomicString&supplementName();48 static const char* supplementName(); 49 49 static NavigatorContentUtils* from(Page*); 50 50 -
trunk/Source/WebCore/Modules/networkinfo/NavigatorNetworkInfoConnection.cpp
r133976 r140509 44 44 } 45 45 46 const char* NavigatorNetworkInfoConnection::supplementName() 47 { 48 return "NavigatorNetworkInfoConnection"; 49 } 50 46 51 NavigatorNetworkInfoConnection* NavigatorNetworkInfoConnection::from(Navigator* navigator) 47 52 { 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())); 50 54 if (!supplement) { 51 55 supplement = new NavigatorNetworkInfoConnection(); 52 provideTo(navigator, name, adoptPtr(supplement));56 provideTo(navigator, supplementName(), adoptPtr(supplement)); 53 57 } 54 58 return supplement; -
trunk/Source/WebCore/Modules/networkinfo/NavigatorNetworkInfoConnection.h
r112815 r140509 45 45 private: 46 46 NavigatorNetworkInfoConnection(); 47 static const char* supplementName(); 47 48 48 49 RefPtr<NetworkInfoConnection> m_connection; -
trunk/Source/WebCore/Modules/networkinfo/NetworkInfoController.cpp
r137568 r140509 80 80 } 81 81 82 const AtomicString&NetworkInfoController::supplementName()82 const char* NetworkInfoController::supplementName() 83 83 { 84 DEFINE_STATIC_LOCAL(AtomicString, name, ("NetworkInfoController", AtomicString::ConstructFromLiteral)); 85 return name; 84 return "NetworkInfoController"; 86 85 } 87 86 -
trunk/Source/WebCore/Modules/networkinfo/NetworkInfoController.h
r112815 r140509 45 45 static PassOwnPtr<NetworkInfoController> create(Page*, NetworkInfoClient*); 46 46 47 static const AtomicString&supplementName();47 static const char* supplementName(); 48 48 static NetworkInfoController* from(Page* page) { return static_cast<NetworkInfoController*>(Supplement<Page>::from(page, supplementName())); } 49 49 -
trunk/Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp
r133976 r140509 48 48 } 49 49 50 const char* DOMWindowNotifications::supplementName() 51 { 52 return "DOMWindowNotifications"; 53 } 54 50 55 DOMWindowNotifications* DOMWindowNotifications::from(DOMWindow* window) 51 56 { 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())); 54 58 if (!supplement) { 55 59 supplement = new DOMWindowNotifications(window); 56 Supplement<DOMWindow>::provideTo(window, supplementName , adoptPtr(supplement));60 Supplement<DOMWindow>::provideTo(window, supplementName(), adoptPtr(supplement)); 57 61 } 58 62 return supplement; -
trunk/Source/WebCore/Modules/notifications/DOMWindowNotifications.h
r127757 r140509 56 56 57 57 NotificationCenter* webkitNotifications(); 58 static const char* supplementName(); 58 59 59 60 DOMWindow* m_window; -
trunk/Source/WebCore/Modules/notifications/NotificationController.cpp
r133976 r140509 57 57 } 58 58 59 const AtomicString&NotificationController::supplementName()59 const char* NotificationController::supplementName() 60 60 { 61 DEFINE_STATIC_LOCAL(AtomicString, name, ("NotificationController", AtomicString::ConstructFromLiteral)); 62 return name; 61 return "NotificationController"; 63 62 } 64 63 -
trunk/Source/WebCore/Modules/notifications/NotificationController.h
r123945 r140509 43 43 44 44 static PassOwnPtr<NotificationController> create(NotificationClient*); 45 static const AtomicString&supplementName();45 static const char* supplementName(); 46 46 static NotificationController* from(Page* page) { return static_cast<NotificationController*>(Supplement<Page>::from(page, supplementName())); } 47 47 static NotificationClient* clientFrom(Page*); -
trunk/Source/WebCore/Modules/notifications/WorkerContextNotifications.cpp
r139005 r140509 46 46 } 47 47 48 const char* WorkerContextNotifications::supplementName() 49 { 50 return "WorkerContextNotifications"; 51 } 52 48 53 WorkerContextNotifications* WorkerContextNotifications::from(WorkerContext* context) 49 54 { 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())); 52 56 if (!supplement) { 53 57 supplement = new WorkerContextNotifications(context); 54 Supplement<ScriptExecutionContext>::provideTo(context, supplementName , adoptPtr(supplement));58 Supplement<ScriptExecutionContext>::provideTo(context, supplementName(), adoptPtr(supplement)); 55 59 } 56 60 return supplement; -
trunk/Source/WebCore/Modules/notifications/WorkerContextNotifications.h
r121882 r140509 49 49 50 50 NotificationCenter* webkitNotifications(); 51 static const char* supplementName(); 51 52 52 53 WorkerContext* m_context; -
trunk/Source/WebCore/Modules/quota/DOMWindowQuota.cpp
r133976 r140509 49 49 } 50 50 51 const char* DOMWindowQuota::supplementName() 52 { 53 return "DOMWindowQuota"; 54 } 55 51 56 // static 52 57 DOMWindowQuota* DOMWindowQuota::from(DOMWindow* window) 53 58 { 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())); 56 60 if (!supplement) { 57 61 supplement = new DOMWindowQuota(window); 58 provideTo(window, name, adoptPtr(supplement));62 provideTo(window, supplementName(), adoptPtr(supplement)); 59 63 } 60 64 return supplement; -
trunk/Source/WebCore/Modules/quota/DOMWindowQuota.h
r119954 r140509 51 51 private: 52 52 explicit DOMWindowQuota(DOMWindow*); 53 static const char* supplementName(); 54 53 55 mutable RefPtr<StorageInfo> m_storageInfo; 54 56 }; -
trunk/Source/WebCore/Modules/speech/DOMWindowSpeechSynthesis.cpp
r139918 r140509 48 48 } 49 49 50 const char* DOMWindowSpeechSynthesis::supplementName() 51 { 52 return "DOMWindowSpeechSynthesis"; 53 } 54 50 55 // static 51 56 DOMWindowSpeechSynthesis* DOMWindowSpeechSynthesis::from(DOMWindow* window) 52 57 { 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())); 55 59 if (!supplement) { 56 60 supplement = new DOMWindowSpeechSynthesis(window); 57 provideTo(window, name, adoptPtr(supplement));61 provideTo(window, supplementName(), adoptPtr(supplement)); 58 62 } 59 63 return supplement; -
trunk/Source/WebCore/Modules/speech/DOMWindowSpeechSynthesis.h
r139918 r140509 48 48 49 49 SpeechSynthesis* speechSynthesis(); 50 static const char* supplementName(); 50 51 51 52 RefPtr<SpeechSynthesis> m_speechSynthesis; -
trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.cpp
r133976 r140509 31 31 namespace WebCore { 32 32 33 const AtomicString&SpeechRecognitionController::supplementName()33 const char* SpeechRecognitionController::supplementName() 34 34 { 35 DEFINE_STATIC_LOCAL(AtomicString, name, ("SpeechRecognitionController", AtomicString::ConstructFromLiteral)); 36 return name; 35 return "SpeechRecognitionController"; 37 36 } 38 37 -
trunk/Source/WebCore/Modules/speech/SpeechRecognitionController.h
r130308 r140509 48 48 49 49 static PassOwnPtr<SpeechRecognitionController> create(SpeechRecognitionClient*); 50 static const AtomicString&supplementName();50 static const char* supplementName(); 51 51 static SpeechRecognitionController* from(Page* page) { return static_cast<SpeechRecognitionController*>(Supplement<Page>::from(page, supplementName())); } 52 52 -
trunk/Source/WebCore/Modules/vibration/Vibration.cpp
r137410 r140509 127 127 } 128 128 129 const AtomicString&Vibration::supplementName()129 const char* Vibration::supplementName() 130 130 { 131 DEFINE_STATIC_LOCAL(AtomicString, name, ("Vibration", AtomicString::ConstructFromLiteral)); 132 return name; 131 return "Vibration"; 133 132 } 134 133 -
trunk/Source/WebCore/Modules/vibration/Vibration.h
r137410 r140509 50 50 void timerStopFired(Timer<Vibration>*); 51 51 52 static const AtomicString&supplementName();52 static const char* supplementName(); 53 53 static Vibration* from(Page* page) { return static_cast<Vibration*>(Supplement<Page>::from(page, supplementName())); } 54 54 static bool isActive(Page*); -
trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp
r139078 r140509 45 45 namespace WebCore { 46 46 47 static DatabaseContext* existingDatabaseContextFrom(ScriptExecutionContext* context)47 const char* DatabaseContext::supplementName() 48 48 { 49 return static_cast<DatabaseContext*>(Supplement<ScriptExecutionContext>::from(context, "DatabaseContext")); 49 return "DatabaseContext"; 50 } 51 52 DatabaseContext* DatabaseContext::existingDatabaseContextFrom(ScriptExecutionContext* context) 53 { 54 return static_cast<DatabaseContext*>(Supplement<ScriptExecutionContext>::from(context, supplementName())); 50 55 } 51 56 … … 69 74 if (!supplement) { 70 75 supplement = new DatabaseContext(context); 71 provideTo(context, "DatabaseContext", adoptPtr(supplement));76 provideTo(context, supplementName(), adoptPtr(supplement)); 72 77 ASSERT(supplement == existingDatabaseContextFrom(context)); 73 78 } -
trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.h
r139078 r140509 60 60 private: 61 61 explicit DatabaseContext(ScriptExecutionContext*); 62 static const char* supplementName(); 63 static DatabaseContext* existingDatabaseContextFrom(ScriptExecutionContext*); 62 64 63 65 ScriptExecutionContext* m_scriptExecutionContext; -
trunk/Source/WebCore/dom/ContextFeatures.cpp
r133976 r140509 40 40 } 41 41 42 const AtomicString&ContextFeatures::supplementName()42 const char* ContextFeatures::supplementName() 43 43 { 44 DEFINE_STATIC_LOCAL(AtomicString, name, ("ContextFeatures", AtomicString::ConstructFromLiteral)); 45 return name; 44 return "ContextFeatures"; 46 45 } 47 46 -
trunk/Source/WebCore/dom/ContextFeatures.h
r133904 r140509 49 49 }; 50 50 51 static const AtomicString&supplementName();51 static const char* supplementName(); 52 52 static ContextFeatures* defaultSwitch(); 53 53 static PassRefPtr<ContextFeatures> create(ContextFeaturesClient*); -
trunk/Source/WebCore/dom/DeviceMotionController.cpp
r135268 r140509 67 67 } 68 68 69 const AtomicString&DeviceMotionController::supplementName()69 const char* DeviceMotionController::supplementName() 70 70 { 71 DEFINE_STATIC_LOCAL(AtomicString, name, ("DeviceMotionController", AtomicString::ConstructFromLiteral)); 72 return name; 71 return "DeviceMotionController"; 73 72 } 74 73 -
trunk/Source/WebCore/dom/DeviceMotionController.h
r135268 r140509 47 47 virtual PassRefPtr<Event> getLastEvent() OVERRIDE; 48 48 49 static const AtomicString&supplementName();49 static const char* supplementName(); 50 50 static DeviceMotionController* from(Page*); 51 51 static bool isActiveAt(Page*); -
trunk/Source/WebCore/dom/DeviceOrientationController.cpp
r134918 r140509 69 69 } 70 70 71 const AtomicString&DeviceOrientationController::supplementName()71 const char* DeviceOrientationController::supplementName() 72 72 { 73 DEFINE_STATIC_LOCAL(AtomicString, name, ("DeviceOrientationController", AtomicString::ConstructFromLiteral)); 74 return name; 73 return "DeviceOrientationController"; 75 74 } 76 75 -
trunk/Source/WebCore/dom/DeviceOrientationController.h
r134918 r140509 48 48 virtual PassRefPtr<Event> getLastEvent() OVERRIDE; 49 49 50 static const AtomicString&supplementName();50 static const char* supplementName(); 51 51 static DeviceOrientationController* from(Page*); 52 52 static bool isActiveAt(Page*); -
trunk/Source/WebCore/loader/PrerendererClient.cpp
r133976 r140509 35 35 #include "Page.h" 36 36 #include "Supplementable.h" 37 #include <wtf/text/AtomicString.h>38 37 39 38 #if ENABLE(LINK_PRERENDER) … … 42 41 43 42 // static 44 const AtomicString&PrerendererClient::supplementName()43 const char* PrerendererClient::supplementName() 45 44 { 46 DEFINE_STATIC_LOCAL(AtomicString, name, ("PrerendererClient", AtomicString::ConstructFromLiteral)); 47 return name; 45 return "PrerendererClient"; 48 46 } 49 47 -
trunk/Source/WebCore/loader/PrerendererClient.h
r117029 r140509 50 50 virtual void willAddPrerender(PrerenderHandle*) = 0; 51 51 52 static const AtomicString&supplementName();52 static const char* supplementName(); 53 53 static PrerendererClient* from(Page*); 54 54 -
trunk/Source/WebCore/page/DOMWindowPagePopup.cpp
r133976 r140509 49 49 } 50 50 51 const AtomicString&DOMWindowPagePopup::supplementName()51 const char* DOMWindowPagePopup::supplementName() 52 52 { 53 DEFINE_STATIC_LOCAL(AtomicString, name, ("DOMWindowPagePopup", AtomicString::ConstructFromLiteral)); 54 return name; 53 return "DOMWindowPagePopup"; 55 54 } 56 55 -
trunk/Source/WebCore/page/DOMWindowPagePopup.h
r132031 r140509 50 50 private: 51 51 explicit DOMWindowPagePopup(PagePopupClient*); 52 static const AtomicString&supplementName();52 static const char* supplementName(); 53 53 54 54 RefPtr<PagePopupController> m_controller; -
trunk/Source/WebCore/page/SpeechInput.cpp
r133976 r140509 118 118 } 119 119 120 const AtomicString&SpeechInput::supplementName()120 const char* SpeechInput::supplementName() 121 121 { 122 DEFINE_STATIC_LOCAL(AtomicString, name, ("SpeechInput", AtomicString::ConstructFromLiteral)); 123 return name; 122 return "SpeechInput"; 124 123 } 125 124 -
trunk/Source/WebCore/page/SpeechInput.h
r123451 r140509 56 56 57 57 static PassOwnPtr<SpeechInput> create(SpeechInputClient*); 58 static const AtomicString&supplementName();58 static const char* supplementName(); 59 59 static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(Supplement<Page>::from(page, supplementName())); } 60 60 -
trunk/Source/WebCore/platform/RefCountedSupplement.h
r120276 r140509 54 54 }; 55 55 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) 57 57 { 58 58 host->provideSupplement(key, adoptPtr(new Wrapper(supplement))); 59 59 } 60 60 61 static ThisType* from(Supplementable<T>* host, const AtomicString&key)61 static ThisType* from(Supplementable<T>* host, const char* key) 62 62 { 63 63 Supplement<T>* found = host->requireSupplement(key); -
trunk/Source/WebCore/platform/Supplementable.h
r132031 r140509 28 28 29 29 #include <wtf/HashMap.h> 30 #include <wtf/OwnPtr.h> 30 31 #include <wtf/PassOwnPtr.h> 31 #include <wtf/text/AtomicString.h>32 #include <wtf/text/AtomicStringHash.h>33 32 34 33 namespace 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 // } 35 61 36 62 template<typename T> … … 45 71 #endif 46 72 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) 48 74 { 49 75 host->provideSupplement(key, supplement); 50 76 } 51 77 52 static Supplement<T>* from(Supplementable<T>* host, const AtomicString&key)78 static Supplement<T>* from(Supplementable<T>* host, const char* key) 53 79 { 54 80 return host ? host->requireSupplement(key) : 0; … … 59 85 class Supplementable { 60 86 public: 61 void provideSupplement(const AtomicString&key, PassOwnPtr<Supplement<T> > supplement)87 void provideSupplement(const char* key, PassOwnPtr<Supplement<T> > supplement) 62 88 { 63 ASSERT(!m_supplements.get(key .impl()));89 ASSERT(!m_supplements.get(key)); 64 90 m_supplements.set(key, supplement); 65 91 } 66 92 67 void removeSupplement(const AtomicString&key)93 void removeSupplement(const char* key) 68 94 { 69 95 m_supplements.remove(key); 70 96 } 71 97 72 Supplement<T>* requireSupplement(const AtomicString&key)98 Supplement<T>* requireSupplement(const char* key) 73 99 { 74 100 return m_supplements.get(key); … … 76 102 77 103 private: 78 typedef HashMap< AtomicString, OwnPtr<Supplement<T>> > SupplementMap;104 typedef HashMap<const char*, OwnPtr<Supplement<T> >, PtrHash<const char*> > SupplementMap; 79 105 SupplementMap m_supplements; 80 106 }; -
trunk/Source/WebCore/testing/InternalSettings.cpp
r139202 r140509 146 146 }; 147 147 148 const char* InternalSettings::supplementName() 149 { 150 return "InternalSettings"; 151 } 152 148 153 InternalSettings* InternalSettings::from(Page* page) 149 154 { 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(); 154 158 } 155 159 -
trunk/Source/WebCore/testing/InternalSettings.h
r139202 r140509 130 130 Settings* settings() const; 131 131 Page* page() const { return m_page; } 132 static const char* supplementName(); 132 133 133 134 Page* m_page; -
trunk/Source/WebKit/chromium/ChangeLog
r140495 r140509 1 2013-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 1 15 2013-01-22 Leandro Gracia Gil <leandrogracia@chromium.org> 2 16 -
trunk/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp
r133904 r140509 78 78 }; 79 79 80 static const AtomicString&supplementName();80 static const char* supplementName(); 81 81 static ContextFeaturesCache* from(Document*); 82 82 … … 95 95 }; 96 96 97 const AtomicString&ContextFeaturesCache::supplementName()97 const char* ContextFeaturesCache::supplementName() 98 98 { 99 DEFINE_STATIC_LOCAL(AtomicString, name, ("ContextFeaturesCache")); 100 return name; 99 return "ContextFeaturesCache"; 101 100 } 102 101
Note: See TracChangeset
for help on using the changeset viewer.