Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Issue 19747: URLRequestContext and disk cache for media files (Closed)

Created:
11 years, 10 months ago by Alpha Left Google
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com, ralphl, scherkus (not reviewing)
Visibility:
Public.

Description

Proposed change to support resource loading for media files. Highlights of changes: - Added methods to disk_cache::Entry: - Entry::PrepareTargetAsExternalFile(int index) Prepare a stream in an entry to use external file for storage. - Entry::GetExternalFile(int index) Get the external file backing the stream in the entry. - Added a property "CacheType type_" to HttpCache, along with setter and getter. There shall be two cache types, COMMON_CACHE and MEDIA_CACHE for distinguishing between different purpose of HttpCache. We have this property to trigger special behavior for caching needs of media files. - Added static methods to ChromeURLRequestContext - ChromeURLRequestContext::CreateOriginalForMedia Create a URLRequestContext for media files for the original profile. - ChromeURLRequestContext::CreateOffTheRecordForMedia Create a URLRequestContext for media files for off the record profile. - Added method to Profile interface. - GetRequestContextForMedia To get the request context for media files from the context. Design decissions: - Enforce writing to external file by calling methods to Entry rather than construct Backend by a different flag. Since we only want a valid and full response to go into an external file rather than redirection response or erroneous response, we should let HttpCache::Transaction to decide when to have an external file for response data. We eliminate a lot of useless external cache files. - Adding the CacheType enum and property to HttpCache, we could allow possible (?) future extensions to HttpCache to handle other different caching needs. And there's no need to add change constructors of HttpCache, but maybe we should add a specific constructor to accomodate a media HttpCache? - Adding Profile::GetRequestContextForMedia() Since we will need to use this new request context in ResourceDispatcherHost, I think the best place to keep it is in the profile. Also we will expose to user that there's a separate cache for media, so it's better to expose it in the Profile level to allow settings to the media cache, e.g. max file size, etc.

Patch Set 1 #

Patch Set 2 : style and spaces #

Total comments: 14

Patch Set 3 : fixing style problems #

Total comments: 22

Patch Set 4 : style and comments fixes #

Patch Set 5 : unit tests #

Patch Set 6 : group changes again #

Patch Set 7 : revert changes to MockDiskCache #

Total comments: 5

Patch Set 8 : more unit tests #

Total comments: 9

Patch Set 9 : reuse HttpNetworkSession #

Patch Set 10 : long time no merge #

