Title: [190391] trunk/Source/WebCore
Revision
190391
Author
[email protected]
Date
2015-10-01 00:22:50 -0700 (Thu, 01 Oct 2015)

Log Message

Clean up all uses of PassRefPtr in Modules/geolocation
https://bugs.webkit.org/show_bug.cgi?id=149552

Reviewed by Darin Adler.

* Modules/geolocation/GeoNotifier.cpp:
(WebCore::GeoNotifier::GeoNotifier):
(WebCore::GeoNotifier::setFatalError):
* Modules/geolocation/GeoNotifier.h:
(WebCore::GeoNotifier::create):
* Modules/geolocation/Geolocation.cpp:
(WebCore::createGeoposition):
(WebCore::createPositionError):
(WebCore::Geolocation::Watchers::add):
(WebCore::Geolocation::getCurrentPosition):
(WebCore::Geolocation::watchPosition):
(WebCore::Geolocation::startRequest):
* Modules/geolocation/Geolocation.h:
* Modules/geolocation/GeolocationError.h:
* Modules/geolocation/GeolocationPosition.h:
* Modules/geolocation/Geoposition.h:
(WebCore::Geoposition::create):
(WebCore::Geoposition::isolatedCopy):
(WebCore::Geoposition::Geoposition):
* Modules/geolocation/PositionError.h:
* Modules/geolocation/PositionOptions.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (190390 => 190391)


--- trunk/Source/WebCore/ChangeLog	2015-10-01 06:00:26 UTC (rev 190390)
+++ trunk/Source/WebCore/ChangeLog	2015-10-01 07:22:50 UTC (rev 190391)
@@ -1,3 +1,32 @@
+2015-10-01  Gyuyoung Kim  <[email protected]>
+
+        Clean up all uses of PassRefPtr in Modules/geolocation
+        https://bugs.webkit.org/show_bug.cgi?id=149552
+
+        Reviewed by Darin Adler.
+
+        * Modules/geolocation/GeoNotifier.cpp:
+        (WebCore::GeoNotifier::GeoNotifier):
+        (WebCore::GeoNotifier::setFatalError):
+        * Modules/geolocation/GeoNotifier.h:
+        (WebCore::GeoNotifier::create):
+        * Modules/geolocation/Geolocation.cpp:
+        (WebCore::createGeoposition):
+        (WebCore::createPositionError):
+        (WebCore::Geolocation::Watchers::add):
+        (WebCore::Geolocation::getCurrentPosition):
+        (WebCore::Geolocation::watchPosition):
+        (WebCore::Geolocation::startRequest):
+        * Modules/geolocation/Geolocation.h:
+        * Modules/geolocation/GeolocationError.h:
+        * Modules/geolocation/GeolocationPosition.h:
+        * Modules/geolocation/Geoposition.h:
+        (WebCore::Geoposition::create):
+        (WebCore::Geoposition::isolatedCopy):
+        (WebCore::Geoposition::Geoposition):
+        * Modules/geolocation/PositionError.h:
+        * Modules/geolocation/PositionOptions.h:
+
 2015-09-30  Hunseop Jeong  <[email protected]>
 
         [EFL][Gtk] Try to fix the build after r190379.

Modified: trunk/Source/WebCore/Modules/geolocation/GeoNotifier.cpp (190390 => 190391)


