Convert OwnPtr and PassOwnPtr uses to std::unique_ptr in Supplement
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 May 2014 02:28:49 +0000 (02:28 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 May 2014 02:28:49 +0000 (02:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132165

Reviewed by Darin Adler.

According to convert from PassOwnPtr to std::unique_ptr, provideTo() callers also begin
to use std::make_unique.

* Modules/battery/BatteryController.cpp:
(WebCore::provideBatteryTo):
* Modules/battery/BatteryController.h:
* Modules/battery/NavigatorBattery.cpp:
(WebCore::NavigatorBattery::from):
* Modules/gamepad/NavigatorGamepad.cpp:
(WebCore::NavigatorGamepad::from):
* Modules/geolocation/GeolocationController.cpp:
(WebCore::provideGeolocationTo):
* Modules/geolocation/GeolocationController.h:
* Modules/geolocation/NavigatorGeolocation.cpp:
(WebCore::NavigatorGeolocation::from):
* Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
(WebCore::DOMWindowIndexedDatabase::from):
* Modules/indexeddb/PageGroupIndexedDatabase.cpp:
(WebCore::PageGroupIndexedDatabase::from):
* Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp:
(WebCore::WorkerGlobalScopeIndexedDatabase::from):
* Modules/mediastream/UserMediaController.cpp:
(WebCore::provideUserMediaTo):
(WebCore::UserMediaController::create): Deleted.
* Modules/mediastream/UserMediaController.h:
* Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
(WebCore::provideNavigatorContentUtilsTo):
(WebCore::NavigatorContentUtils::create): Deleted.
* Modules/navigatorcontentutils/NavigatorContentUtils.h:
* Modules/notifications/DOMWindowNotifications.cpp:
(WebCore::DOMWindowNotifications::from):
* Modules/notifications/NotificationController.cpp:
(WebCore::provideNotification):
(WebCore::NotificationController::create): Deleted.
* Modules/notifications/NotificationController.h:
* Modules/notifications/WorkerGlobalScopeNotifications.cpp:
(WebCore::WorkerGlobalScopeNotifications::from):
* Modules/proximity/DeviceProximityController.cpp:
(WebCore::provideDeviceProximityTo):
(WebCore::DeviceProximityController::create): Deleted.
* Modules/proximity/DeviceProximityController.h:
* Modules/quota/DOMWindowQuota.cpp:
(WebCore::DOMWindowQuota::from):
* Modules/quota/NavigatorStorageQuota.cpp:
(WebCore::NavigatorStorageQuota::from):
* Modules/quota/WorkerNavigatorStorageQuota.cpp:
(WebCore::WorkerNavigatorStorageQuota::from):
* Modules/speech/DOMWindowSpeechSynthesis.cpp:
(WebCore::DOMWindowSpeechSynthesis::from):
* Modules/speech/SpeechRecognitionController.cpp:
(WebCore::provideSpeechRecognitionTo):
* Modules/vibration/Vibration.cpp:
(WebCore::provideVibrationTo):
(WebCore::Vibration::create): Deleted.
* Modules/vibration/Vibration.h:
* dom/DeviceMotionController.cpp:
(WebCore::provideDeviceMotionTo):
(WebCore::DeviceMotionController::create): Deleted.
* dom/DeviceMotionController.h:
* dom/DeviceOrientationController.cpp:
(WebCore::provideDeviceOrientationTo):
(WebCore::DeviceOrientationController::create): Deleted.
* dom/DeviceOrientationController.h:
* page/SpeechInput.cpp:
(WebCore::provideSpeechInputTo):
(WebCore::SpeechInput::create): Deleted.
* page/SpeechInput.h:
* platform/Supplementable.h:
(WebCore::Supplement::provideTo):
(WebCore::Supplementable::provideSupplement):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::from):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168144 268f45cc-cd09-0410-ab3c-d52691b4dbfc

48 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/battery/BatteryController.cpp
Source/WebCore/Modules/battery/BatteryController.h
Source/WebCore/Modules/battery/NavigatorBattery.cpp
Source/WebCore/Modules/battery/NavigatorBattery.h
Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp
Source/WebCore/Modules/gamepad/NavigatorGamepad.h
Source/WebCore/Modules/geolocation/GeolocationController.cpp
Source/WebCore/Modules/geolocation/GeolocationController.h
Source/WebCore/Modules/geolocation/NavigatorGeolocation.cpp
Source/WebCore/Modules/geolocation/NavigatorGeolocation.h
Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp
Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h
Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.cpp
Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.h
Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp
Source/WebCore/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h
Source/WebCore/Modules/mediastream/UserMediaController.cpp
Source/WebCore/Modules/mediastream/UserMediaController.h
Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.cpp
Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.h
Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp
Source/WebCore/Modules/notifications/DOMWindowNotifications.h
Source/WebCore/Modules/notifications/NotificationController.cpp
Source/WebCore/Modules/notifications/NotificationController.h
Source/WebCore/Modules/notifications/WorkerGlobalScopeNotifications.cpp
Source/WebCore/Modules/notifications/WorkerGlobalScopeNotifications.h
Source/WebCore/Modules/proximity/DeviceProximityController.cpp
Source/WebCore/Modules/proximity/DeviceProximityController.h
Source/WebCore/Modules/quota/DOMWindowQuota.cpp
Source/WebCore/Modules/quota/DOMWindowQuota.h
Source/WebCore/Modules/quota/NavigatorStorageQuota.cpp
Source/WebCore/Modules/quota/NavigatorStorageQuota.h
Source/WebCore/Modules/quota/WorkerNavigatorStorageQuota.cpp
Source/WebCore/Modules/quota/WorkerNavigatorStorageQuota.h
Source/WebCore/Modules/speech/DOMWindowSpeechSynthesis.cpp
Source/WebCore/Modules/speech/DOMWindowSpeechSynthesis.h
Source/WebCore/Modules/speech/SpeechRecognitionController.cpp
Source/WebCore/Modules/vibration/Vibration.cpp
Source/WebCore/Modules/vibration/Vibration.h
Source/WebCore/dom/DeviceMotionController.cpp
Source/WebCore/dom/DeviceMotionController.h
Source/WebCore/dom/DeviceOrientationController.cpp
Source/WebCore/dom/DeviceOrientationController.h
Source/WebCore/page/SpeechInput.cpp
Source/WebCore/page/SpeechInput.h
Source/WebCore/platform/Supplementable.h
Source/WebCore/testing/InternalSettings.cpp

index 7230a0b..6323b62 100644 (file)
@@ -1,3 +1,83 @@
+2014-05-01  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Convert OwnPtr and PassOwnPtr uses to std::unique_ptr in Supplement
+        https://bugs.webkit.org/show_bug.cgi?id=132165
+
+        Reviewed by Darin Adler.
+
+        According to convert from PassOwnPtr to std::unique_ptr, provideTo() callers also begin
+        to use std::make_unique.
+
+        * Modules/battery/BatteryController.cpp:
+        (WebCore::provideBatteryTo):
+        * Modules/battery/BatteryController.h:
+        * Modules/battery/NavigatorBattery.cpp:
+        (WebCore::NavigatorBattery::from):
+        * Modules/gamepad/NavigatorGamepad.cpp:
+        (WebCore::NavigatorGamepad::from):
+        * Modules/geolocation/GeolocationController.cpp:
+        (WebCore::provideGeolocationTo):
+        * Modules/geolocation/GeolocationController.h:
+        * Modules/geolocation/NavigatorGeolocation.cpp:
+        (WebCore::NavigatorGeolocation::from):
+        * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
+        (WebCore::DOMWindowIndexedDatabase::from):
+        * Modules/indexeddb/PageGroupIndexedDatabase.cpp:
+        (WebCore::PageGroupIndexedDatabase::from):
+        * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp:
+        (WebCore::WorkerGlobalScopeIndexedDatabase::from):
+        * Modules/mediastream/UserMediaController.cpp:
+        (WebCore::provideUserMediaTo):
+        (WebCore::UserMediaController::create): Deleted.
+        * Modules/mediastream/UserMediaController.h:
+        * Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
+        (WebCore::provideNavigatorContentUtilsTo):
+        (WebCore::NavigatorContentUtils::create): Deleted.
+        * Modules/navigatorcontentutils/NavigatorContentUtils.h:
+        * Modules/notifications/DOMWindowNotifications.cpp:
+        (WebCore::DOMWindowNotifications::from):
+        * Modules/notifications/NotificationController.cpp:
+        (WebCore::provideNotification):
+        (WebCore::NotificationController::create): Deleted.
+        * Modules/notifications/NotificationController.h:
+        * Modules/notifications/WorkerGlobalScopeNotifications.cpp:
+        (WebCore::WorkerGlobalScopeNotifications::from):
+        * Modules/proximity/DeviceProximityController.cpp:
+        (WebCore::provideDeviceProximityTo):
+        (WebCore::DeviceProximityController::create): Deleted.
+        * Modules/proximity/DeviceProximityController.h:
+        * Modules/quota/DOMWindowQuota.cpp:
+        (WebCore::DOMWindowQuota::from):
+        * Modules/quota/NavigatorStorageQuota.cpp:
+        (WebCore::NavigatorStorageQuota::from):
+        * Modules/quota/WorkerNavigatorStorageQuota.cpp:
+        (WebCore::WorkerNavigatorStorageQuota::from):
+        * Modules/speech/DOMWindowSpeechSynthesis.cpp:
+        (WebCore::DOMWindowSpeechSynthesis::from):
+        * Modules/speech/SpeechRecognitionController.cpp:
+        (WebCore::provideSpeechRecognitionTo):
+        * Modules/vibration/Vibration.cpp:
+        (WebCore::provideVibrationTo):
+        (WebCore::Vibration::create): Deleted.
+        * Modules/vibration/Vibration.h:
+        * dom/DeviceMotionController.cpp:
+        (WebCore::provideDeviceMotionTo):
+        (WebCore::DeviceMotionController::create): Deleted.
+        * dom/DeviceMotionController.h:
+        * dom/DeviceOrientationController.cpp:
+        (WebCore::provideDeviceOrientationTo):
+        (WebCore::DeviceOrientationController::create): Deleted.
+        * dom/DeviceOrientationController.h:
+        * page/SpeechInput.cpp:
+        (WebCore::provideSpeechInputTo):
+        (WebCore::SpeechInput::create): Deleted.
+        * page/SpeechInput.h:
+        * platform/Supplementable.h:
+        (WebCore::Supplement::provideTo):
+        (WebCore::Supplementable::provideSupplement):
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::from):
+
 2014-05-01  Andreas Kling  <akling@apple.com>
 
         HTMLMediaElement: Remove two unnecessary virtual overrides.
