0
Commit Graph

17 Commits

Author SHA1 Message Date
Bill Budge
4d028f1266 [WebAssembly] Add blink::feature kWasmCodeCache.
- Adds kWasmCodeCache to blink::features.
- Checks if enabled before creating the cache in the browser.
- Checks if enabled before fetching from cache in renderer.

This is patterned after the Javascript IsolatedCodeCache feature.

Bug: chromium:719172
Change-Id: I1ffea5d8029b2b550c45e3ba25821889c7c2183c
Reviewed-on: https://chromium-review.googlesource.com/c/1341071
Commit-Queue: Bill Budge <bbudge@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609705}
2018-11-20 15:05:12 +00:00
Mythri Alle
0015c0bc5b Use SimplifyURLForRequest to strip fields that should not be used as cache keys
Use SimplifyURLForRequest to erase username, password and ref so we can safely
use the URL as a cache key. SpecForRequest does not handle chrome:// URLs.

Bug: chromium:812168
Change-Id: Ia8118b46c6aa42f4c7184197e880b3fbcee9c47a
Reviewed-on: https://chromium-review.googlesource.com/c/1298719
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603381}
2018-10-28 16:15:56 +00:00
Mythri Alle
aa646be62b Use code caches when renderer is not locked to an origin
When site-isolation is not enabled (for ex: on Android), render
process would not be locked to an origin. In such cases it is safe
to use code cache by keying it only on the url of the requested
resource. Earlier, we prevented any render process that is not
locked to an origin from using code caches.

Bug: chromium:812168
Change-Id: Ib231bfca19d7e40fdf9d9cdd430bb0aedbe7426f
Reviewed-on: https://chromium-review.googlesource.com/c/1264675
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599780}
2018-10-15 23:37:14 +00:00
Mythri Alle
699d269314 Collect V8 and WebAssembly statistics in separate histograms
GeneratedCodeCache is used both by V8 and WebAssembly. This cl collects
the code cache behaviour statistics (ex: hit/miss/error rate) in different
histograms for V8 and WebAssembly.

Bug: chromium:812168
Change-Id: Ic91ff21b59f3f621b95afa2bd4a27eb0cc94613a
Reviewed-on: https://chromium-review.googlesource.com/c/1268282
Reviewed-by: Brian White <bcwhite@chromium.org>
Reviewed-by: Bill Budge <bbudge@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#598328}
2018-10-10 15:07:09 +00:00
Bill Budge
f27eb2437c [caching] Allow WebAssembly fetches to use code cache.
Fixes a few problems preventing the WASM cache from working.
- Routes raw resource metadata to the WASM code cache.
- Separates JS and WASM generated code caches. They can't share
  a directory.
- Allow cached metadata to be set on RawResources.

Bug: chromium:719172
Change-Id: I0f3709340948bb25d134504bb03632eb1ce24196
Reviewed-on: https://chromium-review.googlesource.com/c/1255963
Commit-Queue: Bill Budge <bbudge@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596779}
2018-10-04 18:45:41 +00:00
Chris Palmer
ab5e5b55ba Rename url::Origin::unique -> opaque.
De-confuse the terminology.

Bug: None
TBR: avi, caitkp, rdevlin.cronin, eugenebut, dalecurtis, mmenke, jsbell, foolip, tsepez, dcheng
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs;luci.chromium.try:linux_mojo
Change-Id: I47f32cdd2e937c0f0014a4813a4ddfd74b049d73
Reviewed-on: https://chromium-review.googlesource.com/1247227
Commit-Queue: Chris Palmer <palmer@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: Sergio Collazos <sczs@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595174}
2018-09-28 19:19:30 +00:00
Bill Budge
d64546bc9c [caching] Add WebAssembly cache
- Modifies Mojo code caching API to specify JS or WASM cache.
- Adds WebAssembly GeneratedCodeCache.

Bug: chromium:719172
Change-Id: Ie7dec8112a8e6cea7c576e2e502683bba0bb3d4a
Reviewed-on: https://chromium-review.googlesource.com/1235283
Commit-Queue: Bill Budge <bbudge@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595107}
2018-09-28 16:06:47 +00:00
Eric Seckler
8652dcd5d8 content: Replace uses of BrowserThread task posting with post_task.h API
This patch updates callsites of BrowserThread task posting methods to
use the post_task.h API instead.

Background: We're changing the way tasks are posted to a BrowserThread,
see PSA [1] and design doc [2]. This unifies the way tasks are posted
and paves the way for annotating tasks with task types and other
attributes that can be used to prioritize tasks in the future browser
UI thread scheduler (design doc [3]).

This CL changes callsites of the following forms:
(a) BrowserThread::Post*Task(BrowserThread::UI/IO, ..) to
    base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI/IO}, ..),
