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

Side by Side Diff: content/browser/service_worker/service_worker_database.h

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: change useCache to updateViaCache Created 3 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/optional.h" 19 #include "base/optional.h"
20 #include "base/sequence_checker.h" 20 #include "base/sequence_checker.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "content/common/content_export.h" 22 #include "content/common/content_export.h"
23 #include "content/common/origin_trials/trial_token_validator.h" 23 #include "content/common/origin_trials/trial_token_validator.h"
24 #include "content/common/service_worker/service_worker_status_code.h" 24 #include "content/common/service_worker/service_worker_status_code.h"
25 #include "content/common/service_worker/service_worker_types.h" 25 #include "content/common/service_worker/service_worker_types.h"
26 #include "url/gurl.h" 26 #include "url/gurl.h"
27 #include "url/origin.h" 27 #include "url/origin.h"
nhiroki 2017/06/21 14:08:35 Can you include "WebServiceWorkerUpdateViaCache.h"
yuryu 2017/08/03 04:20:05 Done.
28 28
29 namespace tracked_objects { 29 namespace tracked_objects {
30 class Location; 30 class Location;
31 } 31 }
32 32
33 namespace leveldb { 33 namespace leveldb {
34 class DB; 34 class DB;
35 class Env; 35 class Env;
36 class Status; 36 class Status;
37 class WriteBatch; 37 class WriteBatch;
38 } 38 } // namespace leveldb
39 39
40 namespace content { 40 namespace content {
41 41
42 // Class to persist serviceworker registration data in a database. 42 // Class to persist serviceworker registration data in a database.
43 // Should NOT be used on the IO thread since this does blocking 43 // Should NOT be used on the IO thread since this does blocking
44 // file io. The ServiceWorkerStorage class owns this class and 44 // file io. The ServiceWorkerStorage class owns this class and
45 // is responsible for only calling it serially on background 45 // is responsible for only calling it serially on background
46 // non-IO threads (ala SequencedWorkerPool). 46 // non-IO threads (ala SequencedWorkerPool).
47 class CONTENT_EXPORT ServiceWorkerDatabase { 47 class CONTENT_EXPORT ServiceWorkerDatabase {
48 public: 48 public:
(...skipping 10 matching lines...) Expand all
59 STATUS_ERROR_FAILED, 59 STATUS_ERROR_FAILED,
60 STATUS_ERROR_NOT_SUPPORTED, 60 STATUS_ERROR_NOT_SUPPORTED,
61 STATUS_ERROR_MAX, 61 STATUS_ERROR_MAX,
62 }; 62 };
63 static const char* StatusToString(Status status); 63 static const char* StatusToString(Status status);
64 64
65 struct CONTENT_EXPORT RegistrationData { 65 struct CONTENT_EXPORT RegistrationData {
66 // These values are immutable for the life of a registration. 66 // These values are immutable for the life of a registration.
67 int64_t registration_id; 67 int64_t registration_id;
68 GURL scope; 68 GURL scope;
69 blink::WebServiceWorkerUpdateViaCache update_via_cache;
69 70
70 // Versions are first stored once they successfully install and become 71 // Versions are first stored once they successfully install and become
71 // the waiting version. Then transition to the active version. The stored 72 // the waiting version. Then transition to the active version. The stored
72 // version may be in the ACTIVATED state or in the INSTALLED state. 73 // version may be in the ACTIVATED state or in the INSTALLED state.
73 GURL script; 74 GURL script;
74 int64_t version_id; 75 int64_t version_id;
75 bool is_active; 76 bool is_active;
76 bool has_fetch_handler; 77 bool has_fetch_handler;
77 base::Time last_update_check; 78 base::Time last_update_check;
78 std::vector<GURL> foreign_fetch_scopes; 79 std::vector<GURL> foreign_fetch_scopes;
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, 415 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest,
415 UserData_UninitializedDatabase); 416 UserData_UninitializedDatabase);
416 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); 417 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase);
417 418
418 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); 419 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase);
419 }; 420 };
420 421
421 } // namespace content 422 } // namespace content
422 423
423 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ 424 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698