| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |