Bug 170676

Summary: Cache small media resources in disk cache
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, buildbot, jer.noble, kling, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
buildbot: commit-queue-
Archive of layout-test-results from ews105 for mac-elcapitan-wk2
none
Archive of layout-test-results from ews125 for ios-simulator-wk2
none
patch
none
patch
buildbot: commit-queue-
Archive of layout-test-results from ews126 for ios-simulator-wk2
none
patch
buildbot: commit-queue-
Archive of layout-test-results from ews122 for ios-simulator-wk2
none
Archive of layout-test-results from ews125 for ios-simulator-wk2
none
patch kling: review+

Description Antti Koivisto 2017-04-10 08:19:04 PDT
We don't currently cache media resources persistently to avoid filling the cache. We should allow caching of reasonably sized media resources.
Comment 1 Radar WebKit Bug Importer 2017-04-10 08:19:41 PDT
<rdar://problem/31532649>
Comment 2 Antti Koivisto 2017-04-10 08:42:30 PDT
Created attachment 306689 [details]
patch
Comment 3 Build Bot 2017-04-10 09:59:48 PDT
Comment on attachment 306689 [details]
patch

Attachment 306689 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3511890

New failing tests:
http/tests/cache/disk-cache/disk-cache-media-small.html
Comment 4 Build Bot 2017-04-10 09:59:49 PDT
Created attachment 306696 [details]
Archive of layout-test-results from ews105 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 5 Build Bot 2017-04-10 10:23:16 PDT
Comment on attachment 306689 [details]
patch

Attachment 306689 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3511931

New failing tests:
http/tests/cache/disk-cache/disk-cache-media-small.html
Comment 6 Build Bot 2017-04-10 10:23:17 PDT
Created attachment 306702 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 7 Antti Koivisto 2017-04-10 10:32:10 PDT
Created attachment 306705 [details]
patch
Comment 8 Antti Koivisto 2017-04-10 11:36:15 PDT
Created attachment 306724 [details]
patch
Comment 9 Build Bot 2017-04-10 13:25:35 PDT
Comment on attachment 306724 [details]
patch

Attachment 306724 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3512841

New failing tests:
http/tests/cache/disk-cache/disk-cache-media-small.html
Comment 10 Build Bot 2017-04-10 13:25:36 PDT
Created attachment 306735 [details]
Archive of layout-test-results from ews126 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews126  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 11 Antti Koivisto 2017-04-11 02:49:56 PDT
Created attachment 306792 [details]
patch
Comment 12 Build Bot 2017-04-11 07:13:45 PDT
Comment on attachment 306792 [details]
patch

Attachment 306792 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3516981

New failing tests:
http/tests/cache/disk-cache/disk-cache-media-small.html
Comment 13 Build Bot 2017-04-11 07:13:46 PDT
Created attachment 306814 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 14 Build Bot 2017-04-11 08:31:54 PDT
Comment on attachment 306792 [details]
patch

Attachment 306792 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3517397

New failing tests:
http/tests/cache/disk-cache/disk-cache-media-small.html
Comment 15 Build Bot 2017-04-11 08:31:56 PDT
Created attachment 306819 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 16 Antti Koivisto 2017-04-12 01:15:01 PDT
Created attachment 306893 [details]
patch
Comment 17 Andreas Kling 2017-04-12 01:36:46 PDT
Comment on attachment 306893 [details]
patch

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

r=me

> Source/WebCore/loader/MediaResourceLoader.h:58
> +    Vector<ResourceResponse> responsesForTesting() const { return m_responsesForTesting; }

This could return a const Vector<ResourceResponse>& I suppose, though if it's just for testing it matters less.

> Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp:238
> +    if (StringView(contentRange).left(6) != ASCIILiteral("bytes "))
> +        return { };

I would write this using contentRange.startsWith().
Comment 18 Antti Koivisto 2017-04-12 03:18:19 PDT
https://trac.webkit.org/r215263
Comment 19 Antti Koivisto 2017-04-13 01:33:25 PDT
Made the test less flaky in https://trac.webkit.org/r215317