Modernize Geolocation code
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Sep 2017 19:01:45 +0000 (19:01 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Sep 2017 19:01:45 +0000 (19:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=176496

Reviewed by Andy Estes.

Source/WebCore:

No change in behavior.  Just more references instead of pointers.

* Modules/geolocation/Geolocation.cpp:
(WebCore::createPositionError):
(WebCore::Geolocation::resetAllGeolocationPermission):
(WebCore::Geolocation::stop):
(WebCore::Geolocation::requestPermission):
(WebCore::Geolocation::setError):
(WebCore::Geolocation::startUpdating):
(WebCore::Geolocation::stopUpdating):
* Modules/geolocation/Geolocation.h:
* Modules/geolocation/GeolocationClient.h:
* Modules/geolocation/GeolocationController.cpp:
(WebCore::GeolocationController::addObserver):
(WebCore::GeolocationController::removeObserver):
(WebCore::GeolocationController::requestPermission):
(WebCore::GeolocationController::cancelPermissionRequest):
(WebCore::GeolocationController::positionChanged):
(WebCore::GeolocationController::errorOccurred):
(WebCore::GeolocationController::activityStateDidChange):
(WebCore::provideGeolocationTo):
* Modules/geolocation/GeolocationController.h:

Source/WebKit:

Making the GeolocationPermissionRequestManager take a reference instead of a pointer
spilled into making the other supplement constructors do the same.

* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
(WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager):
(WebKit::LegacyCustomProtocolManager::startLoading):
(WebKit::LegacyCustomProtocolManager::stopLoading):
* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
* NetworkProcess/NetworkProcess.h:
(WebKit::NetworkProcess::addSupplement):
* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::AuthenticationManager):
(WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
* Shared/Authentication/AuthenticationManager.h:
* UIProcess/API/APIUIClient.h:
(API::UIClient::decidePolicyForGeolocationPermissionRequest):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
* WebProcess/Cookies/WebCookieManager.cpp:
(WebKit::WebCookieManager::WebCookieManager):
(WebKit::WebCookieManager::getHostnamesWithCookies):
(WebKit::WebCookieManager::deleteCookie):
(WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
(WebKit::WebCookieManager::getAllCookies):
(WebKit::WebCookieManager::getCookies):
(WebKit::WebCookieManager::setCookie):
(WebKit::WebCookieManager::setCookies):
(WebKit::WebCookieManager::notifyCookiesDidChange):
(WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
(WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
* WebProcess/Cookies/WebCookieManager.h:
* WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
(WebKit::GeolocationPermissionRequestManager::GeolocationPermissionRequestManager):
(WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
(WebKit::GeolocationPermissionRequestManager::cancelRequestForGeolocation):
* WebProcess/Geolocation/GeolocationPermissionRequestManager.h:
* WebProcess/Geolocation/WebGeolocationManager.cpp:
(WebKit::WebGeolocationManager::WebGeolocationManager):
(WebKit::WebGeolocationManager::registerWebPage):
(WebKit::WebGeolocationManager::unregisterWebPage):
(WebKit::WebGeolocationManager::setEnableHighAccuracyForPage):
(WebKit::WebGeolocationManager::didChangePosition):
(WebKit::WebGeolocationManager::didFailToDeterminePosition):
(WebKit::WebGeolocationManager::resetPermissions):
* WebProcess/Geolocation/WebGeolocationManager.h:
* WebProcess/MediaCache/WebMediaKeyStorageManager.h:
(WebKit::WebMediaKeyStorageManager::WebMediaKeyStorageManager):
* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::WebNotificationManager):
(WebKit::WebNotificationManager::show):
(WebKit::WebNotificationManager::cancel):
(WebKit::WebNotificationManager::clearNotifications):
(WebKit::WebNotificationManager::didDestroyNotification):
* WebProcess/Notifications/WebNotificationManager.h:
* WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
(WebKit::WebGeolocationClient::requestPermission):
(WebKit::WebGeolocationClient::cancelPermissionRequest):
* WebProcess/WebCoreSupport/WebGeolocationClient.h:
(WebKit::WebGeolocationClient::WebGeolocationClient):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_cpuLimit):
* WebProcess/WebProcess.h:
(WebKit::WebProcess::addSupplement):
* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::UserMediaCaptureManager):
* WebProcess/cocoa/UserMediaCaptureManager.h:

Source/WebKitLegacy/mac:

* WebCoreSupport/WebGeolocationClient.h:
* WebCoreSupport/WebGeolocationClient.mm:
(WebGeolocationClient::requestPermission):
(-[WebGeolocationPolicyListener initWithGeolocation:]):
(-[WebGeolocationPolicyListener initWithGeolocation:forWebView:]):
(-[WebGeolocationProviderInitializationListener initWithGeolocation:]):
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _geolocationDidFailWithMessage:]):

Source/WebKitLegacy/win:

* WebCoreSupport/WebGeolocationClient.cpp:
(WebGeolocationClient::requestPermission):
* WebCoreSupport/WebGeolocationClient.h:
(WebGeolocationClient::setEnableHighAccuracy): Deleted.
(WebGeolocationClient::cancelPermissionRequest): Deleted.
* WebGeolocationPolicyListener.h:
* WebView.cpp:
(WebView::initWithFrame):
(WebView::geolocationDidFailWithError):

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

42 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/geolocation/Geolocation.cpp
Source/WebCore/Modules/geolocation/Geolocation.h
Source/WebCore/Modules/geolocation/GeolocationClient.h
Source/WebCore/Modules/geolocation/GeolocationController.cpp
Source/WebCore/Modules/geolocation/GeolocationController.h
Source/WebCore/platform/mock/GeolocationClientMock.cpp
Source/WebCore/platform/mock/GeolocationClientMock.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp
Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/Shared/Authentication/AuthenticationManager.cpp
Source/WebKit/Shared/Authentication/AuthenticationManager.h
Source/WebKit/UIProcess/API/APIUIClient.h
Source/WebKit/UIProcess/API/C/WKPage.cpp
Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/WebProcess/Cookies/WebCookieManager.cpp
Source/WebKit/WebProcess/Cookies/WebCookieManager.h
Source/WebKit/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp
Source/WebKit/WebProcess/Geolocation/GeolocationPermissionRequestManager.h
Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp
Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.h
Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.h
Source/WebKit/WebProcess/Notifications/WebNotificationManager.cpp
Source/WebKit/WebProcess/Notifications/WebNotificationManager.h
Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp
Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.h
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.h
Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm
Source/WebKitLegacy/mac/WebView/WebView.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebCoreSupport/WebGeolocationClient.cpp
Source/WebKitLegacy/win/WebCoreSupport/WebGeolocationClient.h
Source/WebKitLegacy/win/WebGeolocationPolicyListener.h
Source/WebKitLegacy/win/WebView.cpp

index 18cfbe1..d6d493c 100644 (file)
@@ -1,3 +1,33 @@
+2017-09-07  Alex Christensen  <achristensen@webkit.org>
+
+        Modernize Geolocation code
+        https://bugs.webkit.org/show_bug.cgi?id=176496
+
+        Reviewed by Andy Estes.
+
+        No change in behavior.  Just more references instead of pointers.
+
+        * Modules/geolocation/Geolocation.cpp:
+        (WebCore::createPositionError):
+        (WebCore::Geolocation::resetAllGeolocationPermission):
+        (WebCore::Geolocation::stop):
+        (WebCore::Geolocation::requestPermission):
+        (WebCore::Geolocation::setError):
+        (WebCore::Geolocation::startUpdating):
+        (WebCore::Geolocation::stopUpdating):
+        * Modules/geolocation/Geolocation.h:
+        * Modules/geolocation/GeolocationClient.h:
+        * Modules/geolocation/GeolocationController.cpp:
+        (WebCore::GeolocationController::addObserver):
+        (WebCore::GeolocationController::removeObserver):
+        (WebCore::GeolocationController::requestPermission):
+        (WebCore::GeolocationController::cancelPermissionRequest):
+        (WebCore::GeolocationController::positionChanged):
+        (WebCore::GeolocationController::errorOccurred):
+        (WebCore::GeolocationController::activityStateDidChange):
+        (WebCore::provideGeolocationTo):
+        * Modules/geolocation/GeolocationController.h:
+
 2017-09-07  Adrian Perez de Castro  <aperez@igalia.com>
 
         [ARM] Building FELightningNEON.cpp fails due to missing {Point,Spot}LightSource declarations
index 32b1155..62a3a42 100644 (file)
@@ -65,10 +65,10 @@ static RefPtr<Geoposition> createGeoposition(GeolocationPosition* position)
     return Geoposition::create(WTFMove(coordinates), convertSecondsToDOMTimeStamp(position->timestamp()));
 }
 
