| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_STORAGE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // conflicting registration (which has different script_url) is | 49 // conflicting registration (which has different script_url) is |
| 50 // already registered for the |registration|->pattern(). | 50 // already registered for the |registration|->pattern(). |
| 51 void StoreRegistration(ServiceWorkerRegistration* registration, | 51 void StoreRegistration(ServiceWorkerRegistration* registration, |
| 52 const StatusCallback& callback); | 52 const StatusCallback& callback); |
| 53 | 53 |
| 54 // Deletes |registration|. This may return SERVICE_WORKER_ERROR_NOT_FOUND | 54 // Deletes |registration|. This may return SERVICE_WORKER_ERROR_NOT_FOUND |
| 55 // if no matching registration is found. | 55 // if no matching registration is found. |
| 56 void DeleteRegistration(const GURL& pattern, | 56 void DeleteRegistration(const GURL& pattern, |
| 57 const StatusCallback& callback); | 57 const StatusCallback& callback); |
| 58 | 58 |
| 59 // Returns new registration ID which is guaranteed to be unique in | 59 // Returns new IDs which are guaranteed to be unique in the storage. |
| 60 // the storage. | |
| 61 int64 NewRegistrationId(); | 60 int64 NewRegistrationId(); |
| 61 int64 NewVersionId(); |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerStorageTest, PatternMatches); | 64 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerStorageTest, PatternMatches); |
| 65 | 65 |
| 66 typedef std::map<GURL, scoped_refptr<ServiceWorkerRegistration> > | 66 typedef std::map<GURL, scoped_refptr<ServiceWorkerRegistration> > |
| 67 PatternToRegistrationMap; | 67 PatternToRegistrationMap; |
| 68 | 68 |
| 69 static bool PatternMatches(const GURL& pattern, const GURL& script_url); | 69 static bool PatternMatches(const GURL& pattern, const GURL& script_url); |
| 70 | 70 |
| 71 // This is the in-memory registration. Eventually the registration will be | 71 // This is the in-memory registration. Eventually the registration will be |
| 72 // persisted to disk. | 72 // persisted to disk. |
| 73 PatternToRegistrationMap registration_by_pattern_; | 73 PatternToRegistrationMap registration_by_pattern_; |
| 74 | 74 |
| 75 int last_registration_id_; | 75 int last_registration_id_; |
| 76 int last_version_id_; |
| 76 | 77 |
| 77 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 78 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| 78 base::FilePath path_; | 79 base::FilePath path_; |
| 79 | 80 |
| 80 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); | 81 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 } // namespace content | 84 } // namespace content |
| 84 | 85 |
| 85 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 86 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
| OLD | NEW |