--- trunk/Source/WebCore/Modules/geolocation/GeoNotifier.cpp	2015-10-01 06:00:26 UTC (rev 190390)
+++ trunk/Source/WebCore/Modules/geolocation/GeoNotifier.cpp	2015-10-01 07:22:50 UTC (rev 190391)
@@ -34,11 +34,11 @@
 
 namespace WebCore {
 
-GeoNotifier::GeoNotifier(Geolocation& geolocation, PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options)
+GeoNotifier::GeoNotifier(Geolocation& geolocation, RefPtr<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, RefPtr<PositionOptions>&& options)
     : m_geolocation(geolocation)
-    , m_successCallback(successCallback)
-    , m_errorCallback(errorCallback)
-    , m_options(options)
+    , m_successCallback(WTF::move(successCallback))
+    , m_errorCallback(WTF::move(errorCallback))
+    , m_options(WTF::move(options))
     , m_timer(*this, &GeoNotifier::timerFired)
     , m_useCachedPosition(false)
 {
@@ -48,7 +48,7 @@
     ASSERT(m_options);
 }
 
-void GeoNotifier::setFatalError(PassRefPtr<PositionError> error)
+void GeoNotifier::setFatalError(RefPtr<PositionError>&& error)
 {
     // If a fatal error has already been set, stick with it. This makes sure that
     // when permission is denied, this is the error reported, as required by the
@@ -56,7 +56,7 @@
     if (m_fatalError)
         return;
 
-    m_fatalError = error;
+    m_fatalError = WTF::move(error);
     // An existing timer may not have a zero timeout.
     m_timer.stop();
     m_timer.startOneShot(0);

Modified: trunk/Source/WebCore/Modules/geolocation/GeoNotifier.h (190390 => 190391)


--- trunk/Source/WebCore/Modules/geolocation/GeoNotifier.h	2015-10-01 06:00:26 UTC (rev 190390)
+++ trunk/Source/WebCore/Modules/geolocation/GeoNotifier.h	2015-10-01 07:22:50 UTC (rev 190391)
@@ -45,13 +45,13 @@
 
 class GeoNotifier : public RefCounted<GeoNotifier> {
 public:
-    static Ref<GeoNotifier> create(Geolocation& geolocation, PassRefPtr<PositionCallback> positionCallback, PassRefPtr<PositionErrorCallback> positionErrorCallback, PassRefPtr<PositionOptions> options)
+    static Ref<GeoNotifier> create(Geolocation& geolocation, RefPtr<PositionCallback>&& positionCallback, RefPtr<PositionErrorCallback>&& positionErrorCallback, RefPtr<PositionOptions>&& options)
     {
-        return adoptRef(*new GeoNotifier(geolocation, positionCallback, positionErrorCallback, options));
+        return adoptRef(*new GeoNotifier(geolocation, WTF::move(positionCallback), WTF::move(positionErrorCallback), WTF::move(options)));
     }
 
     PositionOptions* options() const { return m_options.get(); }
-    void setFatalError(PassRefPtr<PositionError>);
+    void setFatalError(RefPtr<PositionError>&&);
 
     bool useCachedPosition() const { return m_useCachedPosition; }
     void setUseCachedPosition();
@@ -65,7 +65,7 @@
     bool hasZeroTimeout() const;
 
 private:
-    GeoNotifier(Geolocation&, PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>);
+    GeoNotifier(Geolocation&, RefPtr<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, RefPtr<PositionOptions>&&);
 
     Ref<Geolocation> m_geolocation;
     RefPtr<PositionCallback> m_successCallback;

Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp (190390 => 190391)


--- trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp	2015-10-01 06:00:26 UTC (rev 190390)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp	2015-10-01 07:22:50 UTC (rev 190391)
@@ -49,10 +49,10 @@
 static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocation service";
 static const char framelessDocumentErrorMessage[] = "Geolocation cannot be used in frameless documents";
 
-static PassRefPtr<Geoposition> createGeoposition(GeolocationPosition* position)
+static RefPtr<Geoposition> createGeoposition(GeolocationPosition* position)
 {
     if (!position)
-        return 0;
+        return nullptr;
     
     RefPtr<Coordinates> coordinates = Coordinates::create(position->latitude(), position->longitude(), position->canProvideAltitude(), position->altitude(), 
                                                           position->accuracy(), position->canProvideAltitudeAccuracy(), position->altitudeAccuracy(),
@@ -60,7 +60,7 @@
     return Geoposition::create(coordinates.release(), convertSecondsToDOMTimeStamp(position->timestamp()));
 }
 
-static PassRefPtr<PositionError> createPositionError(GeolocationError* error)
+static Ref<PositionError> createPositionError(GeolocationError* error)
 {
     PositionError::ErrorCode code = PositionError::POSITION_UNAVAILABLE;
     switch (error->code()) {
@@ -75,14 +75,13 @@
     return PositionError::create(code, error->message());
 }
 
-bool Geolocation::Watchers::add(int id, PassRefPtr<GeoNotifier> prpNotifier)
+bool Geolocation::Watchers::add(int id, RefPtr<GeoNotifier>&& notifier)
 {
     ASSERT(id > 0);
-    RefPtr<GeoNotifier> notifier = prpNotifier;
 
     if (!m_idToNotifierMap.add(id, notifier.get()).isNewEntry)
         return false;
-    m_notifierToIdMap.set(notifier.release(), id);
+    m_notifierToIdMap.set(WTF::move(notifier), id);
     return true;
 }
 
@@ -304,34 +303,34 @@
     return m_lastPosition.get();
 }
 
-void Geolocation::getCurrentPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options)
+void Geolocation::getCurrentPosition(RefPtr<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, RefPtr<PositionOptions>&& options)
 {
     if (!frame())
         return;
 
-    RefPtr<GeoNotifier> notifier = GeoNotifier::create(*this, successCallback, errorCallback, options);
+    RefPtr<GeoNotifier> notifier = GeoNotifier::create(*this, WTF::move(successCallback), WTF::move(errorCallback), WTF::move(options));
     startRequest(notifier.get());
 
     m_oneShots.add(notifier);
 }
 
-int Geolocation::watchPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options)
+int Geolocation::watchPosition(RefPtr<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, RefPtr<PositionOptions>&& options)
 {
     if (!frame())
         return 0;
 
-    RefPtr<GeoNotifier> notifier = GeoNotifier::create(*this, successCallback, errorCallback, options);
+    RefPtr<GeoNotifier> notifier = GeoNotifier::create(*this, WTF::move(successCallback), WTF::move(errorCallback), WTF::move(options));
     startRequest(notifier.get());
 
     int watchID;
     // Keep asking for the next id until we're given one that we don't already have.
     do {
         watchID = m_scriptExecutionContext->circularSequentialID();
-    } while (!m_watchers.add(watchID, notifier));
+    } while (!m_watchers.add(watchID, WTF::move(notifier)));
     return watchID;
 }
 
-void Geolocation::startRequest(GeoNotifier *notifier)
+void Geolocation::startRequest(GeoNotifier* notifier)
 {
     // Check whether permissions have already been denied. Note that if this is the case,
     // the permission state can not change again in the lifetime of this page.

Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.h (190390 => 190391)


--- trunk/Source/WebCore/Modules/geolocation/Geolocation.h	2015-10-01 06:00:26 UTC (rev 190390)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.h	2015-10-01 07:22:50 UTC (rev 190391)
@@ -61,8 +61,8 @@
     Document* document() const;
     WEBCORE_EXPORT Frame* frame() const;
 
-    void getCurrentPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>);
-    int watchPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>);
+    void getCurrentPosition(RefPtr<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, RefPtr<PositionOptions>&&);
+    int watchPosition(RefPtr<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, RefPtr<PositionOptions>&&);
     void clearWatch(int watchID);
 
     WEBCORE_EXPORT void setIsAllowed(bool);
