Thanks for the patch, Anton. It looks quite well already, but there's definitely more work to do (e.g. tests) so setting r- for now.
Also, I really think some more people familiar with these part of the code should review it, specially when it comes to how to incorporate this into trunk.
I'd rather use "Geoclue2" as the generated namespace instead of the cut-down version "GClue".
Anyway, I'm not sure enough about this bit since I feel like I lack some information to provide a proper review. Thus, I'd rather have someone else reviewing the changes in this file.
> Source/WebCore/platform/geoclue2/GeolocationProviderGeoclue2.cpp:221
> +void GeolocationProviderGeoclue2::updateClientRequirements()
> +{
> + // FIXME: implement when accuracy API is available
> +}
If this is is an optional feature, I'd rather leave this function out of the patch. However, according to the W3C spec, accuracy does not seem like optional:
"6.2.2 The Geolocation API must provide information about the accuracy of the retrieved location data."
In any case, later in this patch you use a call to gclue_location_get_accuracy() so I'm not entirely sure about what you mean with this FIXME here
You do not need to make this callbacks static members of this class, just static functions in the implementation file (C-style) or, even better, private functions in the implementation file members of an unnamed namespace
Comment on attachment 212180
Patch
View in context: https:/ /bugs.webkit. org/attachment. cgi?id= 212180& action= review
Thanks for the patch, Anton. It looks quite well already, but there's definitely more work to do (e.g. tests) so setting r- for now.
Also, I really think some more people familiar with these part of the code should review it, specially when it comes to how to incorporate this into trunk.
> Source/ Platform/ ChangeLog: 8
> +
> + * GNUmakefile.am:
You need at least a short description for the change here. Same consideration applies to the other ChangeLogs
> Source/ WebCore/ GNUmakefile. am:375 /geoclue2/ geoclue- interface. c: DerivedSources/ geoclue2/ geoclue- interface. h /geoclue2/ geoclue- interface. h: GEN)gdbus- codegen --interface-prefix org.freedesktop .GeoClue2. --c-namespace GClue --generate-c-code DerivedSources/ geoclue2/ geoclue- interface $(GEOCLUE_ DBUS_INTERFACE)
> +# Geoclue interface
> +DerivedSources
> +DerivedSources
> + $(AM_V_
> +endif
I'd rather use "Geoclue2" as the generated namespace instead of the cut-down version "GClue".
Anyway, I'm not sure enough about this bit since I feel like I lack some information to provide a proper review. Thus, I'd rather have someone else reviewing the changes in this file.
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:66 iderGeoclue2: :start( )
> +void GeolocationProv
I would rename this function to something more descriptive, such as startGeoclueClient or startGeoclueSub system
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:72
> + if (!manager())
> + return;
> +
> + if (!client())
> + return;
You probably can combine this two in one if
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:74
> + // Set the requirement for the client
Missing period.
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:76 call_start( m_clientProxy. get(), 0, onStart, this);
> + gclue_client_
What happens here if m_clientProxy is not valid? Shouldn't we control that situation if that's a possibility or just ASSERT for non-null otherwise?
Also, "onStart" looks like to me like a too simple name for the callback. What about something like geoclueClientSt artCallback?
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:79 iderGeoclue2: :stop()
> +void GeolocationProv
I would also rename this function to something more descriptive, such as stopGeoclueClient or stopGeoclueSubs ystem
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:85 .clear( ); clear() ;
> + m_locationProxy
> + m_clientProxy.
Shouldn't you better do this on a callback for gclue_client_ call_stop?
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:108 iderGeoclue2: :onManagerProxy Ready(GObject *sourceObject, GAsyncResult *result, void* self)
> +void GeolocationProv
Wrong placement for *
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:110
> + GOwnPtr<GError> error;
Define this variable right before you need it (after the if)
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:117 >errorOccurred( String( "Failed to create Geoclue manager: ") + error->message);
> + provider-
You can use String::format() for this, or the StringBuilder class if you're planning to concatenate many things (which does not seem to be the case)
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:124 iderGeoclue2: :manager( )
> +GClueManager* GeolocationProv
What about using geoclueManager() as the name?
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:130 proxy_new_ for_bus( G_BUS_TYPE_ SYSTEM, G_DBUS_ PROXY_FLAGS_ NONE, GEOCLUE_BUS_NAME, GEOCLUE_ MANAGER_ PATH, eady, this);
> + gclue_manager_
> + 0, onManagerProxyR
You can make this one a single line
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:137
> + GOwnPtr<GError> error;
> + GOwnPtr<gchar> path;
Move this definitions down, right before you need it.
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:143 >errorOccurred( String( "Failed to get client: ") + error->message);
> + provider-
String::format()
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:148 proxy_new_ for_bus( G_BUS_TYPE_ SYSTEM, G_DBUS_ PROXY_FLAGS_ NONE, GEOCLUE_BUS_NAME, path.get(),
> + gclue_client_
> + 0, onClientProxyReady, self);
One line
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:151 iderGeoclue2: :client( )
> +GClueClient* GeolocationProv
What about using geoclueClient() as the name?
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:158 call_get_ client( m_managerProxy. get(), 0, onGetClientReady, this);
> + gclue_manager_
For the sake of consistency, I would call the callback used here this something like geoclueManagerG etClientCallbac k
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:162 iderGeoclue2: :onClientProxyR eady(GObject *sourceObject, GAsyncResult *result, void* self)
> +void GeolocationProv
Wrong placement for *
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:164
> + GOwnPtr<GError> error;
Move this definition down
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:171 >errorOccurred( String( "Failed to get client proxy: ") + error->message);
> + provider-
String::format
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:176 connect( provider- >m_clientProxy. get(), "location-updated", onLocationUpdat ed), self);
> + g_signal_
> + G_CALLBACK(
One line
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:181 iderGeoclue2: :onLocationUpda ted(GClueClient *client, const gchar* oldPath, const gchar* newPath, void* self)
> +void GeolocationProv
Wrong placement for *
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:188 proxy_new_ for_bus( G_BUS_TYPE_ SYSTEM, G_DBUS_ PROXY_FLAGS_ NONE, GEOCLUE_BUS_NAME, newPath, Ready, self);
> + gclue_location_
> + 0, onLocationProxy
One line. And again, I would suggest another name for the callback. What about createGeoclueLo cationProxyCall back?
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:193
> + GOwnPtr<GError> error;
Move this down
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:199 >errorOccurred( String( "Failed to start: ") + error->message);
> + provider-
String::format
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:202 iderGeoclue2: :onLocationProx yReady( GObject *sourceObject, GAsyncResult *result, void* self)
> +void GeolocationProv
Wrong placement for *
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:204
> + GOwnPtr<GError> error;
Move this down
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:211 >errorOccurred( String( "Failed to create location proxy: ") + error->message);
> + provider-
String::format
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. cpp:221 iderGeoclue2: :updateClientRe quirements( )
> +void GeolocationProv
> +{
> + // FIXME: implement when accuracy API is available
> +}
If this is is an optional feature, I'd rather leave this function out of the patch. However, according to the W3C spec, accuracy does not seem like optional:
"6.2.2 The Geolocation API must provide information about the accuracy of the retrieved location data."
In any case, later in this patch you use a call to gclue_location_ get_accuracy( ) so I'm not entirely sure about what you mean with this FIXME here
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. h:31 p.GeoClue2" MANAGER_ PATH "/org/freedeskt op/GeoClue2/ Manager"
> +#define GEOCLUE_BUS_NAME "org.freedeskto
> +#define GEOCLUE_
You don't need this in the header file, just in the implementation file
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. h:50 iderGeoclue2Cli ent* m_client;
> + GeolocationProv
I would move this attribute declaration down after the private functions, together with the rest of private attributes
> Source/ WebCore/ platform/ geoclue2/ GeolocationProv iderGeoclue2. h:57 eady(GObject* , GAsyncResult*, void*); y(GObject* , GAsyncResult*, void*); ady(GObject* , GAsyncResult*, void*); ed(GClueClient* , const gchar*, const gchar*, void*); Ready(GObject* , GAsyncResult*, void*);
> + static void onManagerProxyR
> + static void onGetClientRead
> + static void onClientProxyRe
> + static void onStart(GObject*, GAsyncResult*, void*);
> + static void onStop(GObject*, GAsyncResult*, void*);
> + static void onLocationUpdat
> + static void onLocationProxy
You do not need to make this callbacks static members of this class, just static functions in the implementation file (C-style) or, even better, private functions in the implementation file members of an unnamed namespace
> Source/ WebKit/ gtk/WebCoreSupp ort/Geolocation ClientGtk. h:47 GEOCLUE_ API_VERSION_ 2) iderGeoclueClie nt GeolocationProv iderClient; iderGeoclue2Cli ent GeolocationProv iderClient;
> +#if !defined(
> namespace WebCore {
> class Geolocation;
> +typedef GeolocationProv
> +}
> +#else
> +namespace WebCore {
> +typedef GeolocationProv
> }
> +#endif
I think you still want the forward class declaration of Geolocation if using geoclue2, meaning that the only difference is the typedef.
What about something like this:
namespace WebCore {
class Geolocation;
#if !defined( GEOCLUE_ API_VERSION_ 2) iderGeoclueClie nt GeolocationProv iderClient; iderGeoclue2Cli ent GeolocationProv iderClient;
typedef GeolocationProv
#else
typedef GeolocationProv
#endif
}
> Tools/gtk/ jhbuild. modules: 33 "json-glib" />
> + <dep package=
> + <dep package="geoclue"/>
This should be moved to the list of optional modules, at least while it's meant to be an experimental thing.