(b) BrowserThread::GetTaskRunnerForThread(BrowserThread::UI/IO) to
    base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI/IO}).

It also adds necessary includes. These mechanical changes were applied
by a script.

Tasks posted with the same BrowserThread::ID trait (via
PostTaskWithTraits or TaskRunners obtained from
Create*TaskRunnerWithTraits) will still execute in the order they
were posted, see [4].

[1] https://groups.google.com/a/chromium.org/d/topic/chromium-dev/A3_snMVXv8A/discussion
[2] https://docs.google.com/document/d/1SGy9VTXUwyXEX_yBZ0ukFAnS8B0hDeMUJD-1iALaE-Q/edit?usp=sharing
[3] https://docs.google.com/document/d/1z1BDq9vzcEpkhN9LSPF5XMnZ0kLJ8mWWkNAi4OI7cos/edit?usp=sharing
[4] https://cs.chromium.org/chromium/src/base/task/post_task.h?l=66

TBR=achuith@chromium.org, afakhry@chromium.org, agl@chromium.org, avi@chromium.org, bbudge@chromium.org, bengr@chromium.org, benwells@chromium.org, bnc@chromium.org, calamity@chromium.org, ccameron@chromium.org, chiniforooshan@chromium.org, cjgrant@chromium.org, cmumford@chromium.org, csharrison@chromium.org, dalecurtis@chromium.org, delphick@chromium.org, dgozman@chromium.org, dmazzoni@chromium.org, droger@chromium.org, dschuff@chromium.org, dullweber@chromium.org, erikchen@chromium.org, felt@chromium.org, fgorski@chromium.org, gogerald@chromium.org, groby@chromium.org, horo@chromium.org, imcheng@chromium.org, jcivelli@chromium.org, jianli@chromium.org, jinho.bang@samsung.com, jkarlin@chromium.org, jochen@chromium.org, kinuko@chromium.org, lazyboy@chromium.org, lpy@chromium.org, markusheintz@chromium.org, mattcary@chromium.org, maxmorin@chromium.org, miu@chromium.org, mkwst@chromium.org, mmenke@chromium.org, mpearson@chromium.org, msramek@chromium.org, nick@chromium.org, nparker@chromium.org, nyquist@chromium.org, peter@chromium.org, pwnall@chromium.org, qinmin@chromium.org, rbpotter@chromium.org, rdevlin.cronin@chromium.org, rouslan@chromium.org, scottmg@chromium.org, servolk@chromium.org, skuhne@chromium.org, sky@chromium.org, tapted@chromium.org, tbansal@chromium.org, thestig@chromium.org, tommi@chromium.org, tommycli@chromium.org, torne@chromium.org, tschumann@chromium.org, vabr@chromium.org, vakh@chromium.org, waffles@chromium.org, yfriedman@chromium.org, zmo@chromium.org, bartfab@chromium.org

Bug: 878356
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:linux_vr;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I37526c8e75630ee7bec29421276094a30e903894
Reviewed-on: https://chromium-review.googlesource.com/1186623
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Vaclav Brozek <vabr@chromium.org>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592750}
2018-09-20 10:42:28 +00:00
Mythri Alle
a4c2245a24 Fix GeneratedCodeCache::ReadData to handle incomplete entries
In GeneratedCodeCache::ReadDataComplete also handle cases when
the entry was just created but no data is written into. We
always expect response_time as the header in the cache entry. If
the number of bytes read is smaller than the response_header then
it should be treated as a Error. Also, we can have entries with
only response time and no data associated with it.

Bug: chromium:884217
Change-Id: I5cc3f0923aa87ce208fe766ab6e9fb2633c24159
Reviewed-on: https://chromium-review.googlesource.com/1228123
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592414}
2018-09-19 15:42:23 +00:00
Victor Costan
63c8b3d4f7 Use base::MakeRefCounted instead of new to alloc net::IOBuffer instances.
This CL only handles the files in //content. The files in //net were
tackled in https://crrev.com/c/1188959. Parallel CLs will tackle other
directories.

net::IOBuffer is (thread-safe) ref-counted. Asides from improving the
ability to reason about instance ownership locally, creating instances
via base::MakeRefCounted makes it possible to use 1-based ref-counting
in the future (see base/memory/ref_counted.h).

This CL is mechanical, to avoid introducing any behavior changes. The
difficult cases will be tackled by follow-up CLs. The following
transformations were performed.

* new IOBufferType(args) => base::MakeRefCounted<IOBufferType>(args)
* new IOBufferType => base::MakeRefCounted<IOBufferType>()
* scoped_refptr x(base::MakeRefCounted<IOBufferType>(args)) =>
  scoped_refptr x = base::MakeRefCounted<IOBufferType>(args)
* scoped_refptr<IOBufferType>(base::MakeRefCounted<IOBufferType>(args)) =>

  base::MakeRefCounted<IOBufferType>(args)