-static Ref<PositionError> createPositionError(GeolocationError* error)
+static Ref<PositionError> createPositionError(GeolocationError& error)
 {
     PositionError::ErrorCode code = PositionError::POSITION_UNAVAILABLE;
-    switch (error->code()) {
+    switch (error.code()) {
     case GeolocationError::PermissionDenied:
         code = PositionError::PERMISSION_DENIED;
         break;
@@ -77,7 +77,7 @@ static Ref<PositionError> createPositionError(GeolocationError* error)
         break;
     }
 
-    return PositionError::create(code, error->message());
+    return PositionError::create(code, error.message());
 }
 
 bool Geolocation::Watchers::add(int id, RefPtr<GeoNotifier>&& notifier)
@@ -247,7 +247,7 @@ void Geolocation::resetAllGeolocationPermission()
     if (m_allowGeolocation == InProgress) {
         Page* page = this->page();
         if (page)
-            GeolocationController::from(page)->cancelPermissionRequest(this);
+            GeolocationController::from(page)->cancelPermissionRequest(*this);
 
         // This return is not technically correct as GeolocationController::cancelPermissionRequest() should have cleared the active request.
         // Neither iOS nor OS X supports cancelPermissionRequest() (https://bugs.webkit.org/show_bug.cgi?id=89524), so we workaround that and let ongoing requests complete. :(
@@ -277,7 +277,7 @@ void Geolocation::stop()
 {
     Page* page = this->page();
     if (page && m_allowGeolocation == InProgress)
-        GeolocationController::from(page)->cancelPermissionRequest(this);
+        GeolocationController::from(page)->cancelPermissionRequest(*this);
     // The frame may be moving to a new page and we want to get the permissions from the new page's client.
     m_allowGeolocation = Unknown;
     cancelAllRequests();
@@ -646,7 +646,7 @@ void Geolocation::requestPermission()
     m_allowGeolocation = InProgress;
 
     // Ask the embedder: it maintains the geolocation challenge policy itself.
-    GeolocationController::from(page)->requestPermission(this);
+    GeolocationController::from(page)->requestPermission(*this);
 }
 
 void Geolocation::makeSuccessCallbacks(Geoposition& position)
@@ -690,7 +690,7 @@ void Geolocation::positionChanged()
     makeSuccessCallbacks(*position);
 }
 
-void Geolocation::setError(GeolocationError* error)
+void Geolocation::setError(GeolocationError& error)
 {
     if (m_isSuspended) {
         m_errorWaitingForResume = createPositionError(error);
@@ -707,7 +707,7 @@ bool Geolocation::startUpdating(GeoNotifier* notifier)
     if (!page)
         return false;
 
-    GeolocationController::from(page)->addObserver(this, notifier->options().enableHighAccuracy);
+    GeolocationController::from(page)->addObserver(*this, notifier->options().enableHighAccuracy);
     return true;
 }
 
@@ -717,7 +717,7 @@ void Geolocation::stopUpdating()
     if (!page)
         return;
 
-    GeolocationController::from(page)->removeObserver(this);
+    GeolocationController::from(page)->removeObserver(*this);
 }
 
 void Geolocation::handlePendingPermissionNotifiers()
index 4b428c0..1db4d1c 100644 (file)
@@ -69,7 +69,7 @@ public:
     bool isAllowed() const { return m_allowGeolocation == Yes; }
 
     void positionChanged();
-    void setError(GeolocationError*);
+    void setError(GeolocationError&);
     bool shouldBlockGeolocationRequests();
 
 private:
index b35d5ef..f51fca9 100644 (file)
@@ -44,15 +44,15 @@ public:
     virtual void setEnableHighAccuracy(bool) = 0;
     virtual GeolocationPosition* lastPosition() = 0;
 
-    virtual void requestPermission(Geolocation*) = 0;
-    virtual void cancelPermissionRequest(Geolocation*) = 0;
+    virtual void requestPermission(Geolocation&) = 0;
+    virtual void cancelPermissionRequest(Geolocation&) = 0;
 
-    void provideGeolocationTo(Page*, GeolocationClient*);
+    void provideGeolocationTo(Page*, GeolocationClient&);
 
 protected:
     virtual ~GeolocationClient() { }
 };
 
-WEBCORE_EXPORT void provideGeolocationTo(Page*, GeolocationClient*);
+WEBCORE_EXPORT void provideGeolocationTo(Page*, GeolocationClient&);
 
 } // namespace WebCore
index 9e7a085..e4cd054 100644 (file)
@@ -52,7 +52,7 @@ GeolocationController::~GeolocationController()
     m_client.geolocationDestroyed();
 }
 
-void GeolocationController::addObserver(Geolocation* observer, bool enableHighAccuracy)
+void GeolocationController::addObserver(Geolocation& observer, bool enableHighAccuracy)
 {
     // This may be called multiple times with the same observer, though removeObserver()
     // is called only once with each.
@@ -67,7 +67,7 @@ void GeolocationController::addObserver(Geolocation* observer, bool enableHighAc
         m_client.startUpdating();
 }
 
-void GeolocationController::removeObserver(Geolocation* observer)
+void GeolocationController::removeObserver(Geolocation& observer)
 {
     if (!m_observers.contains(observer))
         return;
@@ -81,19 +81,19 @@ void GeolocationController::removeObserver(Geolocation* observer)
         m_client.setEnableHighAccuracy(false);
 }
 
-void GeolocationController::requestPermission(Geolocation* geolocation)
+void GeolocationController::requestPermission(Geolocation& geolocation)
 {
     if (!m_page.isVisible()) {
-        m_pendedPermissionRequest.add(geolocation);
+        m_pendingPermissionRequest.add(geolocation);
         return;
     }
 
     m_client.requestPermission(geolocation);
 }
 
-void GeolocationController::cancelPermissionRequest(Geolocation* geolocation)
+void GeolocationController::cancelPermissionRequest(Geolocation& geolocation)
 {
-    if (m_pendedPermissionRequest.remove(geolocation))
+    if (m_pendingPermissionRequest.remove(geolocation))
         return;
 
     m_client.cancelPermissionRequest(geolocation);
@@ -102,16 +102,20 @@ void GeolocationController::cancelPermissionRequest(Geolocation* geolocation)
 void GeolocationController::positionChanged(GeolocationPosition* position)
 {
     m_lastPosition = position;
-    Vector<RefPtr<Geolocation>> observersVector;
-    copyToVector(m_observers, observersVector);
+    Vector<Ref<Geolocation>> observersVector;
+    observersVector.reserveInitialCapacity(m_observers.size());
+    for (auto& observer : m_observers)
+        observersVector.uncheckedAppend(observer.copyRef());
     for (auto& observer : observersVector)
         observer->positionChanged();
 }
 
-void GeolocationController::errorOccurred(GeolocationError* error)
+void GeolocationController::errorOccurred(GeolocationError& error)
 {
-    Vector<RefPtr<Geolocation>> observersVector;
-    copyToVector(m_observers, observersVector);
+    Vector<Ref<Geolocation>> observersVector;
+    observersVector.reserveInitialCapacity(m_observers.size());
+    for (auto& observer : m_observers)
+        observersVector.uncheckedAppend(observer.copyRef());
     for (auto& observer : observersVector)
         observer->setError(error);
 }
@@ -138,7 +142,7 @@ void GeolocationController::activityStateDidChange(ActivityState::Flags oldActiv
     if (!m_page.isVisible())
         return;
 
-    HashSet<RefPtr<Geolocation>> pendedPermissionRequests = WTFMove(m_pendedPermissionRequest);
+    auto pendedPermissionRequests = WTFMove(m_pendingPermissionRequest);
     for (auto& permissionRequest : pendedPermissionRequests)
         m_client.requestPermission(permissionRequest.get());
 }
@@ -148,11 +152,10 @@ const char* GeolocationController::supplementName()
     return "GeolocationController";
 }
 
-void provideGeolocationTo(Page* page, GeolocationClient* client)
+void provideGeolocationTo(Page* page, GeolocationClient& client)
 {
     ASSERT(page);
-    ASSERT(client);
-    Supplement<Page>::provideTo(page, GeolocationController::supplementName(), std::make_unique<GeolocationController>(*page, *client));
+    Supplement<Page>::provideTo(page, GeolocationController::supplementName(), std::make_unique<GeolocationController>(*page, client));
 }
     
 } // namespace WebCore