index 5f6c8a5..ad78885 100644 (file)
@@ -42,11 +42,6 @@ BatteryController::~BatteryController()
     m_client->batteryControllerDestroyed();
 }
 
-PassOwnPtr<BatteryController> BatteryController::create(BatteryClient* client)
-{
-    return adoptPtr(new BatteryController(client));
-}
-
 void BatteryController::addListener(BatteryManager* batteryManager)
 {
     m_listeners.append(batteryManager);
@@ -102,7 +97,7 @@ const char* BatteryController::supplementName()
 
 void provideBatteryTo(Page* page, BatteryClient* client)
 {
-    Supplement<Page>::provideTo(page, BatteryController::supplementName(), BatteryController::create(client));
+    Supplement<Page>::provideTo(page, BatteryController::supplementName(), std::make_unique<BatteryController>(client));
 }
 
 }
index 7911a03..d0be94a 100644 (file)
@@ -32,10 +32,9 @@ class BatteryClient;
 
 class BatteryController : public Supplement<Page> {
 public:
+    explicit BatteryController(BatteryClient*);
     ~BatteryController();
 
-    static PassOwnPtr<BatteryController> create(BatteryClient*);
-
     void addListener(BatteryManager*);
     void removeListener(BatteryManager*);
     void updateBatteryStatus(PassRefPtr<BatteryStatus>);
@@ -47,8 +46,6 @@ public:
 private:
     typedef Vector<BatteryManager*> ListenerVector;
 
-    explicit BatteryController(BatteryClient*);
-
     BatteryClient* m_client;
     ListenerVector m_listeners;
 
index 11524ef..739d404 100644 (file)
@@ -56,8 +56,9 @@ NavigatorBattery* NavigatorBattery::from(Navigator* navigator)
 {
     NavigatorBattery* supplement = static_cast<NavigatorBattery*>(Supplement<Navigator>::from(navigator, supplementName()));
     if (!supplement) {
-        supplement = new NavigatorBattery();
-        provideTo(navigator, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<NavigatorBattery>();
+        supplement = newSupplement.get();
+        provideTo(navigator, supplementName(), std::move(newSupplement));
     }
     return supplement;
 }
index a042a80..248785a 100644 (file)
@@ -31,13 +31,13 @@ class Navigator;
 
 class NavigatorBattery : public Supplement<Navigator> {
 public:
+    NavigatorBattery();
     virtual ~NavigatorBattery();
 
     static NavigatorBattery* from(Navigator*);
     static BatteryManager* webkitBattery(Navigator*);
 
  private:
-    NavigatorBattery();
     static const char* supplementName();
 
     RefPtr<BatteryManager> m_batteryManager;
index 2079e78..4a5e30c 100644 (file)
@@ -52,8 +52,9 @@ NavigatorGamepad* NavigatorGamepad::from(Navigator* navigator)
 {
     NavigatorGamepad* supplement = static_cast<NavigatorGamepad*>(Supplement<Navigator>::from(navigator, supplementName()));
     if (!supplement) {
-        supplement = new NavigatorGamepad();
-        provideTo(navigator, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<NavigatorGamepad>();
+        supplement = newSupplement.get();
+        provideTo(navigator, supplementName(), std::move(newSupplement));
     }
     return supplement;
 }
index 3ee8ba9..65cfc3b 100644 (file)
@@ -37,7 +37,9 @@ class Navigator;
 
 class NavigatorGamepad : public Supplement<Navigator> {
 public:
+    NavigatorGamepad();
     virtual ~NavigatorGamepad();
+
     static NavigatorGamepad* from(Navigator*);
 
     static GamepadList* webkitGetGamepads(Navigator*);
@@ -45,7 +47,6 @@ public:
     GamepadList* gamepads();
 
 private:
-    NavigatorGamepad();
     static const char* supplementName();
 
     RefPtr<GamepadList> m_gamepads;
index 9571729..974ce94 100644 (file)
@@ -132,7 +132,7 @@ const char* GeolocationController::supplementName()
 
 void provideGeolocationTo(Page* page, GeolocationClient* client)
 {
-    Supplement<Page>::provideTo(page, GeolocationController::supplementName(), GeolocationController::create(client));
+    Supplement<Page>::provideTo(page, GeolocationController::supplementName(), std::make_unique<GeolocationController>(client));
 }
     
 } // namespace WebCore
index 9192c60..58be3b4 100644 (file)
@@ -44,6 +44,7 @@ class Page;
 class GeolocationController : public Supplement<Page> {
     WTF_MAKE_NONCOPYABLE(GeolocationController);
 public:
+    explicit GeolocationController(GeolocationClient*);
     ~GeolocationController();
 
     static PassOwnPtr<GeolocationController> create(GeolocationClient*);
@@ -65,8 +66,6 @@ public:
     static GeolocationController* from(Page* page) { return static_cast<GeolocationController*>(Supplement<Page>::from(page, supplementName())); }
 
 private:
-    GeolocationController(GeolocationClient*);
-
     GeolocationClient* m_client;
 
     RefPtr<GeolocationPosition> m_lastPosition;
index 340e658..65f4fc5 100644 (file)
@@ -51,8 +51,9 @@ NavigatorGeolocation* NavigatorGeolocation::from(Navigator* navigator)
 {
     NavigatorGeolocation* supplement = static_cast<NavigatorGeolocation*>(Supplement<Navigator>::from(navigator, supplementName()));
     if (!supplement) {
-        supplement = new NavigatorGeolocation(navigator->frame());
-        provideTo(navigator, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<NavigatorGeolocation>(navigator->frame());
+        supplement = newSupplement.get();
+        provideTo(navigator, supplementName(), std::move(newSupplement));
     }
     return supplement;
 }
index c5f6540..0e9f2ff 100644 (file)
@@ -33,6 +33,7 @@ class Navigator;
 
 class NavigatorGeolocation : public Supplement<Navigator>, public DOMWindowProperty {
 public:
+    explicit NavigatorGeolocation(Frame*);
     virtual ~NavigatorGeolocation();
     static NavigatorGeolocation* from(Navigator*);
 
@@ -44,7 +45,6 @@ public:
 #endif // PLATFORM(IOS)
 
 private:
-    NavigatorGeolocation(Frame*);
     static const char* supplementName();
 
     mutable RefPtr<Geolocation> m_geolocation;
index 75e7a66..e705a2d 100644 (file)
@@ -56,8 +56,9 @@ DOMWindowIndexedDatabase* DOMWindowIndexedDatabase::from(DOMWindow* window)
 {
     DOMWindowIndexedDatabase* supplement = static_cast<DOMWindowIndexedDatabase*>(Supplement<DOMWindow>::from(window, supplementName()));
     if (!supplement) {
-        supplement = new DOMWindowIndexedDatabase(window);
-        provideTo(window, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<DOMWindowIndexedDatabase>(window);
+        supplement = newSupplement.get();
+        provideTo(window, supplementName(), std::move(newSupplement));
     }
     return supplement;
 }
index 1d14b07..c93ce3e 100644 (file)
@@ -38,7 +38,9 @@ class DOMWindow;
 
 class DOMWindowIndexedDatabase : public DOMWindowProperty, public Supplement<DOMWindow> {
 public:
+    explicit DOMWindowIndexedDatabase(DOMWindow*);
     virtual ~DOMWindowIndexedDatabase();
+
     static DOMWindowIndexedDatabase* from(DOMWindow*);
 
     static IDBFactory* indexedDB(DOMWindow*);
@@ -50,8 +52,6 @@ public:
     virtual void willDetachGlobalObjectFromFrame() override;
 
 private:
-    explicit DOMWindowIndexedDatabase(DOMWindow*);
-
     IDBFactory* indexedDB();
     static const char* supplementName();
 
index a7cbcd7..189ca9e 100644 (file)
@@ -52,8 +52,9 @@ PageGroupIndexedDatabase* PageGroupIndexedDatabase::from(PageGroup& group)
 {
     PageGroupIndexedDatabase* supplement = static_cast<PageGroupIndexedDatabase*>(Supplement<PageGroup>::from(&group, supplementName()));
     if (!supplement) {
-        supplement = new PageGroupIndexedDatabase(group.groupSettings().indexedDBDatabasePath());
-        provideTo(&group, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<PageGroupIndexedDatabase>(group.groupSettings().indexedDBDatabasePath());
+        supplement = newSupplement.get();
+        provideTo(&group, supplementName(), std::move(newSupplement));
     }
     return supplement;
 }
index 92a2558..96df923 100644 (file)
@@ -38,13 +38,14 @@ class PageGroup;
 
 class PageGroupIndexedDatabase : public Supplement<PageGroup> {
 public:
+    explicit PageGroupIndexedDatabase(const String& databaseDirectoryIdentifier);
     virtual ~PageGroupIndexedDatabase();
+
     static PageGroupIndexedDatabase* from(PageGroup&);
 
     IDBFactoryBackendInterface* factoryBackend();
 
 private:
-    explicit PageGroupIndexedDatabase(const String& databaseDirectoryIdentifier);
     static const char* supplementName();
 
     String m_databaseDirectoryIdentifier;
index 39507d7..05ee8d6 100644 (file)
@@ -61,8 +61,9 @@ WorkerGlobalScopeIndexedDatabase* WorkerGlobalScopeIndexedDatabase::from(ScriptE
         if (groupSettings)
             databaseDirectoryIdentifier = groupSettings->indexedDBDatabasePath();
 
-        supplement = new WorkerGlobalScopeIndexedDatabase(databaseDirectoryIdentifier);
-        provideTo(context, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<WorkerGlobalScopeIndexedDatabase>(databaseDirectoryIdentifier);
+        supplement = newSupplement.get();
+        provideTo(context, supplementName(), std::move(newSupplement));
     }
     return supplement;
 }
index 970e6f3..de5bea4 100644 (file)
@@ -40,14 +40,13 @@ class ScriptExecutionContext;
 
 class WorkerGlobalScopeIndexedDatabase : public Supplement<ScriptExecutionContext> {
 public:
+    explicit WorkerGlobalScopeIndexedDatabase(const String& databaseDirectoryIdentifier);
     virtual ~WorkerGlobalScopeIndexedDatabase();
     static WorkerGlobalScopeIndexedDatabase* from(ScriptExecutionContext*);
 
     static IDBFactory* indexedDB(ScriptExecutionContext*);
 
 private:
-    explicit WorkerGlobalScopeIndexedDatabase(const String& databaseDirectoryIdentifier);
-
     IDBFactory* indexedDB();
     static const char* supplementName();
 
index 72296b3..d60856f 100644 (file)
@@ -44,15 +44,10 @@ UserMediaController::~UserMediaController()
     m_client->pageDestroyed();
 }
 
-PassOwnPtr<UserMediaController> UserMediaController::create(UserMediaClient* client)
-{
-    return adoptPtr(new UserMediaController(client));
-}
-
 void provideUserMediaTo(Page* page, UserMediaClient* client)
 {
     if (!Supplement<Page>::from(page, UserMediaController::supplementName()))
-        UserMediaController::provideTo(page, UserMediaController::supplementName(), UserMediaController::create(client));
+        UserMediaController::provideTo(page, UserMediaController::supplementName(), std::make_unique<UserMediaController>(client));
 }
 
 } // namespace WebCore
index 4d15c98..d184b32 100644 (file)
@@ -36,19 +36,16 @@ namespace WebCore {
 
 class UserMediaController : public Supplement<Page> {
 public:
+    explicit UserMediaController(UserMediaClient*);
     ~UserMediaController();
 
     UserMediaClient* client() const { return m_client; }
     void requestPermission(PassRefPtr<UserMediaRequest>);
     void cancelRequest(UserMediaRequest*);
 
-    static PassOwnPtr<UserMediaController> create(UserMediaClient*);
     static const char* supplementName();
     static UserMediaController* from(Page* page) { return static_cast<UserMediaController*>(Supplement<Page>::from(page, supplementName())); }
 
-protected:
-    explicit UserMediaController(UserMediaClient*);
-
 private:
     UserMediaClient* m_client;
 };
index 9b0627a..dd1d205 100644 (file)
@@ -126,11 +126,6 @@ NavigatorContentUtils::~NavigatorContentUtils()
 {
 }
 
-PassOwnPtr<NavigatorContentUtils> NavigatorContentUtils::create(std::unique_ptr<NavigatorContentUtilsClient> client)
-{
-    return adoptPtr(new NavigatorContentUtils(std::move(client)));
-}
-
 void NavigatorContentUtils::registerProtocolHandler(Navigator* navigator, const String& scheme, const String& url, const String& title, ExceptionCode& ec)
 {
     if (!navigator->frame())
@@ -209,7 +204,7 @@ const char* NavigatorContentUtils::supplementName()
 
 void provideNavigatorContentUtilsTo(Page* page, std::unique_ptr<NavigatorContentUtilsClient> client)
 {
-    NavigatorContentUtils::provideTo(page, NavigatorContentUtils::supplementName(), NavigatorContentUtils::create(std::move(client)));
+    NavigatorContentUtils::provideTo(page, NavigatorContentUtils::supplementName(), std::make_unique<NavigatorContentUtils>(std::move(client)));
 }
 
 } // namespace WebCore
index 5a4029c..e8dd864 100644 (file)
@@ -43,6 +43,10 @@ typedef int ExceptionCode;
 
 class NavigatorContentUtils final : public Supplement<Page> {
 public:
+    explicit NavigatorContentUtils(std::unique_ptr<NavigatorContentUtilsClient> client)
+        : m_client(std::move(client))
+    { }
+
     virtual ~NavigatorContentUtils();
 
     static const char* supplementName();
@@ -55,13 +59,7 @@ public:
     static void unregisterProtocolHandler(Navigator*, const String& scheme, const String& url, ExceptionCode&);
 #endif
 
-    static PassOwnPtr<NavigatorContentUtils> create(std::unique_ptr<NavigatorContentUtilsClient>);
-
 private:
-    explicit NavigatorContentUtils(std::unique_ptr<NavigatorContentUtilsClient> client)
-        : m_client(std::move(client))
-    { }
-
     NavigatorContentUtilsClient* client() { return m_client.get(); }
 
     std::unique_ptr<NavigatorContentUtilsClient> m_client;
index 775d7da..0a89d06 100644 (file)
@@ -56,8 +56,9 @@ DOMWindowNotifications* DOMWindowNotifications::from(DOMWindow* window)
 {
     DOMWindowNotifications* supplement = static_cast<DOMWindowNotifications*>(Supplement<DOMWindow>::from(window, supplementName()));
     if (!supplement) {
-        supplement = new DOMWindowNotifications(window);
-        Supplement<DOMWindow>::provideTo(window, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<DOMWindowNotifications>(window);
+        supplement = newSupplement.get();
+        provideTo(window, supplementName(), std::move(newSupplement));
     }
     return supplement;
 }
index b2927ac..7e99728 100644 (file)
@@ -40,6 +40,7 @@ class NotificationCenter;
 
 class DOMWindowNotifications : public Supplement<DOMWindow>, public DOMWindowProperty {
 public:
+    explicit DOMWindowNotifications(DOMWindow*);
     virtual ~DOMWindowNotifications();
 
     static NotificationCenter* webkitNotifications(DOMWindow*);
@@ -52,8 +53,6 @@ public:
     virtual void willDetachGlobalObjectFromFrame() override;
 
 private:
-    explicit DOMWindowNotifications(DOMWindow*);
-
     NotificationCenter* webkitNotifications();
     static const char* supplementName();
 
index d20b81d..fe5a0ad 100644 (file)
@@ -44,11 +44,6 @@ NotificationController::~NotificationController()
         m_client->notificationControllerDestroyed();
 }
 
-PassOwnPtr<NotificationController> NotificationController::create(NotificationClient* client)
-{
-    return adoptPtr(new NotificationController(client));
-}
-
 NotificationClient* NotificationController::clientFrom(Page* page)
 {
     if (NotificationController* controller = NotificationController::from(page))
@@ -63,7 +58,7 @@ const char* NotificationController::supplementName()
 
 void provideNotification(Page* page, NotificationClient* client)
 {
-    NotificationController::provideTo(page, NotificationController::supplementName(), NotificationController::create(client));
+    NotificationController::provideTo(page, NotificationController::supplementName(), std::make_unique<NotificationController>(client));
 }
 
 } // namespace WebCore
index ba48116..58f4f96 100644 (file)
@@ -39,9 +39,9 @@ class NotificationClient;
 class NotificationController : public Supplement<Page> {
     WTF_MAKE_NONCOPYABLE(NotificationController);
 public:
+    explicit NotificationController(NotificationClient*);
     ~NotificationController();
 
-    static PassOwnPtr<NotificationController> create(NotificationClient*);
     static const char* supplementName();
     static NotificationController* from(Page* page) { return static_cast<NotificationController*>(Supplement<Page>::from(page, supplementName())); }
     static NotificationClient* clientFrom(Page*);
@@ -49,8 +49,6 @@ public:
     NotificationClient* client() { return m_client; }
     
 private:
-    explicit NotificationController(NotificationClient*);
-
     NotificationClient* m_client;
 };
 
index 469f62c..a8cd0e4 100644 (file)
@@ -54,8 +54,9 @@ WorkerGlobalScopeNotifications* WorkerGlobalScopeNotifications::from(WorkerGloba
 {
     WorkerGlobalScopeNotifications* supplement = static_cast<WorkerGlobalScopeNotifications*>(Supplement<ScriptExecutionContext>::from(context, supplementName()));
     if (!supplement) {
-        supplement = new WorkerGlobalScopeNotifications(context);
-        Supplement<ScriptExecutionContext>::provideTo(context, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<WorkerGlobalScopeNotifications>(context);
+        supplement = newSupplement.get();
+        provideTo(context, supplementName(), std::move(newSupplement));
     }
     return supplement;
 }
index 866515f..7da529b 100644 (file)
@@ -39,14 +39,13 @@ class WorkerGlobalScope;
 
 class WorkerGlobalScopeNotifications : public Supplement<ScriptExecutionContext> {
 public:
+    explicit WorkerGlobalScopeNotifications(WorkerGlobalScope*);
     virtual ~WorkerGlobalScopeNotifications();
 
     static NotificationCenter* webkitNotifications(WorkerGlobalScope*);
     static WorkerGlobalScopeNotifications* from(WorkerGlobalScope*);
 
 private:
-    explicit WorkerGlobalScopeNotifications(WorkerGlobalScope*);
-
     NotificationCenter* webkitNotifications();
     static const char* supplementName();
 
index a64d47a..6078f37 100644 (file)
@@ -40,11 +40,6 @@ DeviceProximityController::DeviceProximityController(DeviceProximityClient* clie
     ASSERT(m_client);
 }
 
-PassOwnPtr<DeviceProximityController> DeviceProximityController::create(DeviceProximityClient* client)
-{
-    return adoptPtr(new DeviceProximityController(client));
-}
-
 void DeviceProximityController::didChangeDeviceProximity(const double value, const double min, const double max)
 {
     ASSERT(value >= min && value <= max);
@@ -86,7 +81,7 @@ bool DeviceProximityController::isActiveAt(Page* page)
 
 void provideDeviceProximityTo(Page* page, DeviceProximityClient* client)
 {
-    DeviceProximityController::provideTo(page, DeviceProximityController::supplementName(), DeviceProximityController::create(client));
+    DeviceProximityController::provideTo(page, DeviceProximityController::supplementName(), std::make_unique<DeviceProximityController>(client));
 }
 
 } // namespace WebCore
index 9fd6ffb..40ddfb7 100644 (file)
@@ -36,10 +36,9 @@ class DeviceProximityClient;
 
 class DeviceProximityController : public DeviceController {
 public:
+    explicit DeviceProximityController(DeviceProximityClient*);
     ~DeviceProximityController() { }
 
-    static PassOwnPtr<DeviceProximityController> create(DeviceProximityClient*);
-
     void didChangeDeviceProximity(const double value, const double min, const double max);
     DeviceProximityClient* deviceProximityClient();
 
@@ -49,9 +48,6 @@ public:
     static const char* supplementName();
     static DeviceProximityController* from(Page*);
     static bool isActiveAt(Page*);
-
-private:
-    explicit DeviceProximityController(DeviceProximityClient*);
 };
 
 } // namespace WebCore
index 2270a04..286c312 100644 (file)
@@ -60,8 +60,9 @@ DOMWindowQuota* DOMWindowQuota::from(DOMWindow* window)
 {
     DOMWindowQuota* supplement = static_cast<DOMWindowQuota*>(Supplement<DOMWindow>::from(window, supplementName()));
     if (!supplement) {
-        supplement = new DOMWindowQuota(window);
-        provideTo(window, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<DOMWindowQuota>(window);
+        supplement = newSupplement.get();
+        provideTo(window, supplementName(), std::move(newSupplement));
     }
     return supplement;
 }
index ccd434a..2fd01be 100644 (file)
@@ -43,13 +43,13 @@ class StorageInfo;
 
 class DOMWindowQuota : public Supplement<DOMWindow>, public DOMWindowProperty {
 public:
+    explicit DOMWindowQuota(DOMWindow*);
     virtual ~DOMWindowQuota();
     static DOMWindowQuota* from(DOMWindow*);
     static StorageInfo* webkitStorageInfo(DOMWindow*);
     StorageInfo* webkitStorageInfo() const;
 
 private:
-    explicit DOMWindowQuota(DOMWindow*);
     static const char* supplementName();
 
     mutable RefPtr<StorageInfo> m_storageInfo;
index 2e09502..f7b53bd 100644 (file)
@@ -57,8 +57,9 @@ NavigatorStorageQuota* NavigatorStorageQuota::from(Navigator* navigator)
 {
     NavigatorStorageQuota* supplement = static_cast<NavigatorStorageQuota*>(Supplement<Navigator>::from(navigator, supplementName()));
     if (!supplement) {
-        supplement = new NavigatorStorageQuota(navigator->frame());
-        provideTo(navigator, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<NavigatorStorageQuota>(window);
+        supplement = newSupplement.get();
+        provideTo(navigator, supplementName(), std::move(newSupplement));
     }
     return supplement;
 }
index 9c1d9ef..7040a7e 100644 (file)
@@ -44,6 +44,7 @@ class Navigator;
 
 class NavigatorStorageQuota : public Supplement<Navigator>, public DOMWindowProperty {
 public:
+    explicit NavigatorStorageQuota(Frame*);
     virtual ~NavigatorStorageQuota();
     static NavigatorStorageQuota* from(Navigator*);
 
@@ -53,7 +54,6 @@ public:
     StorageQuota* webkitPersistentStorage() const;
 
 private:
-    explicit NavigatorStorageQuota(Frame*);
     static const char* supplementName();
 
     mutable RefPtr<StorageQuota> m_temporaryStorage;
index 90d135b..68474ae 100644 (file)
@@ -55,8 +55,9 @@ WorkerNavigatorStorageQuota* WorkerNavigatorStorageQuota::from(WorkerNavigator*
 {
     WorkerNavigatorStorageQuota* supplement = static_cast<WorkerNavigatorStorageQuota*>(Supplement<WorkerNavigator>::from(navigator, supplementName()));
     if (!supplement) {
-        supplement = new WorkerNavigatorStorageQuota();
-        provideTo(navigator, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<WorkerNavigatorStorageQuota>(window);
+        supplement = newSupplement.get();
+        provideTo(navigator, supplementName(), std::move(newSupplement));
     }
     return supplement;
 }
index a7699f6..bea10b9 100644 (file)
@@ -44,6 +44,7 @@ class WorkerNavigator;
 
 class WorkerNavigatorStorageQuota : public Supplement<WorkerNavigator> {
 public:
+    explicit WorkerNavigatorStorageQuota();
     virtual ~WorkerNavigatorStorageQuota();
     static WorkerNavigatorStorageQuota* from(WorkerNavigator*);
 
@@ -53,7 +54,6 @@ public:
     StorageQuota* webkitPersistentStorage() const;
 
 private:
-    explicit WorkerNavigatorStorageQuota();
     static const char* supplementName();
 
     mutable RefPtr<StorageQuota> m_temporaryStorage;
index ccc9593..ad247a5 100644 (file)
@@ -57,8 +57,9 @@ DOMWindowSpeechSynthesis* DOMWindowSpeechSynthesis::from(DOMWindow* window)
 {
     DOMWindowSpeechSynthesis* supplement = static_cast<DOMWindowSpeechSynthesis*>(Supplement<DOMWindow>::from(window, supplementName()));
     if (!supplement) {
-        supplement = new DOMWindowSpeechSynthesis(window);
-        provideTo(window, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<DOMWindowSpeechSynthesis>(window);
+        supplement = newSupplement.get();
+        provideTo(window, supplementName(), std::move(newSupplement));
     }
     return supplement;
 }
index d18d485..7014cd6 100644 (file)
@@ -38,14 +38,13 @@ class DOMWindow;
 
 class DOMWindowSpeechSynthesis : public Supplement<DOMWindow>, public DOMWindowProperty {
 public:
+    explicit DOMWindowSpeechSynthesis(DOMWindow*);
     virtual ~DOMWindowSpeechSynthesis();
     
     static SpeechSynthesis* speechSynthesis(DOMWindow*);
     static DOMWindowSpeechSynthesis* from(DOMWindow*);
     
 private:
-    explicit DOMWindowSpeechSynthesis(DOMWindow*);
-    
     SpeechSynthesis* speechSynthesis();
     static const char* supplementName();
     
index 1d53b20..83be4ed 100644 (file)
@@ -47,7 +47,7 @@ SpeechRecognitionController::~SpeechRecognitionController()
 
 void provideSpeechRecognitionTo(Page* page, SpeechRecognitionClient* client)
 {
-    SpeechRecognitionController::provideTo(page, SpeechRecognitionController::supplementName(), SpeechRecognitionController::create(client));
+    SpeechRecognitionController::provideTo(page, SpeechRecognitionController::supplementName(), std::make_unique<SpeechRecognitionController>(client));
 }
 
 } // namespace WebCore
index d68c80d..e09cb30 100644 (file)
@@ -43,11 +43,6 @@ Vibration::~Vibration()
     m_vibrationClient->vibrationDestroyed();
 }
 
-PassOwnPtr<Vibration> Vibration::create(VibrationClient* client)
-{
-    return adoptPtr(new Vibration(client));
-}
-
 bool Vibration::vibrate(const VibrationPattern& pattern)
 {
     VibrationPattern& sanitized = const_cast<VibrationPattern&>(pattern);
@@ -128,7 +123,7 @@ const char* Vibration::supplementName()
 
 void provideVibrationTo(Page* page, VibrationClient* client)
 {
-    Vibration::provideTo(page, Vibration::supplementName(), Vibration::create(client));
+    Vibration::provideTo(page, Vibration::supplementName(), std::make_unique<Vibration>(client));
 }
 
 } // namespace WebCore
index eef52ff..d5f1fa9 100644 (file)
@@ -37,8 +37,6 @@ public:
     explicit Vibration(VibrationClient*);
     ~Vibration();
 
-    static PassOwnPtr<Vibration> create(VibrationClient*);
-
     bool vibrate(const VibrationPattern&);
     // FIXME: When a visibilitychange event is dispatched while vibrating, the vibration should be canceled.
     void cancelVibration();
index 89eb002..1151bd1 100644 (file)
@@ -41,11 +41,6 @@ DeviceMotionController::DeviceMotionController(DeviceMotionClient* client)
     deviceMotionClient()->setController(this);
 }
 
-PassOwnPtr<DeviceMotionController> DeviceMotionController::create(DeviceMotionClient* client)
-{
-    return adoptPtr(new DeviceMotionController(client));
-}
-
 #if PLATFORM(IOS)
 // FIXME: We should look to reconcile the iOS and OpenSource differences with this class
 // so that we can either remove these methods or remove the PLATFORM(IOS)-guard.
@@ -101,7 +96,7 @@ bool DeviceMotionController::isActiveAt(Page* page)
 
 void provideDeviceMotionTo(Page* page, DeviceMotionClient* client)
 {
-    DeviceMotionController::provideTo(page, DeviceMotionController::supplementName(), DeviceMotionController::create(client));
+    DeviceMotionController::provideTo(page, DeviceMotionController::supplementName(), std::make_unique<DeviceMotionController>(client));
 }
 
 } // namespace WebCore
index deb0620..ed2c57f 100644 (file)
@@ -38,10 +38,9 @@ class DeviceMotionData;
 class DeviceMotionController : public DeviceController {
     WTF_MAKE_NONCOPYABLE(DeviceMotionController);
 public:
+    explicit DeviceMotionController(DeviceMotionClient*);
     ~DeviceMotionController() { };
 
-    static PassOwnPtr<DeviceMotionController> create(DeviceMotionClient*);
-
 #if PLATFORM(IOS)
     // FIXME: We should look to reconcile the iOS and OpenSource differences with this class
     // so that we can either remove these methods or remove the PLATFORM(IOS)-guard.
@@ -58,9 +57,6 @@ public:
     static const char* supplementName();
     static DeviceMotionController* from(Page*);
     static bool isActiveAt(Page*);
-
-private:
-    explicit DeviceMotionController(DeviceMotionClient*);
 };
 
 } // namespace WebCore
index 5ce7c5d..ace3b2b 100644 (file)
@@ -49,11 +49,6 @@ DeviceOrientationController::DeviceOrientationController(DeviceOrientationClient
 #endif
 }
 
-PassOwnPtr<DeviceOrientationController> DeviceOrientationController::create(DeviceOrientationClient* client)
-{
-    return adoptPtr(new DeviceOrientationController(client));
-}
-
 void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientationData* orientation)
 {
     dispatchDeviceEvent(DeviceOrientationEvent::create(eventNames().deviceorientationEvent, orientation));
@@ -109,7 +104,7 @@ bool DeviceOrientationController::isActiveAt(Page* page)
 
 void provideDeviceOrientationTo(Page* page, DeviceOrientationClient* client)
 {
-    DeviceOrientationController::provideTo(page, DeviceOrientationController::supplementName(), DeviceOrientationController::create(client));
+    DeviceOrientationController::provideTo(page, DeviceOrientationController::supplementName(), std::make_unique<DeviceOrientationController>(client));
 }
 
 } // namespace WebCore
index 56bae2d..09fc0dd 100644 (file)
@@ -40,10 +40,9 @@ class Page;
 class DeviceOrientationController : public DeviceController {
     WTF_MAKE_NONCOPYABLE(DeviceOrientationController);
 public:
+    explicit DeviceOrientationController(DeviceOrientationClient*);
     ~DeviceOrientationController() { };
 
-    static PassOwnPtr<DeviceOrientationController> create(DeviceOrientationClient*);
-
     void didChangeDeviceOrientation(DeviceOrientationData*);
     DeviceOrientationClient* deviceOrientationClient();
 
@@ -60,9 +59,6 @@ public:
     static const char* supplementName();
     static DeviceOrientationController* from(Page*);
     static bool isActiveAt(Page*);
-
-private:
-    DeviceOrientationController(DeviceOrientationClient*);
 };
 
 } // namespace WebCore
index 228d3fc..a88ef99 100644 (file)
@@ -52,11 +52,6 @@ SpeechInput::~SpeechInput()
     m_client->setListener(0);
 }
 
-PassOwnPtr<SpeechInput> SpeechInput::create(SpeechInputClient* client)
-{
-    return adoptPtr(new SpeechInput(client));
-}
-
 int SpeechInput::registerListener(SpeechInputListener* listener)
 {
 #if defined(DEBUG)
@@ -124,7 +119,7 @@ const char* SpeechInput::supplementName()
 
 void provideSpeechInputTo(Page* page, SpeechInputClient* client)
 {
-    SpeechInput::provideTo(page, SpeechInput::supplementName(), SpeechInput::create(client));
+    SpeechInput::provideTo(page, SpeechInput::supplementName(), std::make_unique<SpeechInput>(client));
 }
 
 } // namespace WebCore
index 447f632..57daf41 100644 (file)
@@ -52,9 +52,9 @@ class SpeechInput : public SpeechInputListener,
                     public Supplement<Page> {
     WTF_MAKE_NONCOPYABLE(SpeechInput);
 public:
+    explicit SpeechInput(SpeechInputClient*);
     virtual ~SpeechInput();
 
-    static PassOwnPtr<SpeechInput> create(SpeechInputClient*);
     static const char* supplementName();
     static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(Supplement<Page>::from(page, supplementName())); }
 
@@ -77,8 +77,6 @@ public:
     virtual void setRecognitionResult(int, const SpeechInputResultArray&);
 
 private:
-    explicit SpeechInput(SpeechInputClient*);
-
     SpeechInputClient* m_client;
     HashMap<int, SpeechInputListener*> m_listeners;
     int m_nextListenerId;
index c202f2c..67ddf2f 100644 (file)
@@ -84,9 +84,9 @@ public:
     virtual bool isRefCountedWrapper() const { return false; }
 #endif
 
-    static void provideTo(Supplementable<T>* host, const char* key, PassOwnPtr<Supplement<T>> supplement)
+    static void provideTo(Supplementable<T>* host, const char* key, std::unique_ptr<Supplement<T>> supplement)
     {
-        host->provideSupplement(key, supplement);
+        host->provideSupplement(key, std::move(supplement));
     }
 
     static Supplement<T>* from(Supplementable<T>* host, const char* key)
@@ -98,11 +98,11 @@ public:
 template<typename T>
 class Supplementable {
 public:
-    void provideSupplement(const char* key, PassOwnPtr<Supplement<T>> supplement)
+    void provideSupplement(const char* key, std::unique_ptr<Supplement<T>> supplement)
     {
         ASSERT(canAccessThreadLocalDataForThread(m_threadId));
         ASSERT(!m_supplements.get(key));
-        m_supplements.set(key, supplement);
+        m_supplements.set(key, std::move(supplement));
     }
 
     void removeSupplement(const char* key)
@@ -123,7 +123,7 @@ protected:
 #endif
 
 private:
-    typedef HashMap<const char*, OwnPtr<Supplement<T>>, PtrHash<const char*>> SupplementMap;
+    typedef HashMap<const char*, std::unique_ptr<Supplement<T>>, PtrHash<const char*>> SupplementMap;
     SupplementMap m_supplements;
 #if !ASSERT_DISABLED
     ThreadIdentifier m_threadId;
index 178c885..8554bde 100644 (file)
@@ -176,7 +176,7 @@ const char* InternalSettings::supplementName()
 InternalSettings* InternalSettings::from(Page* page)
 {
     if (!Supplement<Page>::from(page, supplementName()))
-        Supplement<Page>::provideTo(page, supplementName(), adoptPtr(new InternalSettingsWrapper(page)));
+        Supplement<Page>::provideTo(page, supplementName(), std::make_unique<InternalSettingsWrapper>(page));
     return static_cast<InternalSettingsWrapper*>(Supplement<Page>::from(page, supplementName()))->internalSettings();
 }