| // Copyright 2018 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module blink.mojom; |
| |
| import "mojo/public/mojom/base/time.mojom"; |
| import "url/mojom/origin.mojom"; |
| import "url/mojom/url.mojom"; |
| |
| // Enumeration of distinct code cache types. |
| enum CodeCacheType { |
| kJavascript, // Javascript bytecode. |
| kWebAssembly, // WebAssembly compiled module code. |
| }; |
| |
| // Interface to the code cache in the browser process. Renderer processes |
| // can use this interface to persistently store and retrieve executable code |
| // generated for a URL. |
| interface CodeCacheHost { |
| // Requests that the browser cache |data| associated with |url| and |
| // |expected_response_time|. |
| DidGenerateCacheableMetadata(CodeCacheType cache_type, |
| url.mojom.Url url, |
| mojo_base.mojom.Time expected_response_time, |
| array<uint8> data); |
| |
| // TODO(crbug.com/867848) Pass the data as mojo data_pipe instead of |
| // array<unit8>. |
| FetchCachedCode(CodeCacheType cache_type, url.mojom.Url url) => |
| (mojo_base.mojom.Time response_time, array<uint8> data); |
| |
| ClearCodeCacheEntry(CodeCacheType cache_type, url.mojom.Url url); |
| |
| // Requests that the browser cache |data| for the specified CacheStorage entry. |
| // TODO(https://crbug.com/779444): Verify or remove |cache_storage_origin|. |
| // TODO(kinuko): Consider making the renderer-side code directly call into the |
| // origin's CacheStoragePtr. |
| DidGenerateCacheableMetadataInCacheStorage( |
| url.mojom.Url url, mojo_base.mojom.Time expected_response_time, |
| array<uint8> data, url.mojom.Origin cache_storage_origin, |
| string cache_storage_cache_name); |
| }; |