index 4747087..ffbda42 100644 (file)
@@ -47,14 +47,14 @@ public:
     GeolocationController(Page&, GeolocationClient&);
     ~GeolocationController();
 
-    void addObserver(Geolocation*, bool enableHighAccuracy);
-    void removeObserver(Geolocation*);
+    void addObserver(Geolocation&, bool enableHighAccuracy);
+    void removeObserver(Geolocation&);
 
-    void requestPermission(Geolocation*);
-    void cancelPermissionRequest(Geolocation*);
+    void requestPermission(Geolocation&);
+    void cancelPermissionRequest(Geolocation&);
 
     WEBCORE_EXPORT void positionChanged(GeolocationPosition*);
-    WEBCORE_EXPORT void errorOccurred(GeolocationError*);
+    WEBCORE_EXPORT void errorOccurred(GeolocationError&);
 
     GeolocationPosition* lastPosition();
 
@@ -71,13 +71,13 @@ private:
 
     RefPtr<GeolocationPosition> m_lastPosition;
 
-    typedef HashSet<RefPtr<Geolocation>> ObserversSet;
+    typedef HashSet<Ref<Geolocation>> ObserversSet;
     // All observers; both those requesting high accuracy and those not.
     ObserversSet m_observers;
     ObserversSet m_highAccuracyObservers;
 
     // While the page is not visible, we pend permission requests.
-    HashSet<RefPtr<Geolocation>> m_pendedPermissionRequest;
+    HashSet<Ref<Geolocation>> m_pendingPermissionRequest;
 };
 
 } // namespace WebCore
index 45f5da9..bc01eda 100644 (file)
@@ -87,17 +87,17 @@ int GeolocationClientMock::numberOfPendingPermissionRequests() const
     return m_pendingPermission.size();
 }
 
-void GeolocationClientMock::requestPermission(Geolocation* geolocation)
+void GeolocationClientMock::requestPermission(Geolocation& geolocation)
 {
-    m_pendingPermission.add(geolocation);
+    m_pendingPermission.add(&geolocation);
     if (m_permissionState != PermissionStateUnset)
         asyncUpdatePermission();
 }
 
-void GeolocationClientMock::cancelPermissionRequest(Geolocation* geolocation)
+void GeolocationClientMock::cancelPermissionRequest(Geolocation& geolocation)
 {
     // Called from Geolocation::disconnectFrame() in response to Frame destruction.
-    m_pendingPermission.remove(geolocation);
+    m_pendingPermission.remove(&geolocation);
     if (m_pendingPermission.isEmpty() && m_permissionTimer.isActive())
         m_permissionTimer.stop();
 }
@@ -176,7 +176,7 @@ void GeolocationClientMock::controllerTimerFired()
         ASSERT(!m_hasError);
         m_controller->positionChanged(m_lastPosition.get());
     } else if (m_hasError) {
-        RefPtr<GeolocationError> geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, m_errorMessage);
+        auto geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, m_errorMessage);
         m_controller->errorOccurred(geolocatioError.get());
     }
 }
index 3d5279b..85fc038 100644 (file)
@@ -29,8 +29,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef GeolocationClientMock_h
-#define GeolocationClientMock_h
+#pragma once
 
 #include "GeolocationClient.h"
 #include "Timer.h"
@@ -64,8 +63,8 @@ public:
     void stopUpdating() override;
     void setEnableHighAccuracy(bool) override;
     GeolocationPosition* lastPosition() override;
-    void requestPermission(Geolocation*) override;
-    void cancelPermissionRequest(Geolocation*) override;
+    void requestPermission(Geolocation&) override;
+    void cancelPermissionRequest(Geolocation&) override;
 
 private:
     void asyncUpdateController();
@@ -94,5 +93,3 @@ private:
 };
 
 }
-
-#endif
index 853b588..2e8483f 100644 (file)
@@ -1,3 +1,79 @@
+2017-09-07  Alex Christensen  <achristensen@webkit.org>
+
+        Modernize Geolocation code
+        https://bugs.webkit.org/show_bug.cgi?id=176496
+
+        Reviewed by Andy Estes.
+
+        Making the GeolocationPermissionRequestManager take a reference instead of a pointer
+        spilled into making the other supplement constructors do the same.
+
+        * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
+        (WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager):
+        (WebKit::LegacyCustomProtocolManager::startLoading):
+        (WebKit::LegacyCustomProtocolManager::stopLoading):
+        * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
+        * NetworkProcess/NetworkProcess.h:
+        (WebKit::NetworkProcess::addSupplement):
+        * Shared/Authentication/AuthenticationManager.cpp:
+        (WebKit::AuthenticationManager::AuthenticationManager):
+        (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
+        * Shared/Authentication/AuthenticationManager.h:
+        * UIProcess/API/APIUIClient.h:
+        (API::UIClient::decidePolicyForGeolocationPermissionRequest):
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPageUIClient):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
+        * WebProcess/Cookies/WebCookieManager.cpp:
+        (WebKit::WebCookieManager::WebCookieManager):
+        (WebKit::WebCookieManager::getHostnamesWithCookies):
+        (WebKit::WebCookieManager::deleteCookie):
+        (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
+        (WebKit::WebCookieManager::getAllCookies):
+        (WebKit::WebCookieManager::getCookies):
+        (WebKit::WebCookieManager::setCookie):
+        (WebKit::WebCookieManager::setCookies):
+        (WebKit::WebCookieManager::notifyCookiesDidChange):
+        (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
+        (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
+        * WebProcess/Cookies/WebCookieManager.h:
+        * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
+        (WebKit::GeolocationPermissionRequestManager::GeolocationPermissionRequestManager):
+        (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
+        (WebKit::GeolocationPermissionRequestManager::cancelRequestForGeolocation):
+        * WebProcess/Geolocation/GeolocationPermissionRequestManager.h:
+        * WebProcess/Geolocation/WebGeolocationManager.cpp:
+        (WebKit::WebGeolocationManager::WebGeolocationManager):
+        (WebKit::WebGeolocationManager::registerWebPage):
+        (WebKit::WebGeolocationManager::unregisterWebPage):
+        (WebKit::WebGeolocationManager::setEnableHighAccuracyForPage):
+        (WebKit::WebGeolocationManager::didChangePosition):
+        (WebKit::WebGeolocationManager::didFailToDeterminePosition):
+        (WebKit::WebGeolocationManager::resetPermissions):
+        * WebProcess/Geolocation/WebGeolocationManager.h:
+        * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
+        (WebKit::WebMediaKeyStorageManager::WebMediaKeyStorageManager):
+        * WebProcess/Notifications/WebNotificationManager.cpp:
+        (WebKit::WebNotificationManager::WebNotificationManager):
+        (WebKit::WebNotificationManager::show):
+        (WebKit::WebNotificationManager::cancel):
+        (WebKit::WebNotificationManager::clearNotifications):
+        (WebKit::WebNotificationManager::didDestroyNotification):
+        * WebProcess/Notifications/WebNotificationManager.h:
+        * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
+        (WebKit::WebGeolocationClient::requestPermission):
+        (WebKit::WebGeolocationClient::cancelPermissionRequest):
+        * WebProcess/WebCoreSupport/WebGeolocationClient.h:
+        (WebKit::WebGeolocationClient::WebGeolocationClient):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_cpuLimit):
+        * WebProcess/WebProcess.h:
+        (WebKit::WebProcess::addSupplement):
+        * WebProcess/cocoa/UserMediaCaptureManager.cpp:
+        (WebKit::UserMediaCaptureManager::UserMediaCaptureManager):
+        * WebProcess/cocoa/UserMediaCaptureManager.h:
+
 2017-09-06  Alex Christensen  <achristensen@webkit.org>
 
         Add WKUIDelegatePrivate equivalent of WKPageUIClient's pageDidScroll
index 686fc56..b46cdc3 100644 (file)
@@ -47,10 +47,10 @@ const char* LegacyCustomProtocolManager::supplementName()
     return "LegacyCustomProtocolManager";
 }
 
-LegacyCustomProtocolManager::LegacyCustomProtocolManager(ChildProcess* childProcess)
+LegacyCustomProtocolManager::LegacyCustomProtocolManager(ChildProcess& childProcess)
     : m_childProcess(childProcess)
 {
-    m_childProcess->addMessageReceiver(Messages::LegacyCustomProtocolManager::messageReceiverName(), *this);
+    m_childProcess.addMessageReceiver(Messages::LegacyCustomProtocolManager::messageReceiverName(), *this);
 }
 
 void LegacyCustomProtocolManager::initialize(const NetworkProcessCreationParameters& parameters)
@@ -77,12 +77,12 @@ void LegacyCustomProtocolManager::removeCustomProtocol(uint64_t customProtocolID
 
 void LegacyCustomProtocolManager::startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest& request)
 {
-    m_childProcess->send(Messages::LegacyCustomProtocolManagerProxy::StartLoading(customProtocolID, request));
+    m_childProcess.send(Messages::LegacyCustomProtocolManagerProxy::StartLoading(customProtocolID, request));
 }
 
 void LegacyCustomProtocolManager::stopLoading(uint64_t customProtocolID)
 {
-    m_childProcess->send(Messages::LegacyCustomProtocolManagerProxy::StopLoading(customProtocolID), 0);
+    m_childProcess.send(Messages::LegacyCustomProtocolManagerProxy::StopLoading(customProtocolID), 0);
 }
 
 } // namespace WebKit
index a4ef2d7..19ae78a 100644 (file)
@@ -65,7 +65,7 @@ struct NetworkProcessCreationParameters;
 class LegacyCustomProtocolManager : public NetworkProcessSupplement, public IPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(LegacyCustomProtocolManager);
 public:
-    explicit LegacyCustomProtocolManager(ChildProcess*);
+    explicit LegacyCustomProtocolManager(ChildProcess&);
 
     static const char* supplementName();
 
@@ -113,7 +113,7 @@ private:
 
     void registerProtocolClass();
 
-    ChildProcess* m_childProcess;
+    ChildProcess& m_childProcess;
 
     typedef HashMap<uint64_t, CustomProtocol> CustomProtocolMap;
     CustomProtocolMap m_customProtocolMap;
index b8f7941..bf2b36f 100644 (file)
@@ -86,7 +86,7 @@ public:
     template <typename T>
     void addSupplement()
     {
-        m_supplements.add(T::supplementName(), std::make_unique<T>(this));
+        m_supplements.add(T::supplementName(), std::make_unique<T>(*this));
     }
 
     void removeNetworkConnectionToWebProcess(NetworkConnectionToWebProcess*);
index 941b76a..032029e 100644 (file)
@@ -62,10 +62,10 @@ const char* AuthenticationManager::supplementName()
     return "AuthenticationManager";
 }
 
