WebCore/ChangeLog

 12008-10-29 Greg Bolsinga <bolsinga@apple.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 WARNING: NO TEST CASES ADDED OR CHANGED
 6
 7 * page/Geolocation.cpp:
 8 (WebCore::Geolocation::clearWatch):
 9 (WebCore::Geolocation::suspend):
 10 (WebCore::Geolocation::resume):
 11 (WebCore::Geolocation::geolocationServicePositionChanged):
 12 * page/Geolocation.h:
 13 (WebCore::Geolocation::hasListeners):
 14 (WebCore::GeolocationService::suspend):
 15 (WebCore::GeolocationService::resume):
 16
1172008-10-29 Gustavo Noronha Silva <gns@gnome.org>
218
319 Reviewed and slightly changed by Holger Freyther.
37988

WebCore/page/Geolocation.cpp

@@void Geolocation::clearWatch(int watchId
105105{
106106 m_watchers.remove(watchId);
107107
108  stopUpdatingIfEmpty();
 108 if (!hasListeners())
 109 m_service->stopUpdating();
109110}
110111
111 void Geolocation::stopUpdatingIfEmpty()
 112void Geolocation::suspend()
112113{
113  if (m_watchers.isEmpty() && m_oneShots.isEmpty())
114  m_service->stopUpdating();
 114 if (hasListeners())
 115 m_service->suspend();
 116}
 117
 118void Geolocation::resume()
 119{
 120 if (hasListeners())
 121 m_service->resume();
115122}
116123
117124void Geolocation::sendErrorToOneShots(PositionError* error)

@@void Geolocation::geolocationServicePosi
200207 sendPositionToWatchers(service->lastPosition());
201208
202209 m_oneShots.clear();
203  stopUpdatingIfEmpty();
 210
 211 if (!hasListeners())
 212 m_service->stopUpdating();
204213}
205214
206215void Geolocation::geolocationServiceErrorOccurred(GeolocationService* service)
37988

WebCore/page/Geolocation.h

@@public:
5858 int watchPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PositionOptions*);
5959 void clearWatch(int watchId);
6060
 61 void suspend();
 62 void resume();
 63
6164private:
6265 Geolocation(Frame*);
6366

@@private:
7578 GeoNotifier(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PositionOptions*);
7679 };
7780
78  void stopUpdatingIfEmpty();
 81 bool hasListeners() const { return !m_oneShots.isEmpty() || !m_watchers.isEmpty(); }
7982
8083 void sendErrorToOneShots(PositionError*);
8184 void sendErrorToWatchers(PositionError*);
37988

WebCore/platform/GeolocationService.h

@@public:
5050 virtual bool startUpdating(PositionOptions*) { return false; }
5151 virtual void stopUpdating() {}
5252
 53 virtual void suspend() { }
 54 virtual void resume() { }
 55
5356 virtual Geoposition* lastPosition() const { return 0; }
5457 virtual PositionError* lastError() const { return 0; }
5558
37988