Bug 141295 - Switch to file backed buffer when resource is cached to disk
Summary: Switch to file backed buffer when resource is cached to disk
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-05 10:48 PST by Antti Koivisto
Modified: 2015-02-05 14:18 PST (History)
3 users (show)

See Also:


Attachments
patch (15.42 KB, patch)
2015-02-05 12:31 PST, Antti Koivisto
cdumez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2015-02-05 10:48:51 PST
Wire the mechanism used with CFNetwork cache to the new disk cache.
Comment 1 Antti Koivisto 2015-02-05 12:31:54 PST
Created attachment 246121 [details]
patch
Comment 2 WebKit Commit Bot 2015-02-05 12:34:09 PST
Attachment 246121 [details] did not pass style-queue:


ERROR: Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp:284:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit2/NetworkProcess/cache/NetworkCache.h:73:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 2 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Chris Dumez 2015-02-05 12:37:49 PST
Comment on attachment 246121 [details]
patch

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

> Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h:146
> +    typedef std::function<bool (std::unique_ptr<Entry>)> RetriveCompletionHandler;

"Retrieve"

> Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm:448
> +void NetworkCacheStorage::store(const NetworkCacheKey& key, const Entry& entry, StoreCompletionHandler completionHandler)

Since these std::function are passed by value, don't we want to WTF::move() them into the StoreOperation struct?
Comment 4 Chris Dumez 2015-02-05 12:40:46 PST
Comment on attachment 246121 [details]
patch

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

> Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp:342
> +            RefPtr<NetworkResourceLoader> loader(this);

Looks like this should be a Ref?
Comment 5 Chris Dumez 2015-02-05 12:56:02 PST
Comment on attachment 246121 [details]
patch

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

> Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm:257
> +    if (!map)

On failure mmap() returns MAP_FAILED which is (void*)-1, not 0.
Comment 6 Chris Dumez 2015-02-05 13:16:14 PST
Comment on attachment 246121 [details]
patch

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

r=me % a few comments.

>> Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm:448
>> +void NetworkCacheStorage::store(const NetworkCacheKey& key, const Entry& entry, StoreCompletionHandler completionHandler)
> 
> Since these std::function are passed by value, don't we want to WTF::move() them into the StoreOperation struct?

or pass them by const ref.
Comment 7 Antti Koivisto 2015-02-05 13:29:31 PST
> Looks like this should be a Ref?

Ref doesn't work with C++11 lambdas since it doesn't have copy-constructor.
Comment 8 Antti Koivisto 2015-02-05 13:29:52 PST
> On failure mmap() returns MAP_FAILED which is (void*)-1, not 0.

Good catch.
Comment 9 Chris Dumez 2015-02-05 13:31:37 PST
(In reply to comment #7)
> > Looks like this should be a Ref?
> 
> Ref doesn't work with C++11 lambdas since it doesn't have copy-constructor.

Right. never mind then.
Comment 10 Chris Dumez 2015-02-05 13:36:52 PST
(In reply to comment #5)
> Comment on attachment 246121 [details]
> patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=246121&action=review
> 
> > Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm:257
> > +    if (!map)
> 
> On failure mmap() returns MAP_FAILED which is (void*)-1, not 0.

BTW, it looks like we have the same bug in decodeEntry() already.
Comment 11 Antti Koivisto 2015-02-05 14:18:14 PST
https://trac.webkit.org/r179708