-AuthenticationManager::AuthenticationManager(ChildProcess* process)
+AuthenticationManager::AuthenticationManager(ChildProcess& process)
     : m_process(process)
 {
-    m_process->addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), *this);
+    m_process.addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), *this);
 }
 
 uint64_t AuthenticationManager::addChallengeToChallengeMap(Challenge&& challenge)
@@ -126,7 +126,7 @@ void AuthenticationManager::didReceiveAuthenticationChallenge(WebFrame* frame, c
     if (shouldCoalesceChallenge(pageID, challengeID, authenticationChallenge))
         return;
     
-    m_process->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID());
+    m_process.send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID());
 }
 
 #if USE(NETWORK_SESSION)
@@ -141,7 +141,7 @@ void AuthenticationManager::didReceiveAuthenticationChallenge(uint64_t pageID, u
     if (shouldCoalesceChallenge(pageID, challengeID, authenticationChallenge))
         return;
     
-    m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
+    m_process.send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
 }
 
 void AuthenticationManager::didReceiveAuthenticationChallenge(PendingDownload& pendingDownload, const WebCore::AuthenticationChallenge& authenticationChallenge, ChallengeCompletionHandler&& completionHandler)
@@ -169,7 +169,7 @@ void AuthenticationManager::didReceiveAuthenticationChallenge(uint64_t pageID, u
     if (shouldCoalesceChallenge(pageID, challengeID, authenticationChallenge))
         return;
     
-    m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
+    m_process.send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
 }
 #endif
 
index 6c49cc7..9ebefd4 100644 (file)
@@ -59,7 +59,7 @@ using ChallengeCompletionHandler = CompletionHandler<void(AuthenticationChalleng
 class AuthenticationManager : public WebProcessSupplement, public NetworkProcessSupplement, public IPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(AuthenticationManager);
 public:
-    explicit AuthenticationManager(ChildProcess*);
+    explicit AuthenticationManager(ChildProcess&);
 
     static const char* supplementName();
 
@@ -118,7 +118,7 @@ private:
 
     Vector<uint64_t> coalesceChallengesMatching(uint64_t challengeID) const;
 
-    ChildProcess* m_process;
+    ChildProcess& m_process;
 
     HashMap<uint64_t, Challenge> m_challenges;
 };
index e37959e..1fcbfdd 100644 (file)
@@ -127,7 +127,7 @@ public:
     }
 
     virtual bool runOpenPanel(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::SecurityOriginData&, OpenPanelParameters*, WebKit::WebOpenPanelResultListenerProxy*) { return false; }
-    virtual bool decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, SecurityOrigin*, WebKit::GeolocationPermissionRequestProxy*) { return false; }
+    virtual bool decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, WebKit::GeolocationPermissionRequestProxy&) { return false; }
     virtual bool decidePolicyForUserMediaPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionRequestProxy&) { return false; }
     virtual bool checkUserMediaPermissionForOrigin(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionCheckProxy&) { return false; }
     virtual bool decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy*, SecurityOrigin*, WebKit::NotificationPermissionRequest*) { return false; }
index a9b3b3e..27c4931 100644 (file)
@@ -1953,12 +1953,12 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient
             return true;
         }
 
-        bool decidePolicyForGeolocationPermissionRequest(WebPageProxy* page, WebFrameProxy* frame, API::SecurityOrigin* origin, GeolocationPermissionRequestProxy* permissionRequest) final
+        bool decidePolicyForGeolocationPermissionRequest(WebPageProxy& page, WebFrameProxy& frame, API::SecurityOrigin& origin, GeolocationPermissionRequestProxy& permissionRequest) final
         {
             if (!m_client.decidePolicyForGeolocationPermissionRequest)
                 return false;
 
-            m_client.decidePolicyForGeolocationPermissionRequest(toAPI(page), toAPI(frame), toAPI(origin), toAPI(permissionRequest), m_client.base.clientInfo);
+            m_client.decidePolicyForGeolocationPermissionRequest(toAPI(&page), toAPI(&frame), toAPI(&origin), toAPI(&permissionRequest), m_client.base.clientInfo);
             return true;
         }
 
index bcec076..78af964 100644 (file)
@@ -182,9 +182,9 @@ private:
         return true;
     }
 
-    bool decidePolicyForGeolocationPermissionRequest(WebPageProxy*, WebFrameProxy*, API::SecurityOrigin*, GeolocationPermissionRequestProxy* permissionRequest) override
+    bool decidePolicyForGeolocationPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin&, GeolocationPermissionRequestProxy& permissionRequest) final
     {
-        GRefPtr<WebKitGeolocationPermissionRequest> geolocationPermissionRequest = adoptGRef(webkitGeolocationPermissionRequestCreate(permissionRequest));
+        GRefPtr<WebKitGeolocationPermissionRequest> geolocationPermissionRequest = adoptGRef(webkitGeolocationPermissionRequestCreate(&permissionRequest));
         webkitWebViewMakePermissionRequest(m_webView, WEBKIT_PERMISSION_REQUEST(geolocationPermissionRequest.get()));
         return true;
     }
index 7e6af7e..6bb555d 100644 (file)
@@ -5809,13 +5809,13 @@ void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID,
     MESSAGE_CHECK(frame);
 
     // FIXME: Geolocation should probably be using toString() as its string representation instead of databaseIdentifier().
-    RefPtr<API::SecurityOrigin> origin = API::SecurityOrigin::create(SecurityOriginData::fromDatabaseIdentifier(originIdentifier)->securityOrigin());
-    RefPtr<GeolocationPermissionRequestProxy> request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
+    auto origin = API::SecurityOrigin::create(SecurityOriginData::fromDatabaseIdentifier(originIdentifier)->securityOrigin());
+    auto request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
 
-    if (m_uiClient->decidePolicyForGeolocationPermissionRequest(this, frame, origin.get(), request.get()))
+    if (m_uiClient->decidePolicyForGeolocationPermissionRequest(*this, *frame, origin.get(), request.get()))
         return;
 
-    if (m_pageClient.decidePolicyForGeolocationPermissionRequest(*frame, *origin, *request))
+    if (m_pageClient.decidePolicyForGeolocationPermissionRequest(*frame, origin.get(), request.get()))
         return;
 
     request->deny();
