Bug 125028 - [Curl] There is no way to specify cache folder.
Summary: [Curl] There is no way to specify cache folder.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-30 04:46 PST by peavo
Modified: 2014-01-23 10:16 PST (History)
4 users (show)

See Also:


Attachments
Patch (1.28 KB, patch)
2013-11-30 04:50 PST, peavo
no flags Details | Formatted Diff | Diff
Patch (8.65 KB, patch)
2014-01-21 08:09 PST, peavo
no flags Details | Formatted Diff | Diff
Patch (8.63 KB, patch)
2014-01-21 13:35 PST, peavo
no flags Details | Formatted Diff | Diff
Patch (8.67 KB, patch)
2014-01-23 09:40 PST, peavo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description peavo 2013-11-30 04:46:03 PST
For a WebKit client app, there is no way to specify where the cache folder should be.
Comment 1 peavo 2013-11-30 04:50:27 PST
Created attachment 218091 [details]
Patch
Comment 2 Mátyás Mustoha 2013-12-02 02:08:42 PST
Hi,

Instead of WebCore, the Cache Manager should be turned on in WebKit, as the cache folder parameter may vary between different platforms.

For example, you can see how this is solved in Nix here:
https://github.com/WebKitNix/webkitnix/blob/master/Source/WebKit2/WebProcess/curl/WebProcessCurl.cpp
Comment 3 peavo 2014-01-21 08:09:22 PST
Created attachment 221747 [details]
Patch
Comment 4 peavo 2014-01-21 08:13:53 PST
(In reply to comment #2)
> Hi,
> 
> Instead of WebCore, the Cache Manager should be turned on in WebKit, as the cache folder parameter may vary between different platforms.
> 
> For example, you can see how this is solved in Nix here:
> https://github.com/WebKitNix/webkitnix/blob/master/Source/WebKit2/WebProcess/curl/WebProcessCurl.cpp

Thanks for looking into this :)

I updated the patch, added methods in the IWebCache interface to set and get cache folder location.
I also enabled the disc cache in WinLauncher by setting it's cache folder.
Comment 5 Brent Fulgham 2014-01-21 11:17:12 PST
Comment on attachment 221747 [details]
Patch

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

> Tools/WinLauncher/WinLauncher.cpp:394
> +static bool getAppDataFolder(std::wstring& directory)

Why not take a _bstr_t intend? Then you don't have to do all the conversion to/from std::wsting?

> Tools/WinLauncher/WinLauncher.cpp:448
> +    BSTR location = SysAllocString(appDataFolder.data());

If you use a _bstr_t you don't need to SysAlloc and SysFree manually. This is already used in WInLauncher.cpp, so it should build on all of our Windows targets.
Comment 6 peavo 2014-01-21 13:35:38 PST
Created attachment 221782 [details]
Patch
Comment 7 peavo 2014-01-21 13:37:44 PST
(In reply to comment #5)
> (From update of attachment 221747 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=221747&action=review
> 
> > Tools/WinLauncher/WinLauncher.cpp:394
> > +static bool getAppDataFolder(std::wstring& directory)
> 
> Why not take a _bstr_t intend? Then you don't have to do all the conversion to/from std::wsting?
> 

Thanks, good point, updated patch :)
Comment 8 Brent Fulgham 2014-01-22 15:38:10 PST
Comment on attachment 221782 [details]
Patch

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

Minor nit-pick about prefixing with ::.  Could you please fix that, and I'll r+ it?

> Tools/WinLauncher/WinLauncher.cpp:402
> +    PathRemoveExtensionW(executablePath);

We prefix C API calls with ::, so these should be ::GetModuleFileNameW and ::PathRemoveExtensionW.

> Tools/WinLauncher/WinLauncher.cpp:404
> +    directory = _bstr_t(appDataDirectory) + L"\\" + PathFindFileNameW(executablePath);

This should be ::PathFindFileNameW, too.
Comment 9 peavo 2014-01-23 08:24:26 PST
(In reply to comment #8)
> (From update of attachment 221782 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=221782&action=review
> 
> Minor nit-pick about prefixing with ::.  Could you please fix that, and I'll r+ it?
> 
> > Tools/WinLauncher/WinLauncher.cpp:402
> > +    PathRemoveExtensionW(executablePath);
> 
> We prefix C API calls with ::, so these should be ::GetModuleFileNameW and ::PathRemoveExtensionW.

I would, but I'm getting style errors when I add the prefix:

ERROR: Tools/WinLauncher/WinLauncher.cpp:402:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]

Is there a bug in the style checker?
Comment 10 Brent Fulgham 2014-01-23 09:23:34 PST
(In reply to comment #9)
> (In reply to comment #8)
> > (From update of attachment 221782 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=221782&action=review
> > 
> > Minor nit-pick about prefixing with ::.  Could you please fix that, and I'll r+ it?
> > 
> > > Tools/WinLauncher/WinLauncher.cpp:402
> > > +    PathRemoveExtensionW(executablePath);
> > 
> > We prefix C API calls with ::, so these should be ::GetModuleFileNameW and ::PathRemoveExtensionW.
> 
> I would, but I'm getting style errors when I add the prefix:
> 
> ERROR: Tools/WinLauncher/WinLauncher.cpp:402:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
> 
> Is there a bug in the style checker?

Yes, it looks like there is.  I've filed a few bugs recently against it. Something changed that regressed a few things regarding whitespace.

Go ahead and propose the patch with the incorrect style warning and I'll approve it.
Comment 11 peavo 2014-01-23 09:40:10 PST
Created attachment 221990 [details]
Patch
Comment 12 peavo 2014-01-23 09:41:49 PST
(In reply to comment #10)
> Yes, it looks like there is.  I've filed a few bugs recently against it. Something changed that regressed a few things regarding whitespace.
> 
> Go ahead and propose the patch with the incorrect style warning and I'll approve it.

Thanks, updated patch :)
Comment 13 WebKit Commit Bot 2014-01-23 09:41:59 PST
Attachment 221990 [details] did not pass style-queue:


ERROR: Tools/WinLauncher/WinLauncher.cpp:401:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Tools/WinLauncher/WinLauncher.cpp:402:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Tools/WinLauncher/WinLauncher.cpp:404:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Tools/WinLauncher/WinLauncher.cpp:402:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Tools/WinLauncher/WinLauncher.cpp:404:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
Total errors found: 5 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 14 Brent Fulgham 2014-01-23 09:42:38 PST
Comment on attachment 221990 [details]
Patch

r=me. Stupid stylebot!
Comment 15 peavo 2014-01-23 09:50:14 PST
(In reply to comment #14)
> (From update of attachment 221990 [details])
> r=me. Stupid stylebot!

:) Thanks!
Comment 16 WebKit Commit Bot 2014-01-23 10:16:12 PST
Comment on attachment 221990 [details]
Patch

Clearing flags on attachment: 221990

Committed r162623: <http://trac.webkit.org/changeset/162623>
Comment 17 WebKit Commit Bot 2014-01-23 10:16:15 PST
All reviewed patches have been landed.  Closing bug.