Respond with QuotaExceededError when IndexedDB has no disk space on open.
[chromium-blink-merge.git] / content / browser / worker_host / worker_storage_partition.cc
blob2c9105721f37c94cae12d9ce0fee5db3e930fbd7
1 // Copyright (c) 2012 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/worker_host/worker_storage_partition.h"
7 #include <string>
9 #include "content/browser/appcache/chrome_appcache_service.h"
10 #include "content/browser/indexed_db/indexed_db_context_impl.h"
11 #include "net/url_request/url_request_context_getter.h"
12 #include "webkit/browser/database/database_tracker.h"
13 #include "webkit/browser/fileapi/file_system_context.h"
14 #include "webkit/browser/quota/quota_manager.h"
16 namespace content {
18 WorkerStoragePartition::WorkerStoragePartition(
19 net::URLRequestContextGetter* url_request_context,
20 net::URLRequestContextGetter* media_url_request_context,
21 ChromeAppCacheService* appcache_service,
22 quota::QuotaManager* quota_manager,
23 fileapi::FileSystemContext* filesystem_context,
24 webkit_database::DatabaseTracker* database_tracker,
25 IndexedDBContextImpl* indexed_db_context)
26 : url_request_context_(url_request_context),
27 media_url_request_context_(media_url_request_context),
28 appcache_service_(appcache_service),
29 quota_manager_(quota_manager),
30 filesystem_context_(filesystem_context),
31 database_tracker_(database_tracker),
32 indexed_db_context_(indexed_db_context) {
35 WorkerStoragePartition::WorkerStoragePartition(
36 const WorkerStoragePartition& other) {
37 Copy(other);
40 const WorkerStoragePartition& WorkerStoragePartition::operator=(
41 const WorkerStoragePartition& rhs) {
42 Copy(rhs);
43 return *this;
46 bool WorkerStoragePartition::Equals(
47 const WorkerStoragePartition& other) const {
48 return url_request_context_.get() == other.url_request_context_.get() &&
49 media_url_request_context_.get() ==
50 other.media_url_request_context_.get() &&
51 appcache_service_.get() == other.appcache_service_.get() &&
52 quota_manager_.get() == other.quota_manager_.get() &&
53 filesystem_context_.get() == other.filesystem_context_.get() &&
54 database_tracker_.get() == other.database_tracker_.get() &&
55 indexed_db_context_.get() == other.indexed_db_context_.get();
58 WorkerStoragePartition::~WorkerStoragePartition() {
61 void WorkerStoragePartition::Copy(const WorkerStoragePartition& other) {
62 url_request_context_ = other.url_request_context_;
63 media_url_request_context_ = other.media_url_request_context_;
64 appcache_service_ = other.appcache_service_;
65 quota_manager_ = other.quota_manager_;
66 filesystem_context_ = other.filesystem_context_;
67 database_tracker_ = other.database_tracker_;
68 indexed_db_context_ = other.indexed_db_context_;
71 } // namespace content