index 9dc5770..7d20123 100644 (file)
@@ -48,10 +48,10 @@ const char* WebCookieManager::supplementName()
     return "WebCookieManager";
 }
 
-WebCookieManager::WebCookieManager(ChildProcess* process)
+WebCookieManager::WebCookieManager(ChildProcess& process)
     : m_process(process)
 {
-    m_process->addMessageReceiver(Messages::WebCookieManager::messageReceiverName(), *this);
+    m_process.addMessageReceiver(Messages::WebCookieManager::messageReceiverName(), *this);
 }
 
 void WebCookieManager::getHostnamesWithCookies(PAL::SessionID sessionID, CallbackID callbackID)
@@ -63,7 +63,7 @@ void WebCookieManager::getHostnamesWithCookies(PAL::SessionID sessionID, Callbac
     Vector<String> hostnameList;
     copyToVector(hostnames, hostnameList);
 
-    m_process->send(Messages::WebCookieManagerProxy::DidGetHostnamesWithCookies(hostnameList, callbackID), 0);
+    m_process.send(Messages::WebCookieManagerProxy::DidGetHostnamesWithCookies(hostnameList, callbackID), 0);
 }
 
 void WebCookieManager::deleteCookiesForHostname(PAL::SessionID sessionID, const String& hostname)
@@ -84,7 +84,7 @@ void WebCookieManager::deleteCookie(PAL::SessionID sessionID, const Cookie& cook
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
         storageSession->deleteCookie(cookie);
 
-    m_process->send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
+    m_process.send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
 }
 
 void WebCookieManager::deleteAllCookiesModifiedSince(PAL::SessionID sessionID, std::chrono::system_clock::time_point time, CallbackID callbackID)
@@ -92,7 +92,7 @@ void WebCookieManager::deleteAllCookiesModifiedSince(PAL::SessionID sessionID, s
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
         WebCore::deleteAllCookiesModifiedSince(*storageSession, time);
 
-    m_process->send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
+    m_process.send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
 }
 
 void WebCookieManager::getAllCookies(PAL::SessionID sessionID, CallbackID callbackID)
@@ -101,7 +101,7 @@ void WebCookieManager::getAllCookies(PAL::SessionID sessionID, CallbackID callba
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
         cookies = storageSession->getAllCookies();
 
-    m_process->send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
+    m_process.send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
 }
 
 void WebCookieManager::getCookies(PAL::SessionID sessionID, const URL& url, CallbackID callbackID)
@@ -110,7 +110,7 @@ void WebCookieManager::getCookies(PAL::SessionID sessionID, const URL& url, Call
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
         cookies = storageSession->getCookies(url);
 
-    m_process->send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
+    m_process.send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
 }
 
 void WebCookieManager::setCookie(PAL::SessionID sessionID, const Cookie& cookie, CallbackID callbackID)
@@ -118,7 +118,7 @@ void WebCookieManager::setCookie(PAL::SessionID sessionID, const Cookie& cookie,
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
         storageSession->setCookie(cookie);
 
-    m_process->send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
+    m_process.send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
 }
 
 void WebCookieManager::setCookies(PAL::SessionID sessionID, const Vector<Cookie>& cookies, const URL& url, const URL& mainDocumentURL, CallbackID callbackID)
@@ -126,13 +126,13 @@ void WebCookieManager::setCookies(PAL::SessionID sessionID, const Vector<Cookie>
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
         storageSession->setCookies(cookies, url, mainDocumentURL);
 
-    m_process->send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
+    m_process.send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
 }
 
 void WebCookieManager::notifyCookiesDidChange(PAL::SessionID sessionID)
 {
     ASSERT(RunLoop::isMain());
-    m_process->send(Messages::WebCookieManagerProxy::CookiesDidChange(sessionID), 0);
+    m_process.send(Messages::WebCookieManagerProxy::CookiesDidChange(sessionID), 0);
 }
 
 void WebCookieManager::startObservingCookieChanges(PAL::SessionID sessionID)
@@ -155,12 +155,12 @@ void WebCookieManager::setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy,
     platformSetHTTPCookieAcceptPolicy(policy);
 
     if (callbackID)
-        m_process->send(Messages::WebCookieManagerProxy::DidSetHTTPCookieAcceptPolicy(callbackID.callbackID()), 0);
+        m_process.send(Messages::WebCookieManagerProxy::DidSetHTTPCookieAcceptPolicy(callbackID.callbackID()), 0);
 }
 
 void WebCookieManager::getHTTPCookieAcceptPolicy(CallbackID callbackID)
 {
-    m_process->send(Messages::WebCookieManagerProxy::DidGetHTTPCookieAcceptPolicy(platformGetHTTPCookieAcceptPolicy(), callbackID), 0);
+    m_process.send(Messages::WebCookieManagerProxy::DidGetHTTPCookieAcceptPolicy(platformGetHTTPCookieAcceptPolicy(), callbackID), 0);
 }
 
 } // namespace WebKit
index e9d75c5..89ff04a 100644 (file)
@@ -54,7 +54,7 @@ class ChildProcess;
 class WebCookieManager : public WebProcessSupplement, public NetworkProcessSupplement, public IPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(WebCookieManager);
 public:
-    WebCookieManager(ChildProcess*);
+    WebCookieManager(ChildProcess&);
 
     static const char* supplementName();
 
@@ -89,7 +89,7 @@ private:
     void startObservingCookieChanges(PAL::SessionID);
     void stopObservingCookieChanges(PAL::SessionID);
 
-    ChildProcess* m_process;
+    ChildProcess& m_process;
 };
 
 } // namespace WebKit
index 9b2bb76..93b936f 100644 (file)
@@ -49,37 +49,37 @@ static uint64_t generateGeolocationID()
     return uniqueGeolocationID++;
 }
 
-GeolocationPermissionRequestManager::GeolocationPermissionRequestManager(WebPage* page)
+GeolocationPermissionRequestManager::GeolocationPermissionRequestManager(WebPage& page)
     : m_page(page)
 {
 }
 
-void GeolocationPermissionRequestManager::startRequestForGeolocation(Geolocation* geolocation)
+void GeolocationPermissionRequestManager::startRequestForGeolocation(Geolocation& geolocation)
 {
-    Frame* frame = geolocation->frame();
+    Frame* frame = geolocation.frame();
 
     ASSERT_WITH_MESSAGE(frame, "It is not well understood in which cases the Geolocation is alive after its frame goes away. If you hit this assertion, please add a test covering this case.");
     if (!frame) {
-        geolocation->setIsAllowed(false);
+        geolocation.setIsAllowed(false);
         return;
     }
 
     uint64_t geolocationID = generateGeolocationID();
 
-    m_geolocationToIDMap.set(geolocation, geolocationID);
-    m_idToGeolocationMap.set(geolocationID, geolocation);
+    m_geolocationToIDMap.set(&geolocation, geolocationID);
+    m_idToGeolocationMap.set(geolocationID, &geolocation);
 
     WebFrame* webFrame = WebFrame::fromCoreFrame(*frame);
     ASSERT(webFrame);
 
     SecurityOrigin& origin = frame->document()->securityOrigin();
 
-    m_page->send(Messages::WebPageProxy::RequestGeolocationPermissionForFrame(geolocationID, webFrame->frameID(), SecurityOriginData::fromSecurityOrigin(origin).databaseIdentifier()));
+    m_page.send(Messages::WebPageProxy::RequestGeolocationPermissionForFrame(geolocationID, webFrame->frameID(), SecurityOriginData::fromSecurityOrigin(origin).databaseIdentifier()));
 }
 
-void GeolocationPermissionRequestManager::cancelRequestForGeolocation(Geolocation* geolocation)
+void GeolocationPermissionRequestManager::cancelRequestForGeolocation(Geolocation& geolocation)
 {
-    uint64_t geolocationID = m_geolocationToIDMap.take(geolocation);
+    uint64_t geolocationID = m_geolocationToIDMap.take(&geolocation);
     if (!geolocationID)
         return;
     m_idToGeolocationMap.remove(geolocationID);
index 5e37163..fd6523d 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef GeolocationPermissionRequestManager_h
-#define GeolocationPermissionRequestManager_h
+#pragma once
 
 #include <wtf/HashMap.h>
 #include <wtf/RefPtr.h>
@@ -39,10 +38,10 @@ class WebPage;
 
 class GeolocationPermissionRequestManager {
 public:
-    explicit GeolocationPermissionRequestManager(WebPage*);
+    explicit GeolocationPermissionRequestManager(WebPage&);
 
-    void startRequestForGeolocation(WebCore::Geolocation*);
-    void cancelRequestForGeolocation(WebCore::Geolocation*);
+    void startRequestForGeolocation(WebCore::Geolocation&);
+    void cancelRequestForGeolocation(WebCore::Geolocation&);
 
     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
 
@@ -52,9 +51,7 @@ private:
     IDToGeolocationMap m_idToGeolocationMap;
     GeolocationToIDMap m_geolocationToIDMap;
 
-    WebPage* m_page;
+    WebPage& m_page;
 };
 
 } // namespace WebKit
