| OLD | NEW |
| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 GURL scope; | 57 GURL scope; |
| 58 | 58 |
| 59 // Versions are first stored once they successfully install and become | 59 // Versions are first stored once they successfully install and become |
| 60 // the waiting version. Then transition to the active version. The stored | 60 // the waiting version. Then transition to the active version. The stored |
| 61 // version may be in the ACTIVATED state or in the INSTALLED state. | 61 // version may be in the ACTIVATED state or in the INSTALLED state. |
| 62 GURL script; | 62 GURL script; |
| 63 int64 version_id; | 63 int64 version_id; |
| 64 bool is_active; | 64 bool is_active; |
| 65 bool has_fetch_handler; | 65 bool has_fetch_handler; |
| 66 base::Time last_update_check; | 66 base::Time last_update_check; |
| 67 std::vector<GURL> foreign_fetch_scopes; |
| 67 | 68 |
| 68 // Not populated until ServiceWorkerStorage::StoreRegistration is called. | 69 // Not populated until ServiceWorkerStorage::StoreRegistration is called. |
| 69 int64_t resources_total_size_bytes; | 70 int64_t resources_total_size_bytes; |
| 70 | 71 |
| 71 RegistrationData(); | 72 RegistrationData(); |
| 72 ~RegistrationData(); | 73 ~RegistrationData(); |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 struct ResourceRecord { | 76 struct ResourceRecord { |
| 76 int64 resource_id; | 77 int64 resource_id; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 100 // Used for diskcache migration (http://crbug.com/487482). Returns true if the | 101 // Used for diskcache migration (http://crbug.com/487482). Returns true if the |
| 101 // storage needs to delete an old disk cache. | 102 // storage needs to delete an old disk cache. |
| 102 Status IsOldDiskCacheDeletionNeeded(bool* deletion_needed); | 103 Status IsOldDiskCacheDeletionNeeded(bool* deletion_needed); |
| 103 Status SetOldDiskCacheDeletionNotNeeded(); | 104 Status SetOldDiskCacheDeletionNotNeeded(); |
| 104 | 105 |
| 105 // Reads origins that have one or more than one registration from the | 106 // Reads origins that have one or more than one registration from the |
| 106 // database. Returns OK if they are successfully read or not found. | 107 // database. Returns OK if they are successfully read or not found. |
| 107 // Otherwise, returns an error. | 108 // Otherwise, returns an error. |
| 108 Status GetOriginsWithRegistrations(std::set<GURL>* origins); | 109 Status GetOriginsWithRegistrations(std::set<GURL>* origins); |
| 109 | 110 |
| 111 // Reads origins that have one or more than one registration with at least one |
| 112 // foreign fetch scope registered. Returns OK if they are successfully read or |
| 113 // not found. Otherwise returns an error. |
| 114 Status GetOriginsWithForeignFetchRegistrations(std::set<GURL>* origins); |
| 115 |
| 110 // Reads registrations for |origin| from the database. Returns OK if they are | 116 // Reads registrations for |origin| from the database. Returns OK if they are |
| 111 // successfully read or not found. Otherwise, returns an error. | 117 // successfully read or not found. Otherwise, returns an error. |
| 112 Status GetRegistrationsForOrigin( | 118 Status GetRegistrationsForOrigin( |
| 113 const GURL& origin, | 119 const GURL& origin, |
| 114 std::vector<RegistrationData>* registrations, | 120 std::vector<RegistrationData>* registrations, |
| 115 std::vector<std::vector<ResourceRecord>>* opt_resources_list); | 121 std::vector<std::vector<ResourceRecord>>* opt_resources_list); |
| 116 | 122 |
| 117 // Reads all registrations from the database. Returns OK if successfully read | 123 // Reads all registrations from the database. Returns OK if successfully read |
| 118 // or not found. Otherwise, returns an error. | 124 // or not found. Otherwise, returns an error. |
| 119 Status GetAllRegistrations(std::vector<RegistrationData>* registrations); | 125 Status GetAllRegistrations(std::vector<RegistrationData>* registrations); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 MigrateOnDiskCacheAccess); | 395 MigrateOnDiskCacheAccess); |
| 390 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDiskCacheMigratorTest, | 396 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDiskCacheMigratorTest, |
| 391 NotMigrateOnDatabaseAccess); | 397 NotMigrateOnDatabaseAccess); |
| 392 | 398 |
| 393 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); | 399 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); |
| 394 }; | 400 }; |
| 395 | 401 |
| 396 } // namespace content | 402 } // namespace content |
| 397 | 403 |
| 398 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ | 404 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ |
| OLD | NEW |