no? we make the code simpler and easier to follow, avoiding jumping up and down all the time. Another approach would be the opposite, move all the handling to the object itself, leaving the callbacks with a single line, for example:
> Source/WebCore/platform/geoclue/GeolocationProviderGeoclue2.cpp:162
> + // Geoclue2 requires the client to provide a desktop ID for security
> + // reasons, which should identify the application requesting the location.
> + CString programName = getCurrentExecutablePath();
> + gclue_client_set_desktop_id(m_clientProxy.get(), basename(programName.data()));
So, I guess the program name works as desktop file id in the end? or is it just a workaround? Wouldn't it be easier to directly use g_get_prgname() that returns a const char *?
Comment on attachment 225788
Patch proposal
View in context: https:/ /bugs.webkit. org/attachment. cgi?id= 225788& action= review
> Source/ WebCore/ platform/ geoclue/ GeolocationProv iderGeoclue. h:28 WTFString. h>
> +#include <wtf/text/
Why are you adding this? I don't see any String used by this header.
> Source/ WebCore/ platform/ geoclue/ GeolocationProv iderGeoclue2. cpp:50
> + , m_managerProxy(0)
> + , m_clientProxy(0)
You don't need to initialize GRefPtr, and in case of doing so, use nullptr instead of 0
> Source/ WebCore/ platform/ geoclue/ GeolocationProv iderGeoclue2. cpp:118 >setGeoclueMana gerProxyAndGetC lient(managerPr oxy);
> + provider-
The idea of using static memebers for callbacks was also to simplify this, and clarify the ownership. I think now you can directly here do
provider- >m_managerProxy = adoptGRef( gclue_manager_ proxy_new_ for_bus_ finish( result, &error.outPtr())); >errorOccurred( error-> message) ;
if (error) {
provider-
return;
}
gclue_manager_ call_get_ client( provider- >m_managerProxy .get(), nullptr, reinterpret_ cast<GAsyncRead yCallback> (getGeoclueClie ntCallback) , provider);
no? we make the code simpler and easier to follow, avoiding jumping up and down all the time. Another approach would be the opposite, move all the handling to the object itself, leaving the callbacks with a single line, for example:
provider- >handleGeoclueM anagerProxyCrea ted(result) ;
> Source/ WebCore/ platform/ geoclue/ GeolocationProv iderGeoclue2. cpp:162 tablePath( ); set_desktop_ id(m_clientProx y.get() , basename( programName. data()) );
> + // Geoclue2 requires the client to provide a desktop ID for security
> + // reasons, which should identify the application requesting the location.
> + CString programName = getCurrentExecu
> + gclue_client_
So, I guess the program name works as desktop file id in the end? or is it just a workaround? Wouldn't it be easier to directly use g_get_prgname() that returns a const char *?