-
-#endif // GeolocationPermissionRequestManager_h
index 27f7bb8..d36e68d 100644 (file)
@@ -45,50 +45,50 @@ const char* WebGeolocationManager::supplementName()
     return "WebGeolocationManager";
 }
 
-WebGeolocationManager::WebGeolocationManager(WebProcess* process)
+WebGeolocationManager::WebGeolocationManager(WebProcess& process)
     : m_process(process)
 {
-    m_process->addMessageReceiver(Messages::WebGeolocationManager::messageReceiverName(), *this);
+    m_process.addMessageReceiver(Messages::WebGeolocationManager::messageReceiverName(), *this);
 }
 
-void WebGeolocationManager::registerWebPage(WebPage* page)
+void WebGeolocationManager::registerWebPage(WebPage& page)
 {
     bool wasUpdating = isUpdating();
 
-    m_pageSet.add(page);
+    m_pageSet.add(&page);
 
     if (!wasUpdating)
-        m_process->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StartUpdating(), 0);
+        m_process.parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StartUpdating(), 0);
 }
 
-void WebGeolocationManager::unregisterWebPage(WebPage* page)
+void WebGeolocationManager::unregisterWebPage(WebPage& page)
 {
     bool highAccuracyWasEnabled = isHighAccuracyEnabled();
 
-    m_pageSet.remove(page);
-    m_highAccuracyPageSet.remove(page);
+    m_pageSet.remove(&page);
+    m_highAccuracyPageSet.remove(&page);
 
     if (!isUpdating())
-        m_process->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StopUpdating(), 0);
+        m_process.parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StopUpdating(), 0);
     else {
         bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled();
         if (highAccuracyWasEnabled != highAccuracyShouldBeEnabled)
-            m_process->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0);
+            m_process.parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0);
     }
 }
 
-void WebGeolocationManager::setEnableHighAccuracyForPage(WebPage* page, bool enabled)
+void WebGeolocationManager::setEnableHighAccuracyForPage(WebPage& page, bool enabled)
 {
     bool highAccuracyWasEnabled = isHighAccuracyEnabled();
 
     if (enabled)
-        m_highAccuracyPageSet.add(page);
+        m_highAccuracyPageSet.add(&page);
     else
-        m_highAccuracyPageSet.remove(page);
+        m_highAccuracyPageSet.remove(&page);
 
     bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled();
     if (highAccuracyWasEnabled != highAccuracyShouldBeEnabled)
-        m_process->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0);
+        m_process.parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0);
 }
 
 void WebGeolocationManager::didChangePosition(const WebGeolocationPosition::Data& data)
@@ -98,8 +98,7 @@ void WebGeolocationManager::didChangePosition(const WebGeolocationPosition::Data
 
     Vector<RefPtr<WebPage>> webPageCopy;
     copyToVector(m_pageSet, webPageCopy);
-    for (size_t i = 0; i < webPageCopy.size(); ++i) {
-        WebPage* page = webPageCopy[i].get();
+    for (auto& page : webPageCopy) {
         if (page->corePage())
             GeolocationController::from(page->corePage())->positionChanged(position.get());
     }
@@ -112,12 +111,11 @@ void WebGeolocationManager::didFailToDeterminePosition(const String& errorMessag
 {
 #if ENABLE(GEOLOCATION)
     // FIXME: Add localized error string.
-    RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage);
+    auto error = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage);
 
     Vector<RefPtr<WebPage>> webPageCopy;
     copyToVector(m_pageSet, webPageCopy);
-    for (size_t i = 0; i < webPageCopy.size(); ++i) {
-        WebPage* page = webPageCopy[i].get();
+    for (auto& page : webPageCopy) {
         if (page->corePage())
             GeolocationController::from(page->corePage())->errorOccurred(error.get());
     }
@@ -129,7 +127,7 @@ void WebGeolocationManager::didFailToDeterminePosition(const String& errorMessag
 #if PLATFORM(IOS)
 void WebGeolocationManager::resetPermissions()
 {
-    m_process->resetAllGeolocationPermissions();
+    m_process.resetAllGeolocationPermissions();
 }
 #endif // PLATFORM(IOS)
 
index 5fa2fbb..d1f3cb7 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebGeolocationManager_h
-#define WebGeolocationManager_h
+#pragma once
 
 #include "MessageReceiver.h"
 #include "WebGeolocationPosition.h"
@@ -46,15 +45,15 @@ class WebPage;
 class WebGeolocationManager : public WebProcessSupplement, public IPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(WebGeolocationManager);
 public:
-    explicit WebGeolocationManager(WebProcess*);
+    explicit WebGeolocationManager(WebProcess&);
 
     static const char* supplementName();
 
-    void registerWebPage(WebPage*);
-    void unregisterWebPage(WebPage*);
-    void setEnableHighAccuracyForPage(WebPage*, bool);
+    void registerWebPage(WebPage&);
+    void unregisterWebPage(WebPage&);
+    void setEnableHighAccuracyForPage(WebPage&, bool);
 
-    void requestPermission(WebCore::Geolocation*);
+    void requestPermission(WebCore::Geolocation&);
 
 private:
     // IPC::MessageReceiver
@@ -69,11 +68,9 @@ private:
     void resetPermissions();
 #endif // PLATFORM(IOS)
 
-    WebProcess* m_process;
+    WebProcess& m_process;
     HashSet<WebPage*> m_pageSet;
     HashSet<WebPage*> m_highAccuracyPageSet;
 };
 
 } // namespace WebKit
-
-#endif // WebGeolocationManager_h
index ef746fe..119ece8 100644 (file)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef WebMediaKeyStorageManager_h
-#define WebMediaKeyStorageManager_h
+#pragma once
 
 #include "WebProcessSupplement.h"
 #include <wtf/Noncopyable.h>
@@ -41,7 +40,7 @@ class WebProcess;
 class WebMediaKeyStorageManager : public WebProcessSupplement {
     WTF_MAKE_NONCOPYABLE(WebMediaKeyStorageManager);
 public:
-    explicit WebMediaKeyStorageManager(WebProcess*) { }
+    explicit WebMediaKeyStorageManager(WebProcess&) { }
     virtual ~WebMediaKeyStorageManager() { }
 
     static const char* supplementName();
@@ -61,5 +60,3 @@ private:
 };
 
 }
-
-#endif
index cbc4fa6..ccf335f 100644 (file)
@@ -61,11 +61,11 @@ const char* WebNotificationManager::supplementName()
     return "WebNotificationManager";
 }
 
-WebNotificationManager::WebNotificationManager(WebProcess* process)
+WebNotificationManager::WebNotificationManager(WebProcess& process)
     : m_process(process)
 {
 #if ENABLE(NOTIFICATIONS)
-    m_process->addMessageReceiver(Messages::WebNotificationManager::messageReceiverName(), *this);
+    m_process.addMessageReceiver(Messages::WebNotificationManager::messageReceiverName(), *this);
 #endif
 }
 
@@ -151,7 +151,7 @@ bool WebNotificationManager::show(Notification* notification, WebPage* page)
     auto it = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<uint64_t>()).iterator;
     it->value.append(notificationID);
 
