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

Side by Side Diff: mojo/services/url_response_disk_cache/interfaces/url_response_disk_cache.mojom

Issue 1741963002: Auto-formatted all .mojom files. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 [DartPackage="mojo_services"] 5 [DartPackage="mojo_services"]
6 module mojo; 6 module mojo;
7 7
8 import "mojo/public/interfaces/network/url_response.mojom"; 8 import "mojo/public/interfaces/network/url_response.mojom";
9 9
10 // This service allows client to efficiently cache and retrieve url response 10 // This service allows client to efficiently cache and retrieve url response
11 // content on disk. In particular, it allows the shell and content handlers to 11 // content on disk. In particular, it allows the shell and content handlers to
12 // efficiently cache and retrieve mojo applications. 12 // efficiently cache and retrieve mojo applications.
13 // TODO(qsr): At the moment, the url response disk cache only handles ETag. If 13 // TODO(qsr): At the moment, the url response disk cache only handles ETag. If
14 // either the cached version or the given response do not contain 14 // either the cached version or the given response do not contain
15 // ETags, the entry will be invalidated. It should be extended to 15 // ETags, the entry will be invalidated. It should be extended to
16 // handle all the other http cache mechanisms for better performance 16 // handle all the other http cache mechanisms for better performance
17 // with http servers that do not support ETags. 17 // with http servers that do not support ETags.
18 [ServiceName="mojo::URLResponseDiskCache"] 18 [ServiceName="mojo::URLResponseDiskCache"]
19 interface URLResponseDiskCache { 19 interface URLResponseDiskCache {
20 20
viettrungluu 2016/03/15 23:14:50 I wonder if we should have it delete a non-standar
azani 2016/03/23 22:42:51 Done.
21 // Given an URL, returns a tuple. If the |url| is not in the cache, all the 21 // Given an URL, returns a tuple. If the |url| is not in the cache, all the
22 // response parameters are null. Otherwise |response| is the cached response 22 // response parameters are null. Otherwise |response| is the cached response
23 // stripped of the body, |file_path| is a file containing the body of the 23 // stripped of the body, |file_path| is a file containing the body of the
24 // response and |cache_dir_path| is a directory that the applicaton can use 24 // response and |cache_dir_path| is a directory that the applicaton can use
25 // to store content. This service guarantee that |cache_dir_path| will be 25 // to store content. This service guarantee that |cache_dir_path| will be
26 // emptied when |file_path| content changes. For example, a content handler 26 // emptied when |file_path| content changes. For example, a content handler
27 // that is backed by a VM that compiles files could have the VM use this 27 // that is backed by a VM that compiles files could have the VM use this
28 // directory to cache the compiled files. After |Get| has been called and a 28 // directory to cache the compiled files. After |Get| has been called and a
29 // response is returned, the caller must call |Validate| or |Update| to 29 // response is returned, the caller must call |Validate| or |Update| to
30 // revalidate the entry. If this is not done, a future call to |Get| may 30 // revalidate the entry. If this is not done, a future call to |Get| may
31 // return null. 31 // return null.
32 Get(string url) => (mojo.URLResponse? response, 32 Get(string url)
33 array<uint8>? file_path, 33 => (mojo.URLResponse? response,
34 array<uint8>? cache_dir_path); 34 array<uint8>? file_path,
35 array<uint8>? cache_dir_path);
35 36
36 // Validate the cache for the given |url|. This will enforce that |Get| will 37 // Validate the cache for the given |url|. This will enforce that |Get| will
37 // return an entry if it exists. 38 // return an entry if it exists.
38 Validate(string url); 39 Validate(string url);
39 40
40 // Update the cache with the given response. 41 // Update the cache with the given response.
41 Update(mojo.URLResponse response); 42 Update(mojo.URLResponse response);
42 43
43 // Given a URLResponse, updates the cache and returns a pair of paths. 44 // Given a URLResponse, updates the cache and returns a pair of paths.
44 // |file_path| is a file containing the body of the response. 45 // |file_path| is a file containing the body of the response.
45 // |cache_dir_path| is a directory that the applicaton can use to store 46 // |cache_dir_path| is a directory that the applicaton can use to store
46 // content. This service guarantee that |cache_dir_path| will be emptied 47 // content. This service guarantee that |cache_dir_path| will be emptied
47 // when |file_path| content changes. For example, a content handler that is 48 // when |file_path| content changes. For example, a content handler that is
48 // backed by a VM that compiles files could have the VM use this directory 49 // backed by a VM that compiles files could have the VM use this directory
49 // to cache the compiled files. 50 // to cache the compiled files.
50 UpdateAndGet(mojo.URLResponse response) => 51 UpdateAndGet(mojo.URLResponse response)
51 (array<uint8>? file_path, array<uint8>? cache_dir_path); 52 => (array<uint8>? file_path, array<uint8>? cache_dir_path);
52 53
53 // Given a URLResponse that is expected to have a zipped body, updates the 54 // Given a URLResponse that is expected to have a zipped body, updates the
54 // cache and returns a pair of paths. |extracted_dir_path| is a directory 55 // cache and returns a pair of paths. |extracted_dir_path| is a directory
55 // containing the unzipped body of the response. |cache_dir_path| is a 56 // containing the unzipped body of the response. |cache_dir_path| is a
56 // directory that the applicaton can use to store content. This service 57 // directory that the applicaton can use to store content. This service
57 // guarantee that |cache_dir_path| will be emptied when |extracted_dir_path| 58 // guarantee that |cache_dir_path| will be emptied when |extracted_dir_path|
58 // content changes. 59 // content changes.
59 UpdateAndGetExtracted(mojo.URLResponse response) => 60 UpdateAndGetExtracted(mojo.URLResponse response)
60 (array<uint8>? extracted_dir_path, array<uint8>? cache_dir_path); 61 => (array<uint8>? extracted_dir_path, array<uint8>? cache_dir_path);
61 }; 62 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698