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
3 // found in the LICENSE file.
5 #include "content/browser/shared_worker/worker_storage_partition.h"
9 #include "content/browser/appcache/chrome_appcache_service.h"
10 #include "content/browser/indexed_db/indexed_db_context_impl.h"
11 #include "content/browser/service_worker/service_worker_context_wrapper.h"
12 #include "net/url_request/url_request_context_getter.h"
13 #include "storage/browser/database/database_tracker.h"
14 #include "storage/browser/fileapi/file_system_context.h"
15 #include "storage/browser/quota/quota_manager.h"
19 WorkerStoragePartition::WorkerStoragePartition(
20 net::URLRequestContextGetter
* url_request_context
,
21 net::URLRequestContextGetter
* media_url_request_context
,
22 ChromeAppCacheService
* appcache_service
,
23 storage::QuotaManager
* quota_manager
,
24 storage::FileSystemContext
* filesystem_context
,
25 storage::DatabaseTracker
* database_tracker
,
26 IndexedDBContextImpl
* indexed_db_context
,
27 ServiceWorkerContextWrapper
* service_worker_context
)
28 : url_request_context_(url_request_context
),
29 media_url_request_context_(media_url_request_context
),
30 appcache_service_(appcache_service
),
31 quota_manager_(quota_manager
),
32 filesystem_context_(filesystem_context
),
33 database_tracker_(database_tracker
),
34 indexed_db_context_(indexed_db_context
),
35 service_worker_context_(service_worker_context
) {
38 WorkerStoragePartition::WorkerStoragePartition(
39 const WorkerStoragePartition
& other
) {
43 const WorkerStoragePartition
& WorkerStoragePartition::operator=(
44 const WorkerStoragePartition
& rhs
) {
49 bool WorkerStoragePartition::Equals(
50 const WorkerStoragePartition
& other
) const {
51 return url_request_context_
.get() == other
.url_request_context_
.get() &&
52 media_url_request_context_
.get() ==
53 other
.media_url_request_context_
.get() &&
54 appcache_service_
.get() == other
.appcache_service_
.get() &&
55 quota_manager_
.get() == other
.quota_manager_
.get() &&
56 filesystem_context_
.get() == other
.filesystem_context_
.get() &&
57 database_tracker_
.get() == other
.database_tracker_
.get() &&
58 indexed_db_context_
.get() == other
.indexed_db_context_
.get() &&
59 service_worker_context_
.get() == other
.service_worker_context_
.get();
62 WorkerStoragePartition::~WorkerStoragePartition() {
65 void WorkerStoragePartition::Copy(const WorkerStoragePartition
& other
) {
66 url_request_context_
= other
.url_request_context_
;
67 media_url_request_context_
= other
.media_url_request_context_
;
68 appcache_service_
= other
.appcache_service_
;
69 quota_manager_
= other
.quota_manager_
;
70 filesystem_context_
= other
.filesystem_context_
;
71 database_tracker_
= other
.database_tracker_
;
72 indexed_db_context_
= other
.indexed_db_context_
;
73 service_worker_context_
= other
.service_worker_context_
;
76 WorkerStoragePartitionId::WorkerStoragePartitionId(
77 const WorkerStoragePartition
& partition
)
78 : url_request_context_(partition
.url_request_context()),
79 media_url_request_context_(partition
.media_url_request_context()),
80 appcache_service_(partition
.appcache_service()),
81 quota_manager_(partition
.quota_manager()),
82 filesystem_context_(partition
.filesystem_context()),
83 database_tracker_(partition
.database_tracker()),
84 indexed_db_context_(partition
.indexed_db_context()),
85 service_worker_context_(partition
.service_worker_context()) {
88 WorkerStoragePartitionId::~WorkerStoragePartitionId() {
91 bool WorkerStoragePartitionId::Equals(
92 const WorkerStoragePartitionId
& other
) const {
93 return url_request_context_
== other
.url_request_context_
&&
94 media_url_request_context_
== other
.media_url_request_context_
&&
95 appcache_service_
== other
.appcache_service_
&&
96 quota_manager_
== other
.quota_manager_
&&
97 filesystem_context_
== other
.filesystem_context_
&&
98 database_tracker_
== other
.database_tracker_
&&
99 indexed_db_context_
== other
.indexed_db_context_
&&
100 service_worker_context_
== other
.service_worker_context_
;
103 } // namespace content