-    m_process->parentProcessConnection()->send(Messages::WebPageProxy::ShowNotification(notification->title(), notification->body(), notification->icon().string(), notification->tag(), notification->lang(), notification->dir(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
+    m_process.parentProcessConnection()->send(Messages::WebPageProxy::ShowNotification(notification->title(), notification->body(), notification->icon().string(), notification->tag(), notification->lang(), notification->dir(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
     return true;
 #else
     UNUSED_PARAM(notification);
@@ -170,7 +170,7 @@ void WebNotificationManager::cancel(Notification* notification, WebPage* page)
     if (!notificationID)
         return;
     
-    m_process->parentProcessConnection()->send(Messages::WebPageProxy::CancelNotification(notificationID), page->pageID());
+    m_process.parentProcessConnection()->send(Messages::WebPageProxy::CancelNotification(notificationID), page->pageID());
 #else
     UNUSED_PARAM(notification);
     UNUSED_PARAM(page);
@@ -185,7 +185,7 @@ void WebNotificationManager::clearNotifications(WebCore::ScriptExecutionContext*
         return;
 
     Vector<uint64_t>& notificationIDs = it->value;
-    m_process->parentProcessConnection()->send(Messages::WebPageProxy::ClearNotifications(notificationIDs), page->pageID());
+    m_process.parentProcessConnection()->send(Messages::WebPageProxy::ClearNotifications(notificationIDs), page->pageID());
     size_t count = notificationIDs.size();
     for (size_t i = 0; i < count; ++i) {
         RefPtr<Notification> notification = m_notificationIDMap.take(notificationIDs[i]);
@@ -211,7 +211,7 @@ void WebNotificationManager::didDestroyNotification(Notification* notification,
 
     m_notificationIDMap.remove(notificationID);
     removeNotificationFromContextMap(notificationID, notification);
-    m_process->parentProcessConnection()->send(Messages::WebPageProxy::DidDestroyNotification(notificationID), page->pageID());
+    m_process.parentProcessConnection()->send(Messages::WebPageProxy::DidDestroyNotification(notificationID), page->pageID());
 #else
     UNUSED_PARAM(notification);
     UNUSED_PARAM(page);
index 12b83a3..2d1e842 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebNotificationManager_h
-#define WebNotificationManager_h
+#pragma once
 
 #include "MessageReceiver.h"
 #include "WebProcessSupplement.h"
@@ -48,7 +47,7 @@ class WebProcess;
 class WebNotificationManager : public WebProcessSupplement, public IPC::MessageReceiver {
     WTF_MAKE_NONCOPYABLE(WebNotificationManager);
 public:
-    explicit WebNotificationManager(WebProcess*);
+    explicit WebNotificationManager(WebProcess&);
     ~WebNotificationManager();
 
     static const char* supplementName();
@@ -84,7 +83,7 @@ private:
     void removeNotificationFromContextMap(uint64_t notificationID, WebCore::Notification*);
 #endif
 
-    WebProcess* m_process;
+    WebProcess& m_process;
 
 #if ENABLE(NOTIFICATIONS)
     typedef HashMap<RefPtr<WebCore::Notification>, uint64_t> NotificationMap;
@@ -101,5 +100,3 @@ private:
 };
 
 } // namespace WebKit
-
-#endif
index 8e5dab1..3bc8dfc 100644 (file)
@@ -70,14 +70,14 @@ GeolocationPosition* WebGeolocationClient::lastPosition()
     return 0;
 }
 
-void WebGeolocationClient::requestPermission(Geolocation* geolocation)
+void WebGeolocationClient::requestPermission(Geolocation& geolocation)
 {
-    m_page->geolocationPermissionRequestManager().startRequestForGeolocation(geolocation);
+    m_page.geolocationPermissionRequestManager().startRequestForGeolocation(geolocation);
 }
 
-void WebGeolocationClient::cancelPermissionRequest(Geolocation* geolocation)
+void WebGeolocationClient::cancelPermissionRequest(Geolocation& geolocation)
 {
-    m_page->geolocationPermissionRequestManager().cancelRequestForGeolocation(geolocation);
+    m_page.geolocationPermissionRequestManager().cancelRequestForGeolocation(geolocation);
 }
 
 } // namespace WebKit
index 3158e08..1977711 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebGeolocationClient_h
-#define WebGeolocationClient_h
+#pragma once
 
 #include <WebCore/GeolocationClient.h>
 
@@ -34,7 +33,7 @@ class WebPage;
 
 class WebGeolocationClient : public WebCore::GeolocationClient {
 public:
-    WebGeolocationClient(WebPage* page)
+    WebGeolocationClient(WebPage& page)
         : m_page(page)
     {
     }
@@ -50,13 +49,10 @@ private:
 
     WebCore::GeolocationPosition* lastPosition() override;
 
-    void requestPermission(WebCore::Geolocation*) override;
-    void cancelPermissionRequest(WebCore::Geolocation*) override;
+    void requestPermission(WebCore::Geolocation&) override;
+    void cancelPermissionRequest(WebCore::Geolocation&) override;
 
-
-    WebPage* m_page;
+    WebPage& m_page;
 };
 
 } // namespace WebKit
-
-#endif // WebGeolocationClient_h
index 0f820f7..68ccbef 100644 (file)
@@ -334,7 +334,7 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters)
     , m_findController(makeUniqueRef<FindController>(this))
     , m_userContentController(WebUserContentController::getOrCreate(parameters.userContentControllerID))
 #if ENABLE(GEOLOCATION)
-    , m_geolocationPermissionRequestManager(makeUniqueRef<GeolocationPermissionRequestManager>(this))
+    , m_geolocationPermissionRequestManager(makeUniqueRef<GeolocationPermissionRequestManager>(*this))
 #endif
 #if ENABLE(MEDIA_STREAM)
     , m_userMediaPermissionRequestManager { std::make_unique<UserMediaPermissionRequestManager>(*this) }
@@ -427,7 +427,7 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters)
     m_drawingArea->updatePreferences(parameters.store);
 
 #if ENABLE(GEOLOCATION)
-    WebCore::provideGeolocationTo(m_page.get(), new WebGeolocationClient(this));
+    WebCore::provideGeolocationTo(m_page.get(), *new WebGeolocationClient(*this));
 #endif
 #if ENABLE(NOTIFICATIONS)
     WebCore::provideNotification(m_page.get(), new WebNotificationClient(this));
index bea6cdb..d43f7dd 100644 (file)
@@ -113,7 +113,7 @@ public:
     template <typename T>
     void addSupplement()
     {
-        m_supplements.add(T::supplementName(), std::make_unique<T>(this));
+        m_supplements.add(T::supplementName(), std::make_unique<T>(*this));
     }
 
     WebConnectionToUIProcess* webConnectionToUIProcess() const { return m_webConnection.get(); }
index 1e895f8..0cf72d3 100644 (file)
@@ -152,8 +152,8 @@ private:
     Deque<ApplyConstraintsCallback> m_pendingApplyConstraintsCallbacks;
 };
 
-UserMediaCaptureManager::UserMediaCaptureManager(WebProcess* process)
-    : m_process(*process)
+UserMediaCaptureManager::UserMediaCaptureManager(WebProcess& process)
+    : m_process(process)
 {
     m_process.addMessageReceiver(Messages::UserMediaCaptureManager::messageReceiverName(), *this);
 }
index 39a4f29..2dadec8 100644 (file)
@@ -44,7 +44,7 @@ class WebProcess;
 
 class UserMediaCaptureManager : public WebProcessSupplement, public IPC::MessageReceiver, public WebCore::RealtimeMediaSource::AudioCaptureFactory, public WebCore::RealtimeMediaSource::VideoCaptureFactory {
 public:
-    explicit UserMediaCaptureManager(WebProcess*);
+    explicit UserMediaCaptureManager(WebProcess&);
     ~UserMediaCaptureManager();
 
     static const char* supplementName();
index 7e51eba..71deb39 100644 (file)
@@ -1,3 +1,20 @@
+2017-09-07  Alex Christensen  <achristensen@webkit.org>
+
+        Modernize Geolocation code
+        https://bugs.webkit.org/show_bug.cgi?id=176496
+
+        Reviewed by Andy Estes.
+
+        * WebCoreSupport/WebGeolocationClient.h:
+        * WebCoreSupport/WebGeolocationClient.mm:
+        (WebGeolocationClient::requestPermission):
+        (-[WebGeolocationPolicyListener initWithGeolocation:]):
+        (-[WebGeolocationPolicyListener initWithGeolocation:forWebView:]):
+        (-[WebGeolocationProviderInitializationListener initWithGeolocation:]):
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (-[WebView _geolocationDidFailWithMessage:]):
+
 2017-09-05  Tim Horton  <timothy_horton@apple.com>
 
         Remove some unused bits of code and resources
index 4bb2cdb..3360249 100644 (file)
@@ -49,8 +49,8 @@ public:
 
     WebCore::GeolocationPosition* lastPosition() override;
 
-    void requestPermission(WebCore::Geolocation*) override;
-    void cancelPermissionRequest(WebCore::Geolocation*) override { };
+    void requestPermission(WebCore::Geolocation&) override;
+    void cancelPermissionRequest(WebCore::Geolocation&) override { };
 
 private:
     WebView *m_webView;
index 1f7aaab..0cb2be9 100644 (file)
@@ -50,7 +50,7 @@ using namespace WebCore;
 {
     RefPtr<Geolocation> _geolocation;
 }
-- (id)initWithGeolocation:(Geolocation*)geolocation;
+- (id)initWithGeolocation:(Geolocation&)geolocation;
 @end
 #else
 @interface WebGeolocationPolicyListener : NSObject <WebAllowDenyPolicyListener>
@@ -67,7 +67,7 @@ using namespace WebCore;
 @private
     RefPtr<Geolocation> m_geolocation;
 }
-- (id)initWithGeolocation:(Geolocation*)geolocation;
+- (id)initWithGeolocation:(Geolocation&)geolocation;
 @end
 #endif
 
@@ -100,21 +100,21 @@ void WebGeolocationClient::setEnableHighAccuracy(bool wantsHighAccuracy)
 }
 #endif
 
-void WebGeolocationClient::requestPermission(Geolocation* geolocation)
+void WebGeolocationClient::requestPermission(Geolocation& geolocation)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
     SEL selector = @selector(webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener:);
     if (![[m_webView UIDelegate] respondsToSelector:selector]) {
-        geolocation->setIsAllowed(false);
+        geolocation.setIsAllowed(false);
         return;
     }
 
 #if !PLATFORM(IOS)
-    Frame *frame = geolocation->frame();
+    Frame *frame = geolocation.frame();
 
     if (!frame) {
-        geolocation->setIsAllowed(false);
+        geolocation.setIsAllowed(false);
         return;
     }
 
@@ -140,11 +140,11 @@ GeolocationPosition* WebGeolocationClient::lastPosition()
 #if !PLATFORM(IOS)
 @implementation WebGeolocationPolicyListener
 
-- (id)initWithGeolocation:(Geolocation*)geolocation
+- (id)initWithGeolocation:(Geolocation&)geolocation
 {
     if (!(self = [super init]))
         return nil;
-    _geolocation = geolocation;
+    _geolocation = &geolocation;
     return self;
 }
 
@@ -206,11 +206,11 @@ GeolocationPosition* WebGeolocationClient::lastPosition()
 @end
 
 @implementation WebGeolocationProviderInitializationListener
-- (id)initWithGeolocation:(Geolocation*)geolocation
+- (id)initWithGeolocation:(Geolocation&)geolocation
 {
     self = [super init];
     if (self)
-        m_geolocation = geolocation;
+        m_geolocation = &geolocation;
     return self;
 }
 
index fe1905a..c7233be 100644 (file)
@@ -1454,7 +1454,7 @@ static void WebKitInitializeGamepadProviderIfNecessary()
     _private->page->setGroupName(groupName);
 
 #if ENABLE(GEOLOCATION)
-    WebCore::provideGeolocationTo(_private->page, new WebGeolocationClient(self));
+    WebCore::provideGeolocationTo(_private->page, *new WebGeolocationClient(self));
 #endif
 #if ENABLE(NOTIFICATIONS)
     WebCore::provideNotification(_private->page, new WebNotificationClient(self));
@@ -9984,7 +9984,7 @@ static NSTextAlignment nsTextAlignmentFromRenderStyle(const RenderStyle* style)
 {
 #if ENABLE(GEOLOCATION)
     if (_private && _private->page) {
-        RefPtr<GeolocationError> geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage);
+        auto geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage);
         WebCore::GeolocationController::from(_private->page)->errorOccurred(geolocatioError.get());
     }
 #endif // ENABLE(GEOLOCATION)
