Bug 175322

Summary: [WPE] Implement WebsiteDataStore::defaultApplicationCacheDirectory() and friends
Product: WebKit Reporter: Adrian Perez <aperez>
Component: WPE WebKitAssignee: Adrian Perez <aperez>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, bburg, beidson, bugs-noreply, cgarcia, clopez, mcatanzaro, zan
Priority: P2    
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch cgarcia: review+, cgarcia: commit-queue-

Description Adrian Perez 2017-08-08 07:22:22 PDT
These are unimplemented, “APIWebsiteDataStore.cpp” has guards

  #if !PLATFORM(COCOA) && !PLATFORM(GTK)

which means that WPE is using the empty implementations. I think the
best way to go about this is renaming the GTK+ port implementation to
“APIWebsiteDataStoreGLib.cpp” file. That would be used both by the GTK+
and WPE ports, with a preprocessor switch inside the file to choose
the name of the base directory being used. Something in the lines of:

  #if PLATFORM(GTK)
  # define PLATFORM_DIR_BASE "webkitgtk"
  #elif PLATFORM(WPE)
  # define PLATFORM_DIR_BASE "wpe"
  #else
  # error Invalid platform
  #endif 

and then use the definition in the functions.
Comment 1 Adrian Perez 2017-08-08 07:41:06 PDT
Created attachment 317568 [details]
Patch
Comment 2 Adrian Perez 2017-08-08 07:43:02 PDT
Created attachment 317571 [details]
Patch
Comment 3 Carlos Garcia Campos 2017-08-08 08:04:24 PDT
Comment on attachment 317571 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317571&action=review

> Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp:91
> -#if !PLATFORM(COCOA) && !PLATFORM(GTK)
> +#if !PLATFORM(COCOA) && !PLATFORM(GTK) && !PLATFORM(WPE)
>  WebKit::WebsiteDataStore::Configuration WebsiteDataStore::defaultDataStoreConfiguration()

This is now dead code then, I think we can just remove it.

> Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:32
> +# define PLATFORM_DIR_BASE "webkitgtk" G_DIR_SEPARATOR_S

Remove the space between # and define. I would call this BASE_DIRECTORY.

> Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:55
> +    return websiteDataDirectoryFileSystemRepresentation(PLATFORM_DIR_BASE "databases" G_DIR_SEPARATOR_S "indexeddb");

This look weird now, I think it's better not to include G_DIR_SEPARATOR_S as part of BASE_DIRECTORY macro
Comment 4 Adrian Perez 2017-08-08 08:44:01 PDT
Created attachment 317574 [details]
Patch
Comment 5 Adrian Perez 2017-08-08 08:50:37 PDT
(In reply to Carlos Garcia Campos from comment #3)
> Comment on attachment 317571 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=317571&action=review
> 
> > Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp:91
> > -#if !PLATFORM(COCOA) && !PLATFORM(GTK)
> > +#if !PLATFORM(COCOA) && !PLATFORM(GTK) && !PLATFORM(WPE)
> >  WebKit::WebsiteDataStore::Configuration WebsiteDataStore::defaultDataStoreConfiguration()
> 
> This is now dead code then, I think we can just remove it.

I think you are right, the new version of the patch also removes it.

At some point later on probably we would want to implement the missing
“WebsiteDataStore::defaultMediaCacheDirectory()” (that's bug #156369),
or is it unused in the GTK+ and WPE ports?

> > Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:32
> > +# define PLATFORM_DIR_BASE "webkitgtk" G_DIR_SEPARATOR_S
> 
> Remove the space between # and define. I would call this BASE_DIRECTORY.

Done.
 
> > Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:55
> > +    return websiteDataDirectoryFileSystemRepresentation(PLATFORM_DIR_BASE "databases" G_DIR_SEPARATOR_S "indexeddb");
> 
> This look weird now, I think it's better not to include G_DIR_SEPARATOR_S as
> part of BASE_DIRECTORY macro

This is changed in the updated patch, too.
Comment 6 Carlos Garcia Campos 2017-08-08 08:53:42 PDT
Comment on attachment 317574 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317574&action=review

> Source/WebKit/ChangeLog:22
> +2017-08-08  Adrian Perez de Castro  <aperez@igalia.com>

Double changelog.

> Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:37
> +#else
> +#error Invalid platform
> +#endif

forgot to say before, sorry, but don't do this, it will fail to compile anyway.
Comment 7 Adrian Perez 2017-08-08 09:49:23 PDT
Committed r220408: <http://trac.webkit.org/changeset/220408>