* In comments: creates a new IOBufferType => creates an IOBufferType
  (so it wouldn't trigger future searches for "new BufferType")
* Instantiated static members in HttpResponseBodyDrainer,
  HttpNetworkTransaction, HttpProxyClientSocket, WritersTest,
  UDPSocketTest, TestDelegate, UDPSocketPerfTest
  (needed to fix linker errors)
* arraysize -> base::size (where needed to pass presubmit checks)
* git cl format

Change-Id: Ib3f9965fe92b84be3db88d0143a398079b812efd
Reviewed-on: https://chromium-review.googlesource.com/1200525
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588243}
2018-09-01 01:34:10 +00:00
Mythri Alle
4f9bb310e2 Collect UMA data for SiteIsolatedCodeCache
Adds SiteIsolatedCodeCache.Behavour histogram. This collects the
behaviour of site isolated code cache for each request received.
It records if the request was serviced and if serviced how it was
serviced for ex: hit, miss, update.

Bug: chromium:812168
Change-Id: Ie9e45af8e72dee6fafc1b088c139b7b87fcc0851
Reviewed-on: https://chromium-review.googlesource.com/1196430
Reviewed-by: Brian White <bcwhite@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588047}
2018-08-31 16:15:06 +00:00
Mythri Alle
39672eb70a Let disk_cache pick a default value for size of code cache.
Pass in 0 as the size of code cache, so disk_cache backend
picks a default value based on some heuristics. The size
of code cache would be the same as the size of http_cache.
We can tune it once we have some initial results. We also
need to add support for embedder to override this default
value and that is tracked in this bug: crbug.com/867552

Bug: chromium:812168
Change-Id: Iab8d98764e3e306cb006377e5b8adaf2c727b689
Reviewed-on: https://chromium-review.googlesource.com/1161922
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585032}
2018-08-22 16:19:57 +00:00
Mythri Alle
09423c6be5 Update fetch interface of GeneratedCodeCache
Update the fetch interface of GeneratedCodeCache to send
response time and data instead of just raw data. This will
make it cleaner when using it and also make it consistent
with the write interface.

Bug: chromium:812168
Change-Id: Ic460bbbf15788caf04946a35b5cb3ba356cd212e
Reviewed-on: https://chromium-review.googlesource.com/1154539
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580183}
2018-08-02 15:20:53 +00:00
Mythri Alle
f4d0f2b3c4 Add support to store generated code in isolated code caches.
We want to decouple the code cache from the HttpCache and
recently added a separate code cache [1]. This cl is a follow up
that actually writes the generated code into the code cache.
There will be a followup cl that also fetches from the code cache.

[1] chromium-review.googlesource.com/c/chromium/src/+/1120179

Bug: chromium:812168
Change-Id: I2866f8689b83ccba13ea8e0bcf7c60558997380d
Reviewed-on: https://chromium-review.googlesource.com/1150237
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579037}
2018-07-30 15:04:42 +00:00
Mythri Alle
3e4af05209 Create a CodeCache per each storage_partition to store generated code
We to store the code generated for javascript resources in a separate
cache [1]. This cl just creates a code cache, one instance per each
storage partition. I will follow it up with other cls that actually
start using this cache. This feature is behind a flag.

[1] docs.google.com/document/d/1O_PVZPn37Ev3_DWJjQLX-gid__OKxnXP1UsE8g_YkRY


Bug: chromium:812168
Change-Id: I610f640faec1fc331936e6388344c2975d268b4a
Reviewed-on: https://chromium-review.googlesource.com/1120179
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Sergey Volk <servolk@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578283}
2018-07-26 13:33:19 +00:00
Mythri Alle
0aff707f8b Add ClearCache option for GeneratedCodeCache
Add an api for clearing the GeneratedCodeCache.

Bug: chromium:812168
Change-Id: Iba8fb3c81e8bed04573ed0cd4dabf4af31ea0c21
Reviewed-on: https://chromium-review.googlesource.com/1114974
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577150}
2018-07-23 11:43:30 +00:00
Mythri Alle
9067baa1c4 Add a separate GeneratedCodeCache to decouple HttpCache and metadata
Storing the generated code for javascript resources in a separate
cache gives more flexibility in the implementation of the code
cache.More details in the design doc [1]

This cl just adds the GeneratedCodeCache class but does not
use it yet. There will be follow up cls to actually use
the cache.

[1] https://docs.google.com/document/d/1O_PVZPn37Ev3_DWJjQLX-gid__OKxnXP1UsE8g_YkRY/edit?usp=sharing

Bug: chromium:812168
Change-Id: I04b709d8e443217f8235859731e75fdf94c62971
Reviewed-on: https://chromium-review.googlesource.com/1107703
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576453}
2018-07-19 12:23:23 +00:00