From 8e465e3d03d149943a3e592c3d2af395d50917eb Mon Sep 17 00:00:00 2001 From: Steve Block Date: Tue, 13 Oct 2009 11:46:22 +0100 Subject: [PATCH] Merge webkit.org at R49305 : Update Geolocation to use new EventListener methods. See http://trac.webkit.org/changeset/48402, http://trac.webkit.org/changeset/48701 and http://trac.webkit.org/changeset/48767 Change-Id: Id32d80c62f71c98c6677d7cbe11ee2ffbdaeeff1 --- WebCore/dom/EventListener.h | 3 ++- WebCore/page/Geolocation.cpp | 25 +++++++++++++++++-------- WebCore/page/Geolocation.h | 3 ++- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/WebCore/dom/EventListener.h b/WebCore/dom/EventListener.h index f834b3121..da9d1796f 100644 --- a/WebCore/dom/EventListener.h +++ b/WebCore/dom/EventListener.h @@ -41,7 +41,8 @@ namespace WebCore { InspectorDOMAgentType, InspectorDOMStorageResourceType, ObjCEventListenerType, - ConditionEventListenerType }; + ConditionEventListenerType, + GeolocationEventListenerType }; virtual ~EventListener() { } virtual bool operator==(const EventListener&) = 0; diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp index bf877e6b7..fd386147d 100644 --- a/WebCore/page/Geolocation.cpp +++ b/WebCore/page/Geolocation.cpp @@ -241,7 +241,8 @@ String CachedPositionManager::s_databaseFile; Geolocation::Geolocation(Frame* frame) - : m_frame(frame) + : EventListener(GeolocationEventListenerType) + , m_frame(frame) , m_service(GeolocationService::create(this)) , m_allowGeolocation(Unknown) , m_shouldClearCache(false) @@ -563,14 +564,22 @@ void Geolocation::geolocationServiceErrorOccurred(GeolocationService* service) handleError(service->lastError()); } -void Geolocation::handleEvent(Event* event, bool) +bool Geolocation::operator==(const EventListener& listener) { - ASSERT_UNUSED(event, event->type() == eventTypes().unloadEvent); - // Cancel any ongoing requests on page unload. This is required to release - // references to JS callbacks in the page, to allow the frame to be cleaned up - // by WebKit. - m_oneShots.clear(); - m_watchers.clear(); + if (listener.type() != GeolocationEventListenerType) + return false; + const Geolocation* geolocation = static_cast(&listener); + return m_frame == geolocation->m_frame; +} + +void Geolocation::handleEvent(ScriptExecutionContext*, Event* event) +{ + ASSERT_UNUSED(event, event->type() == eventTypes().unloadEvent); + // Cancel any ongoing requests on page unload. This is required to release + // references to JS callbacks in the page, to allow the frame to be cleaned up + // by WebKit. + m_oneShots.clear(); + m_watchers.clear(); } void Geolocation::setDatabasePath(String databasePath) diff --git a/WebCore/page/Geolocation.h b/WebCore/page/Geolocation.h index 9b3b43f3f..401189b6f 100644 --- a/WebCore/page/Geolocation.h +++ b/WebCore/page/Geolocation.h @@ -120,7 +120,8 @@ private: virtual void geolocationServiceErrorOccurred(GeolocationService*); // EventListener - virtual void handleEvent(Event*, bool isWindowEvent); + virtual bool operator==(const EventListener&); + virtual void handleEvent(ScriptExecutionContext*, Event*); void fatalErrorOccurred(GeoNotifier* notifier); void requestTimedOut(GeoNotifier* notifier); -- 2.11.0