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

Issue 1021073002: <webview> Implement clear http cache API. (Closed)

Created:
5 years, 9 months ago by lazyboy
Modified:
5 years, 8 months ago
CC:
chromium-apps-reviews_chromium.org, chromium-reviews, darin-cc_chromium.org, extensions-reviews_chromium.org, gavinp+disk_chromium.org, jam, markusheintz_
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

<webview> Implement clear http cache API. HTTP cache clearing methods have been refactored into a separate class: StoragePartitionBrowsingDataRemover in http://crrev.com/1033013003/ One method was exposed in WebCacheManager so we can clear renderer/ cache for a given render process. <webview> already has a set of data it can clear, this CL adds "cache" to that set, similar to chrome.browsingData API. BUG=406437 Test=Load a <webview> in a chrome app, e.g. the browser sample app: https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/webview-samples/browser Open inspector for the webview: from chrome://inspect, switch to Apps, and inspect the tab that says "Google" under "Browser sample". Switch to network tab in that inspector so you can monitor http requests. Visit some page in the <webview>, for my test case, I visited http://www.google.ca Now look at the network tab for image requests (cause it should be much simpler), e.g. nav_logo_195.png Reload the page couple of times, observer the status code for the image request, it should say 304 OK. Now open the app's inspector: Same as above, but inspect "Browser sample" instead. Call <webview> clear cache api from its console: document.querySelector('webview').clearData( {since: 1}, {cache: true}, function() { window.console.log('clear complete'); }) Expect "clear complete" message to show in app's console. Now reload the page one more time and check the same image's request, it should say 200 OK instead of 304. Committed: https://crrev.com/cbff2a79e3aafa333159dbc467efcb8a5dc124f7 Cr-Commit-Position: refs/heads/master@{#322678}

Patch Set 1 #

Patch Set 2 : revert storage_partition changes + started adding test, but cache does not work yet #

Patch Set 3 : update #

Patch Set 4 : Clean up for review + add test using mock + git cl format #

Patch Set 5 : add actual tests #

Patch Set 6 : Sync after http://crrev.com/1033013003 #

Total comments: 2

Patch Set 7 : add todo for SPBDRemover moving to components/ + sync #

Patch Set 8 : Sync, resolve conflict #

Patch Set 9 : fix compile error on mac/android: std::set initializer list makes them unhappy #

Unified diffs Side-by-side diffs Delta from patch set Stats (+329 lines, -58 lines) Patch
M chrome/browser/apps/guest_view/web_view_browsertest.cc View 1 2 3 4 5 6 3 chunks +57 lines, -0 lines 0 comments Download
M chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h View 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc View 1 2 3 4 5 6 3 chunks +25 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/platform_apps/web_view/clear_data_cache/embedder.html View 1 2 3 4 0 chunks +-1 lines, --1 lines 0 comments Download
A chrome/test/data/extensions/platform_apps/web_view/clear_data_cache/embedder.js View 1 2 3 4 1 chunk +81 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/platform_apps/web_view/clear_data_cache/guest.js View 1 2 3 4 5 2 chunks +5 lines, -14 lines 0 comments Download
A chrome/test/data/extensions/platform_apps/web_view/clear_data_cache/manifest.json View 1 2 3 4 1 chunk +13 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/platform_apps/web_view/clear_data_cache/test.js View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M components/web_cache/browser/web_cache_manager.h View 1 chunk +3 lines, -0 lines 0 comments Download
M components/web_cache/browser/web_cache_manager.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M extensions/browser/api/guest_view/web_view/web_view_internal_api.cc View 1 2 3 4 5 6 7 15 chunks +39 lines, -35 lines 0 comments Download
M extensions/browser/guest_view/web_view/web_view_constants.h View 1 2 3 4 5 6 2 chunks +14 lines, -0 lines 0 comments Download
M extensions/browser/guest_view/web_view/web_view_constants.cc View 1 2 3 4 5 6 1 chunk +9 lines, -0 lines 0 comments Download
M extensions/browser/guest_view/web_view/web_view_guest.h View 1 2 3 2 chunks +10 lines, -0 lines 0 comments Download
M extensions/browser/guest_view/web_view/web_view_guest.cc View 1 2 3 4 chunks +55 lines, -9 lines 0 comments Download
M extensions/browser/guest_view/web_view/web_view_guest_delegate.h View 2 chunks +5 lines, -0 lines 0 comments Download
M extensions/common/api/web_view_internal.json View 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 18 (5 generated)
lazyboy
+mkwst@ for initial review: chrome/browser/browsing_data/browsing_data_remover.h chrome/browser/browsing_data/browsing_data_remover.cc chrome/browser/browsing_data/storage_partition_http_cache_data_remover.h chrome/browser/browsing_data/storage_partition_http_cache_data_remover.cc chrome/chrome_browser.gypi This is bigger piece of the ...
5 years, 9 months ago (2015-03-25 19:16:28 UTC) #2
Mike West
Would you mind splitting the BrowsingDataRemover code out into StoragePartitionHttpCacheDataRemover in a separate CL? That ...
5 years, 9 months ago (2015-03-26 14:21:31 UTC) #3
lazyboy
On 2015/03/26 14:21:31, Mike West wrote: > Would you mind splitting the BrowsingDataRemover code out ...
5 years, 9 months ago (2015-03-26 16:32:38 UTC) #4
Mike West
Great. Ping this CL once that one lands (I read it here this afternoon, assuming ...
5 years, 9 months ago (2015-03-26 16:38:41 UTC) #5
lazyboy
@Mike: https://codereview.chromium.org/1033013003 has landed and I've updated this CL (patchset #6). This CL doesn't require ...
5 years, 9 months ago (2015-03-26 20:05:08 UTC) #7
jochen (gone - plz use gerrit)
lgtm
5 years, 9 months ago (2015-03-27 14:41:52 UTC) #8
Fady Samuel
https://codereview.chromium.org/1021073002/diff/100001/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc File chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc (right): https://codereview.chromium.org/1021073002/diff/100001/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc#newcode49 chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc:49: // StoragePartitionHttpCacheDataRemover::ClearData() does not clear that. Can StoragePartitionHttpCacheDataRemover move ...
5 years, 8 months ago (2015-03-27 14:47:38 UTC) #10
lazyboy
https://codereview.chromium.org/1021073002/diff/100001/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc File chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc (right): https://codereview.chromium.org/1021073002/diff/100001/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc#newcode49 chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc:49: // StoragePartitionHttpCacheDataRemover::ClearData() does not clear that. On 2015/03/27 14:47:38, ...
5 years, 8 months ago (2015-03-27 17:34:05 UTC) #11
Fady Samuel
guest_view lgtm
5 years, 8 months ago (2015-03-27 20:21:49 UTC) #12
lazyboy
FYI, patchset #9 has one change since reviewed: "set<int>({value})" initializer was failing on mac/android. I've ...
5 years, 8 months ago (2015-03-27 22:46:09 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1021073002/160001
5 years, 8 months ago (2015-03-27 23:35:18 UTC) #16
commit-bot: I haz the power
Committed patchset #9 (id:160001)
5 years, 8 months ago (2015-03-27 23:39:03 UTC) #17
commit-bot: I haz the power
5 years, 8 months ago (2015-03-27 23:40:06 UTC) #18
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/cbff2a79e3aafa333159dbc467efcb8a5dc124f7
Cr-Commit-Position: refs/heads/master@{#322678}

Powered by Google App Engine
This is Rietveld 408576698