From 6dbc5923f818f247f47a9b15533198c94d18b9a6 Mon Sep 17 00:00:00 2001 From: "eric@webkit.org" Date: Tue, 30 Mar 2010 13:27:34 +0000 Subject: [PATCH] 2010-03-30 Laszlo Gombos Reviewed by David Kilzer. Guard Geolocation files with ENABLE_GEOLOCATION https://bugs.webkit.org/show_bug.cgi?id=25756 The intent is to guard the Geolocation implementation files and minimize the impact on on clients/call sites. * DerivedSources.make: * WebCore.Geolocation.exp: Added. Exported interfaces if GEOLOCATION is enabled. * WebCore.base.exp: * bindings/js/JSCustomPositionCallback.cpp: * bindings/js/JSCustomPositionErrorCallback.cpp: * bindings/js/JSGeolocationCustom.cpp: * page/Geolocation.cpp: (WebCore::Geolocation::disconnectFrame): Stub implementation if GEOLOCATION is turned off. (WebCore::Geolocation::Geolocation): Ditto. (WebCore::Geolocation::~Geolocation): Ditto. (WebCore::Geolocation::setIsAllowed): Ditto. * page/Geolocation.h: * page/Geolocation.idl: * page/GeolocationPositionCache.cpp: * page/Geoposition.idl: * page/PositionError.idl: * platform/GeolocationService.cpp: * platform/mock/GeolocationServiceMock.cpp: 2010-03-30 Laszlo Gombos Reviewed by David Kilzer. Explicit guards for ENABLE_GEOLOCATION https://bugs.webkit.org/show_bug.cgi?id=25756 * WebCoreSupport/WebGeolocationMock.mm: (-[WebGeolocationMock setError:code:]): Make the body conditional on ENABLE(GEOLOCATION) (-[WebGeolocationMock setPosition:]): Ditto. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56781 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 31 +++++++++++++++++++ WebCore/DerivedSources.make | 4 +++ WebCore/WebCore.Geolocation.exp | 2 ++ WebCore/WebCore.base.exp | 2 -- .../bindings/js/JSCustomPositionCallback.cpp | 4 +++ .../js/JSCustomPositionErrorCallback.cpp | 4 +++ WebCore/bindings/js/JSGeolocationCustom.cpp | 4 +++ WebCore/page/Geolocation.cpp | 18 +++++++++++ WebCore/page/Geolocation.h | 6 ++-- WebCore/page/Geolocation.idl | 2 +- WebCore/page/GeolocationPositionCache.cpp | 4 +++ WebCore/page/Geoposition.idl | 2 +- WebCore/page/PositionError.idl | 2 +- WebCore/platform/GeolocationService.cpp | 3 ++ .../platform/mock/GeolocationServiceMock.cpp | 4 +++ WebKit/mac/ChangeLog | 12 +++++++ .../mac/WebCoreSupport/WebGeolocationMock.mm | 4 +++ 17 files changed, 101 insertions(+), 7 deletions(-) create mode 100644 WebCore/WebCore.Geolocation.exp diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index e561015a9dd..921bd94ed66 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,34 @@ +2010-03-30 Laszlo Gombos + + Reviewed by David Kilzer. + + Guard Geolocation files with ENABLE_GEOLOCATION + https://bugs.webkit.org/show_bug.cgi?id=25756 + + The intent is to guard the Geolocation implementation files + and minimize the impact on on clients/call sites. + + * DerivedSources.make: + * WebCore.Geolocation.exp: Added. Exported interfaces if GEOLOCATION + is enabled. + * WebCore.base.exp: + * bindings/js/JSCustomPositionCallback.cpp: + * bindings/js/JSCustomPositionErrorCallback.cpp: + * bindings/js/JSGeolocationCustom.cpp: + * page/Geolocation.cpp: + (WebCore::Geolocation::disconnectFrame): Stub implementation if + GEOLOCATION is turned off. + (WebCore::Geolocation::Geolocation): Ditto. + (WebCore::Geolocation::~Geolocation): Ditto. + (WebCore::Geolocation::setIsAllowed): Ditto. + * page/Geolocation.h: + * page/Geolocation.idl: + * page/GeolocationPositionCache.cpp: + * page/Geoposition.idl: + * page/PositionError.idl: + * platform/GeolocationService.cpp: + * platform/mock/GeolocationServiceMock.cpp: + 2010-03-30 Andrey Kosyakov Reviewed by Pavel Feldman. diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make index f828a6d3b99..3694270cec0 100644 --- a/WebCore/DerivedSources.make +++ b/WebCore/DerivedSources.make @@ -872,6 +872,10 @@ ifeq ($(findstring ENABLE_CLIENT_BASED_GEOLOCATION,$(FEATURE_DEFINES)), ENABLE_C WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.ClientBasedGeolocation.exp endif +ifeq ($(findstring ENABLE_GEOLOCATION,$(FEATURE_DEFINES)), ENABLE_GEOLOCATION) + WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.Geolocation.exp +endif + WebCore.exp : WebCore.base.exp $(WEBCORE_EXPORT_DEPENDENCIES) cat $^ > $@ diff --git a/WebCore/WebCore.Geolocation.exp b/WebCore/WebCore.Geolocation.exp new file mode 100644 index 00000000000..296c8aa3b50 --- /dev/null +++ b/WebCore/WebCore.Geolocation.exp @@ -0,0 +1,2 @@ +__ZN7WebCore22GeolocationServiceMock11setPositionEN3WTF10PassRefPtrINS_11GeopositionEEE +__ZN7WebCore22GeolocationServiceMock8setErrorEN3WTF10PassRefPtrINS_13PositionErrorEEE diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp index 8b6eb99f3b5..034d511bbd4 100644 --- a/WebCore/WebCore.base.exp +++ b/WebCore/WebCore.base.exp @@ -446,8 +446,6 @@ __ZN7WebCore21findEventWithKeyStateEPNS_5EventE __ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE __ZN7WebCore21mainThreadNormalWorldEv __ZN7WebCore21reportThreadViolationEPKcNS_20ThreadViolationRoundE -__ZN7WebCore22GeolocationServiceMock11setPositionEN3WTF10PassRefPtrINS_11GeopositionEEE -__ZN7WebCore22GeolocationServiceMock8setErrorEN3WTF10PassRefPtrINS_13PositionErrorEEE __ZN7WebCore22ScriptExecutionContext26canSuspendActiveDOMObjectsEv __ZN7WebCore22applicationIsAppleMailEv __ZN7WebCore22counterValueForElementEPNS_7ElementE diff --git a/WebCore/bindings/js/JSCustomPositionCallback.cpp b/WebCore/bindings/js/JSCustomPositionCallback.cpp index e5f83aa10d4..cc6d45cd261 100644 --- a/WebCore/bindings/js/JSCustomPositionCallback.cpp +++ b/WebCore/bindings/js/JSCustomPositionCallback.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "JSCustomPositionCallback.h" +#if ENABLE(GEOLOCATION) + #include "Frame.h" #include "JSGeoposition.h" #include "ScriptController.h" @@ -52,3 +54,5 @@ void JSCustomPositionCallback::handleEvent(Geoposition* geoposition) } } // namespace WebCore + +#endif // ENABLE(GEOLOCATION) diff --git a/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp b/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp index bd64deb48db..c94ae9aaa62 100644 --- a/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp +++ b/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "JSCustomPositionErrorCallback.h" +#if ENABLE(GEOLOCATION) + #include "Frame.h" #include "JSPositionError.h" #include "ScriptController.h" @@ -53,3 +55,5 @@ void JSCustomPositionErrorCallback::handleEvent(PositionError* positionError) } } // namespace WebCore + +#endif // ENABLE(GEOLOCATION) diff --git a/WebCore/bindings/js/JSGeolocationCustom.cpp b/WebCore/bindings/js/JSGeolocationCustom.cpp index 530b89bc685..8bc348ce00d 100644 --- a/WebCore/bindings/js/JSGeolocationCustom.cpp +++ b/WebCore/bindings/js/JSGeolocationCustom.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "JSGeolocation.h" +#if ENABLE(GEOLOCATION) + #include "DOMWindow.h" #include "ExceptionCode.h" #include "Geolocation.h" @@ -178,3 +180,5 @@ JSValue JSGeolocation::watchPosition(ExecState* exec, const ArgList& args) } } // namespace WebCore + +#endif // ENABLE(GEOLOCATION) diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp index 395da0aa9af..7dd47bb4497 100644 --- a/WebCore/page/Geolocation.cpp +++ b/WebCore/page/Geolocation.cpp @@ -28,6 +28,8 @@ #include "config.h" #include "Geolocation.h" +#if ENABLE(GEOLOCATION) + #include "Chrome.h" #include "Frame.h" #include "Page.h" @@ -639,3 +641,19 @@ void Geolocation::stopUpdating() } } // namespace WebCore + +#else + +namespace WebCore { + +void Geolocation::disconnectFrame() {} + +Geolocation::Geolocation(Frame*) {} + +Geolocation::~Geolocation() {} + +void Geolocation::setIsAllowed(bool) {} + +} + +#endif // ENABLE(GEOLOCATION) diff --git a/WebCore/page/Geolocation.h b/WebCore/page/Geolocation.h index c7b0bbdc2b4..2b67facecef 100644 --- a/WebCore/page/Geolocation.h +++ b/WebCore/page/Geolocation.h @@ -46,7 +46,7 @@ class GeolocationError; #endif class Geolocation : public RefCounted -#if !ENABLE(CLIENT_BASED_GEOLOCATION) +#if !ENABLE(CLIENT_BASED_GEOLOCATION) && ENABLE(GEOLOCATION) , public GeolocationServiceClient #endif { @@ -137,7 +137,7 @@ private: bool startUpdating(GeoNotifier*); void stopUpdating(); -#if !ENABLE(CLIENT_BASED_GEOLOCATION) +#if !ENABLE(CLIENT_BASED_GEOLOCATION) && ENABLE(GEOLOCATION) // GeolocationServiceClient virtual void geolocationServicePositionChanged(GeolocationService*); virtual void geolocationServiceErrorOccurred(GeolocationService*); @@ -171,7 +171,9 @@ private: } m_allowGeolocation; bool m_shouldClearCache; +#if ENABLE(GEOLOCATION) OwnPtr m_positionCache; +#endif GeoNotifierSet m_requestsAwaitingCachedPosition; }; diff --git a/WebCore/page/Geolocation.idl b/WebCore/page/Geolocation.idl index 58b219cfcfa..aa5b59f63d8 100644 --- a/WebCore/page/Geolocation.idl +++ b/WebCore/page/Geolocation.idl @@ -25,7 +25,7 @@ module core { - interface [OmitConstructor] Geolocation { + interface [Conditional=GEOLOCATION, OmitConstructor] Geolocation { [Custom] void getCurrentPosition(in PositionCallback successCallback, in PositionErrorCallback errorCallback, in PositionOptions options); [Custom] long watchPosition(in PositionCallback successCallback, in PositionErrorCallback errorCallback, in PositionOptions options); diff --git a/WebCore/page/GeolocationPositionCache.cpp b/WebCore/page/GeolocationPositionCache.cpp index 8567152ed96..06159f472df 100644 --- a/WebCore/page/GeolocationPositionCache.cpp +++ b/WebCore/page/GeolocationPositionCache.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "GeolocationPositionCache.h" +#if ENABLE(GEOLOCATION) + #include "Geoposition.h" #include "SQLValue.h" #include "SQLiteDatabase.h" @@ -172,3 +174,5 @@ void GeolocationPositionCache::writeToDB(const Geoposition* position) } } // namespace WebCore + +#endif // ENABLE(GEOLOCATION) diff --git a/WebCore/page/Geoposition.idl b/WebCore/page/Geoposition.idl index 6fa12ffd432..41a226285c3 100644 --- a/WebCore/page/Geoposition.idl +++ b/WebCore/page/Geoposition.idl @@ -25,7 +25,7 @@ module core { - interface [OmitConstructor] Geoposition { + interface [Conditional=GEOLOCATION, OmitConstructor] Geoposition { readonly attribute Coordinates coords; readonly attribute DOMTimeStamp timestamp; }; diff --git a/WebCore/page/PositionError.idl b/WebCore/page/PositionError.idl index 1f28d95e297..5870e0d32ba 100644 --- a/WebCore/page/PositionError.idl +++ b/WebCore/page/PositionError.idl @@ -25,7 +25,7 @@ module core { - interface PositionError { + interface [Conditional=GEOLOCATION] PositionError { readonly attribute unsigned short code; readonly attribute DOMString message; diff --git a/WebCore/platform/GeolocationService.cpp b/WebCore/platform/GeolocationService.cpp index 7e1f755790a..467600681f1 100644 --- a/WebCore/platform/GeolocationService.cpp +++ b/WebCore/platform/GeolocationService.cpp @@ -49,6 +49,7 @@ GeolocationService* GeolocationService::create(GeolocationServiceClient* client) return (*s_factoryFunction)(client); } +#if ENABLE(GEOLOCATION) void GeolocationService::useMock() { s_factoryFunction = &GeolocationServiceMock::create; @@ -70,4 +71,6 @@ void GeolocationService::errorOccurred() m_geolocationServiceClient->geolocationServiceErrorOccurred(this); } +#endif + } // namespace WebCore diff --git a/WebCore/platform/mock/GeolocationServiceMock.cpp b/WebCore/platform/mock/GeolocationServiceMock.cpp index f1871047c59..b254cb81276 100644 --- a/WebCore/platform/mock/GeolocationServiceMock.cpp +++ b/WebCore/platform/mock/GeolocationServiceMock.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "GeolocationServiceMock.h" +#if ENABLE(GEOLOCATION) + #include "Logging.h" #include "Geolocation.h" #include "Geoposition.h" @@ -134,3 +136,5 @@ void GeolocationServiceMock::cleanUpStatics() } } // namespace WebCore + +#endif diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index e7bf585fd4d..658e923f599 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,15 @@ +2010-03-30 Laszlo Gombos + + Reviewed by David Kilzer. + + Explicit guards for ENABLE_GEOLOCATION + https://bugs.webkit.org/show_bug.cgi?id=25756 + + * WebCoreSupport/WebGeolocationMock.mm: + (-[WebGeolocationMock setError:code:]): Make the body conditional on + ENABLE(GEOLOCATION) + (-[WebGeolocationMock setPosition:]): Ditto. + 2010-03-26 Kenneth Rohde Christiansen Reviewed by Antti Koivisto. diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm b/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm index 32e8d0d5362..1bdb616da86 100644 --- a/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm +++ b/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm @@ -38,6 +38,7 @@ using namespace WTF; + (void)setPosition:(double)latitude:(double)longitude:(double)accuracy { +#if ENABLE(GEOLOCATION) RefPtr coordinates = Coordinates::create(latitude, longitude, false, 0.0, // altitude @@ -47,13 +48,16 @@ using namespace WTF; false, 0.0); // speed RefPtr position = Geoposition::create(coordinates.release(), currentTime() * 1000.0); GeolocationServiceMock::setPosition(position.release()); +#endif } + (void)setError:(int)code:(NSString *)message { +#if ENABLE(GEOLOCATION) PositionError::ErrorCode codeEnum = static_cast(code); RefPtr error = PositionError::create(codeEnum, message); GeolocationServiceMock::setError(error.release()); +#endif } @end -- GitLab