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 #include "content/browser/service_worker/service_worker_storage.h" | 5 #include "content/browser/service_worker/service_worker_storage.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 |
8 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/sequenced_task_runner.h" |
9 #include "content/browser/service_worker/service_worker_context_core.h" | 11 #include "content/browser/service_worker/service_worker_context_core.h" |
10 #include "content/browser/service_worker/service_worker_info.h" | 12 #include "content/browser/service_worker/service_worker_info.h" |
11 #include "content/browser/service_worker/service_worker_registration.h" | 13 #include "content/browser/service_worker/service_worker_registration.h" |
12 #include "content/browser/service_worker/service_worker_utils.h" | 14 #include "content/browser/service_worker/service_worker_utils.h" |
13 #include "content/browser/service_worker/service_worker_version.h" | 15 #include "content/browser/service_worker/service_worker_version.h" |
14 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
15 #include "webkit/browser/quota/quota_manager_proxy.h" | 17 #include "webkit/browser/quota/quota_manager_proxy.h" |
16 | 18 |
17 namespace content { | 19 namespace content { |
18 | 20 |
(...skipping 20 matching lines...) Expand all Loading... |
39 } | 41 } |
40 | 42 |
41 const base::FilePath::CharType kServiceWorkerDirectory[] = | 43 const base::FilePath::CharType kServiceWorkerDirectory[] = |
42 FILE_PATH_LITERAL("ServiceWorker"); | 44 FILE_PATH_LITERAL("ServiceWorker"); |
43 | 45 |
44 } // namespace | 46 } // namespace |
45 | 47 |
46 ServiceWorkerStorage::ServiceWorkerStorage( | 48 ServiceWorkerStorage::ServiceWorkerStorage( |
47 const base::FilePath& path, | 49 const base::FilePath& path, |
48 base::WeakPtr<ServiceWorkerContextCore> context, | 50 base::WeakPtr<ServiceWorkerContextCore> context, |
| 51 base::SequencedTaskRunner* database_task_runner, |
49 quota::QuotaManagerProxy* quota_manager_proxy) | 52 quota::QuotaManagerProxy* quota_manager_proxy) |
50 : last_registration_id_(0), | 53 : last_registration_id_(0), |
51 last_version_id_(0), | 54 last_version_id_(0), |
52 last_resource_id_(0), | 55 last_resource_id_(0), |
53 simulated_lazy_initted_(false), | 56 simulated_lazy_initted_(false), |
54 context_(context), | 57 context_(context), |
| 58 database_task_runner_(database_task_runner), |
55 quota_manager_proxy_(quota_manager_proxy) { | 59 quota_manager_proxy_(quota_manager_proxy) { |
56 if (!path.empty()) | 60 if (!path.empty()) |
57 path_ = path.Append(kServiceWorkerDirectory); | 61 path_ = path.Append(kServiceWorkerDirectory); |
58 } | 62 } |
59 | 63 |
60 ServiceWorkerStorage::~ServiceWorkerStorage() { | 64 ServiceWorkerStorage::~ServiceWorkerStorage() { |
61 } | 65 } |
62 | 66 |
63 void ServiceWorkerStorage::FindRegistrationForPattern( | 67 void ServiceWorkerStorage::FindRegistrationForPattern( |
64 const GURL& scope, | 68 const GURL& scope, |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 ServiceWorkerStorage::FindInstallingRegistrationForId( | 418 ServiceWorkerStorage::FindInstallingRegistrationForId( |
415 int64 registration_id) { | 419 int64 registration_id) { |
416 RegistrationRefsById::const_iterator found = | 420 RegistrationRefsById::const_iterator found = |
417 installing_registrations_.find(registration_id); | 421 installing_registrations_.find(registration_id); |
418 if (found == installing_registrations_.end()) | 422 if (found == installing_registrations_.end()) |
419 return NULL; | 423 return NULL; |
420 return found->second; | 424 return found->second; |
421 } | 425 } |
422 | 426 |
423 } // namespace content | 427 } // namespace content |
OLD | NEW |