@@ -93,7 +93,7 @@
 
     class Watchers {
     public:
-        bool add(int id, PassRefPtr<GeoNotifier>);
+        bool add(int id, RefPtr<GeoNotifier>&&);
         GeoNotifier* find(int id);
         void remove(int id);
         void remove(GeoNotifier*);

Modified: trunk/Source/WebCore/Modules/geolocation/GeolocationError.h (190390 => 190391)


--- trunk/Source/WebCore/Modules/geolocation/GeolocationError.h	2015-10-01 06:00:26 UTC (rev 190390)
+++ trunk/Source/WebCore/Modules/geolocation/GeolocationError.h	2015-10-01 07:22:50 UTC (rev 190391)
@@ -26,7 +26,6 @@
 #ifndef GeolocationError_h
 #define GeolocationError_h
 
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/WTFString.h>

Modified: trunk/Source/WebCore/Modules/geolocation/GeolocationPosition.h (190390 => 190391)


--- trunk/Source/WebCore/Modules/geolocation/GeolocationPosition.h	2015-10-01 06:00:26 UTC (rev 190390)
+++ trunk/Source/WebCore/Modules/geolocation/GeolocationPosition.h	2015-10-01 07:22:50 UTC (rev 190391)
@@ -26,7 +26,6 @@
 #ifndef GeolocationPosition_h
 #define GeolocationPosition_h
 
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 

Modified: trunk/Source/WebCore/Modules/geolocation/Geoposition.h (190390 => 190391)


--- trunk/Source/WebCore/Modules/geolocation/Geoposition.h	2015-10-01 06:00:26 UTC (rev 190390)
+++ trunk/Source/WebCore/Modules/geolocation/Geoposition.h	2015-10-01 07:22:50 UTC (rev 190391)
@@ -35,22 +35,22 @@
 
 class Geoposition : public RefCounted<Geoposition> {
 public:
-    static Ref<Geoposition> create(PassRefPtr<Coordinates> coordinates, DOMTimeStamp timestamp)
+    static Ref<Geoposition> create(RefPtr<Coordinates>&& coordinates, DOMTimeStamp timestamp)
     {
-        return adoptRef(*new Geoposition(coordinates, timestamp));
+        return adoptRef(*new Geoposition(WTF::move(coordinates), timestamp));
     }
 
-    PassRefPtr<Geoposition> isolatedCopy() const
+    Ref<Geoposition> isolatedCopy() const
     {
-        return Geoposition::create(m_coordinates->isolatedCopy(), m_timestamp);
+        return create(m_coordinates->isolatedCopy(), m_timestamp);
     }
 
     DOMTimeStamp timestamp() const { return m_timestamp; }
     Coordinates* coords() const { return m_coordinates.get(); }
     
 private:
-    Geoposition(PassRefPtr<Coordinates> coordinates, DOMTimeStamp timestamp)
-        : m_coordinates(coordinates)
+    Geoposition(RefPtr<Coordinates>&& coordinates, DOMTimeStamp timestamp)
+        : m_coordinates(WTF::move(coordinates))
         , m_timestamp(timestamp)
     {
         ASSERT(m_coordinates);

Modified: trunk/Source/WebCore/Modules/geolocation/PositionError.h (190390 => 190391)


--- trunk/Source/WebCore/Modules/geolocation/PositionError.h	2015-10-01 06:00:26 UTC (rev 190390)
+++ trunk/Source/WebCore/Modules/geolocation/PositionError.h	2015-10-01 07:22:50 UTC (rev 190391)
@@ -26,7 +26,6 @@
 #ifndef PositionError_h
 #define PositionError_h
 
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 

Modified: trunk/Source/WebCore/Modules/geolocation/PositionOptions.h (190390 => 190391)


--- trunk/Source/WebCore/Modules/geolocation/PositionOptions.h	2015-10-01 06:00:26 UTC (rev 190390)
+++ trunk/Source/WebCore/Modules/geolocation/PositionOptions.h	2015-10-01 07:22:50 UTC (rev 190391)
@@ -26,7 +26,6 @@
 #ifndef PositionOptions_h
 #define PositionOptions_h
 
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to