Patch Set 11 : signed and unsigned... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+504 lines, -16 lines) Patch
M chrome/browser/net/chrome_url_request_context.h View 1 2 3 4 5 6 7 8 1 chunk +10 lines, -0 lines 0 comments Download
M chrome/browser/net/chrome_url_request_context.cc View 1 2 3 4 5 6 7 8 3 chunks +50 lines, -0 lines 0 comments Download
M chrome/browser/profile.h View 1 2 3 4 5 6 7 8 3 chunks +7 lines, -0 lines 0 comments Download
M chrome/browser/profile.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +31 lines, -0 lines 0 comments Download
M chrome/common/chrome_constants.h View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/chrome_constants.cc View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/test/testing_profile.h View 1 chunk +3 lines, -0 lines 0 comments Download
M net/disk_cache/disk_cache.h View 1 2 3 4 5 6 7 8 2 chunks +24 lines, -0 lines 0 comments Download
M net/disk_cache/entry_impl.h View 1 2 3 4 5 6 7 8 3 chunks +5 lines, -3 lines 0 comments Download
M net/disk_cache/entry_impl.cc View 1 2 3 4 5 6 7 8 9 4 chunks +53 lines, -2 lines 0 comments Download
M net/disk_cache/entry_unittest.cc View 5 6 7 8 9 10 1 chunk +97 lines, -0 lines 0 comments Download
M net/disk_cache/mem_entry_impl.h View 1 2 3 4 5 6 7 8 1 chunk +8 lines, -0 lines 0 comments Download
M net/http/http_cache.h View 1 2 3 4 5 6 7 8 9 4 chunks +26 lines, -1 line 0 comments Download
M net/http/http_cache.cc View 1 2 3 4 5 6 7 8 9 10 6 chunks +47 lines, -2 lines 0 comments Download
M net/http/http_cache_unittest.cc View 5 6 7 8 9 10 5 chunks +97 lines, -2 lines 0 comments Download
M net/http/http_network_layer.h View 1 chunk +12 lines, -0 lines 0 comments Download
M net/http/http_network_layer.cc View 3 chunks +23 lines, -5 lines 0 comments Download
M net/http/http_response_info.h View 1 2 3 4 5 6 7 8 9 2 chunks +5 lines, -0 lines 0 comments Download
M webkit/glue/resource_loader_bridge.h View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 14 (0 generated)
Alpha Left Google
11 years, 10 months ago (2009-02-02 01:34:18 UTC) #1
rvargas (doing something else)
Please add disk cache unit tests for the new code. http://codereview.chromium.org/19747/diff/34/35 File chrome/browser/net/chrome_url_request_context.cc (right): http://codereview.chromium.org/19747/diff/34/35#newcode17 ...
11 years, 10 months ago (2009-02-02 23:30:18 UTC) #2
Alpha Left Google
Refactored and changed some comments according to rvargas's notes.
11 years, 10 months ago (2009-02-04 06:08:23 UTC) #3
darin (slow to review)
how come there are no unit tests? http://codereview.chromium.org/19747/diff/603/604 File chrome/browser/net/chrome_url_request_context.cc (right): http://codereview.chromium.org/19747/diff/603/604#newcode82 Line 82: // ...
11 years, 10 months ago (2009-02-04 18:56:29 UTC) #4
rvargas (doing something else)
(Still missing the unit tests) http://codereview.chromium.org/19747/diff/603/606 File chrome/browser/profile.cc (right): http://codereview.chromium.org/19747/diff/603/606#newcode205 Line 205: file_util::AppendToPath(&cache_path, chrome::kMediaCacheDirname); You ...
11 years, 10 months ago (2009-02-04 19:20:40 UTC) #5
Alpha Left Google
I have cleaned it up and provided unit tests. http://codereview.chromium.org/19747/diff/603/610 File net/disk_cache/disk_cache.h (right): http://codereview.chromium.org/19747/diff/603/610#newcode15 Line ...
11 years, 10 months ago (2009-02-05 23:40:38 UTC) #6
rvargas (doing something else)
http://codereview.chromium.org/19747/diff/696/1632 File net/disk_cache/entry_impl.cc (right): http://codereview.chromium.org/19747/diff/696/1632#newcode396 Line 396: DCHECK(cache_file); this should not be a DCHECK. GetExternalFile ...
11 years, 10 months ago (2009-02-06 00:51:49 UTC) #7
Alpha Left Google
One new unit test. http://codereview.chromium.org/19747/diff/696/1634 File net/disk_cache/entry_unittest.cc (right): http://codereview.chromium.org/19747/diff/696/1634#newcode814 Line 814: ASSERT_EQ(kDataSize, file->GetLength()); Done. On ...
11 years, 10 months ago (2009-02-06 01:30:36 UTC) #8
rvargas (doing something else)
LGTM
11 years, 10 months ago (2009-02-06 02:35:21 UTC) #9
darin (slow to review)
http://codereview.chromium.org/19747/diff/1649/1650 File chrome/browser/net/chrome_url_request_context.cc (right): http://codereview.chromium.org/19747/diff/1649/1650#newcode92 Line 92: net::HttpCache* cache = new net::HttpCache(context->proxy_service_, i think this ...
11 years, 10 months ago (2009-02-18 07:29:56 UTC) #10
Alpha Left Google
http://codereview.chromium.org/19747/diff/1649/1650 File chrome/browser/net/chrome_url_request_context.cc (right): http://codereview.chromium.org/19747/diff/1649/1650#newcode92 Line 92: net::HttpCache* cache = new net::HttpCache(context->proxy_service_, On 2009/02/18 07:29:56, ...
11 years, 10 months ago (2009-02-18 21:31:53 UTC) #11
Alpha Left Google
http://codereview.chromium.org/19747/diff/1649/1661 File net/http/http_cache.cc (right): http://codereview.chromium.org/19747/diff/1649/1661#newcode847 Line 847: response_.response_data_file = On 2009/02/18 21:31:53, Alpha wrote: > ...
11 years, 10 months ago (2009-02-25 02:29:47 UTC) #12
darin (slow to review)
OK
11 years, 10 months ago (2009-02-26 22:11:05 UTC) #13
Alpha Left Google
11 years, 10 months ago (2009-02-26 23:18:29 UTC) #14
On 2009/02/26 22:11:05, darin wrote:
> OK

Thanks for the thorough review. You are awesome! :)

Powered by Google App Engine
This is Rietveld 408576698