diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp index a420b908f..7e18ac5da 100644 --- a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp @@ -26,9 +26,9 @@ #include "config.h" #include "WebGeolocationManagerProxy.h" -#include "WebContext.h" #include "WebGeolocationManagerMessages.h" #include "WebGeolocationManagerProxyMessages.h" +#include "WebProcessPool.h" namespace WebKit { @@ -37,15 +37,15 @@ const char* WebGeolocationManagerProxy::supplementName() return "WebGeolocationManagerProxy"; } -PassRefPtr<WebGeolocationManagerProxy> WebGeolocationManagerProxy::create(WebContext* context) +PassRefPtr<WebGeolocationManagerProxy> WebGeolocationManagerProxy::create(WebProcessPool* processPool) { - return adoptRef(new WebGeolocationManagerProxy(context)); + return adoptRef(new WebGeolocationManagerProxy(processPool)); } -WebGeolocationManagerProxy::WebGeolocationManagerProxy(WebContext* context) - : WebContextSupplement(context) +WebGeolocationManagerProxy::WebGeolocationManagerProxy(WebProcessPool* processPool) + : WebContextSupplement(processPool) { - WebContextSupplement::context()->addMessageReceiver(Messages::WebGeolocationManagerProxy::messageReceiverName(), *this); + WebContextSupplement::processPool()->addMessageReceiver(Messages::WebGeolocationManagerProxy::messageReceiverName(), *this); } void WebGeolocationManagerProxy::initializeProvider(const WKGeolocationProviderBase* provider) @@ -55,10 +55,14 @@ void WebGeolocationManagerProxy::initializeProvider(const WKGeolocationProviderB // WebContextSupplement -void WebGeolocationManagerProxy::contextDestroyed() +void WebGeolocationManagerProxy::processPoolDestroyed() { + bool wasUpdating = isUpdating(); m_updateRequesters.clear(); - m_provider.stopUpdating(this); + + ASSERT(!isUpdating()); + if (wasUpdating) + m_provider.stopUpdating(this); } void WebGeolocationManagerProxy::processDidClose(WebProcessProxy* webProcessProxy) @@ -78,40 +82,40 @@ void WebGeolocationManagerProxy::derefWebContextSupplement() void WebGeolocationManagerProxy::providerDidChangePosition(WebGeolocationPosition* position) { - if (!context()) + if (!processPool()) return; - context()->sendToAllProcesses(Messages::WebGeolocationManager::DidChangePosition(position->data())); + processPool()->sendToAllProcesses(Messages::WebGeolocationManager::DidChangePosition(position->data())); } void WebGeolocationManagerProxy::providerDidFailToDeterminePosition(const String& errorMessage) { - if (!context()) + if (!processPool()) return; - context()->sendToAllProcesses(Messages::WebGeolocationManager::DidFailToDeterminePosition(errorMessage)); + processPool()->sendToAllProcesses(Messages::WebGeolocationManager::DidFailToDeterminePosition(errorMessage)); } #if PLATFORM(IOS) void WebGeolocationManagerProxy::resetPermissions() { - context()->sendToAllProcesses(Messages::WebGeolocationManager::ResetPermissions()); + processPool()->sendToAllProcesses(Messages::WebGeolocationManager::ResetPermissions()); } #endif -void WebGeolocationManagerProxy::startUpdating(IPC::Connection* connection) +void WebGeolocationManagerProxy::startUpdating(IPC::Connection& connection) { bool wasUpdating = isUpdating(); - m_updateRequesters.add(connection->client()); + m_updateRequesters.add(&connection.client()); if (!wasUpdating) { m_provider.setEnableHighAccuracy(this, isHighAccuracyEnabled()); m_provider.startUpdating(this); } } -void WebGeolocationManagerProxy::stopUpdating(IPC::Connection* connection) +void WebGeolocationManagerProxy::stopUpdating(IPC::Connection& connection) { - removeRequester(connection->client()); + removeRequester(&connection.client()); } void WebGeolocationManagerProxy::removeRequester(const IPC::Connection::Client* client) @@ -131,14 +135,14 @@ void WebGeolocationManagerProxy::removeRequester(const IPC::Connection::Client* } } -void WebGeolocationManagerProxy::setEnableHighAccuracy(IPC::Connection* connection, bool enabled) +void WebGeolocationManagerProxy::setEnableHighAccuracy(IPC::Connection& connection, bool enabled) { bool highAccuracyWasEnabled = isHighAccuracyEnabled(); if (enabled) - m_highAccuracyRequesters.add(connection->client()); + m_highAccuracyRequesters.add(&connection.client()); else - m_highAccuracyRequesters.remove(connection->client()); + m_highAccuracyRequesters.remove(&connection.client()); bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled(); if (isUpdating() && highAccuracyWasEnabled != highAccuracyShouldBeEnabled) |