index 751af1d..589e8bb 100644 (file)
@@ -1,3 +1,20 @@
+2017-09-07  Alex Christensen  <achristensen@webkit.org>
+
+        Modernize Geolocation code
+        https://bugs.webkit.org/show_bug.cgi?id=176496
+
+        Reviewed by Andy Estes.
+
+        * WebCoreSupport/WebGeolocationClient.cpp:
+        (WebGeolocationClient::requestPermission):
+        * WebCoreSupport/WebGeolocationClient.h:
+        (WebGeolocationClient::setEnableHighAccuracy): Deleted.
+        (WebGeolocationClient::cancelPermissionRequest): Deleted.
+        * WebGeolocationPolicyListener.h:
+        * WebView.cpp:
+        (WebView::initWithFrame):
+        (WebView::geolocationDidFailWithError):
+
 2017-09-07  Per Arne Vollan  <pvollan@apple.com>
 
         [Win] Enable DatatransferItems in DRT.
index 20b6de8..ba286c8 100644 (file)
@@ -75,26 +75,26 @@ GeolocationPosition* WebGeolocationClient::lastPosition()
     return core(position.get());
 }
 
-void WebGeolocationClient::requestPermission(Geolocation* geolocation)
+void WebGeolocationClient::requestPermission(Geolocation& geolocation)
 {
     COMPtr<IWebUIDelegate> uiDelegate;
     if (FAILED(m_webView->uiDelegate(&uiDelegate))) {
-        geolocation->setIsAllowed(false);
+        geolocation.setIsAllowed(false);
         return;
     }
 
     COMPtr<IWebUIDelegatePrivate2> uiDelegatePrivate2(Query, uiDelegate);
     if (!uiDelegatePrivate2) {
-        geolocation->setIsAllowed(false);
+        geolocation.setIsAllowed(false);
         return;
     }
 
-    Frame* frame = geolocation->frame();
+    Frame* frame = geolocation.frame();
     COMPtr<WebSecurityOrigin> origin(AdoptCOM, WebSecurityOrigin::createInstance(&frame->document()->securityOrigin()));
-    COMPtr<WebGeolocationPolicyListener> listener = WebGeolocationPolicyListener::createInstance(geolocation);
+    COMPtr<WebGeolocationPolicyListener> listener = WebGeolocationPolicyListener::createInstance(&geolocation);
     HRESULT hr = uiDelegatePrivate2->decidePolicyForGeolocationRequest(m_webView.get(), kit(frame), origin.get(), listener.get());
     if (hr != E_NOTIMPL)
         return;
 
-    geolocation->setIsAllowed(false);
+    geolocation.setIsAllowed(false);
 }
index 2bd29af..7b1bf48 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebGeolocationClient_h
-#define WebGeolocationClient_h
+#pragma once
 
 #include <WebCore/COMPtr.h>
 #include <WebCore/GeolocationClient.h>
@@ -40,17 +39,15 @@ class WebGeolocationClient : public WebCore::GeolocationClient {
 public:
     WebGeolocationClient(WebView*);
 
-    virtual void geolocationDestroyed();
-    virtual void startUpdating();
-    virtual void stopUpdating();
-    virtual void setEnableHighAccuracy(bool) { }
-    virtual WebCore::GeolocationPosition* lastPosition();
+    void geolocationDestroyed() final;
+    void startUpdating() final;
+    void stopUpdating() final;
+    void setEnableHighAccuracy(bool) final { }
+    WebCore::GeolocationPosition* lastPosition() final;
 
-    virtual void requestPermission(WebCore::Geolocation*);
-    virtual void cancelPermissionRequest(WebCore::Geolocation*) { }
+    void requestPermission(WebCore::Geolocation&) final;
+    void cancelPermissionRequest(WebCore::Geolocation&) final { }
 
 private:
     COMPtr<WebView> m_webView;
 };
-
-#endif // WebGeolocationClient_h
index 07f9afe..2a499b1 100644 (file)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef WebGeolocationPolicyListener_h
-#define WebGeolocationPolicyListener_h
+#pragma once
 
 #include "WebKit.h"
 #include <WebCore/COMPtr.h>
@@ -54,5 +53,3 @@ private:
     ULONG m_refCount { 0 };
     RefPtr<WebCore::Geolocation> m_geolocation;
 };
-
-#endif WebGeolocationPolicyListener_h
index c8de512..09e4161 100644 (file)
@@ -3121,7 +3121,7 @@ HRESULT WebView::initWithFrame(RECT frame, _In_ BSTR frameName, _In_ BSTR groupN
     configuration.pluginInfoProvider = &WebPluginInfoProvider::singleton();
 
     m_page = new Page(WTFMove(configuration));
-    provideGeolocationTo(m_page, new WebGeolocationClient(this));
+    provideGeolocationTo(m_page, *new WebGeolocationClient(this));
 
     unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout;
     m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones));
@@ -7249,7 +7249,7 @@ HRESULT WebView::geolocationDidFailWithError(_In_opt_ IWebError* error)
     if (FAILED(error->localizedDescription(&description)))
         return E_FAIL;
 
-    RefPtr<GeolocationError> geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, toString(description));
+    auto geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, toString(description));
     GeolocationController::from(m_page)->errorOccurred(geolocationError.get());
     return S_OK;
 }