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/dom_storage/dom_storage_area.h" | 5 #include "content/browser/dom_storage/dom_storage_area.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 start_time_(base::TimeTicks::Now()), | 111 start_time_(base::TimeTicks::Now()), |
112 data_rate_limiter_(kMaxBytesPerHour, base::TimeDelta::FromHours(1)), | 112 data_rate_limiter_(kMaxBytesPerHour, base::TimeDelta::FromHours(1)), |
113 commit_rate_limiter_(kMaxCommitsPerHour, base::TimeDelta::FromHours(1)) { | 113 commit_rate_limiter_(kMaxCommitsPerHour, base::TimeDelta::FromHours(1)) { |
114 if (!directory.empty()) { | 114 if (!directory.empty()) { |
115 base::FilePath path = directory.Append(DatabaseFileNameFromOrigin(origin_)); | 115 base::FilePath path = directory.Append(DatabaseFileNameFromOrigin(origin_)); |
116 backing_.reset(new LocalStorageDatabaseAdapter(path)); | 116 backing_.reset(new LocalStorageDatabaseAdapter(path)); |
117 is_initial_import_done_ = false; | 117 is_initial_import_done_ = false; |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 DOMStorageArea::DOMStorageArea(int64 namespace_id, | 121 DOMStorageArea::DOMStorageArea(int64_t namespace_id, |
122 const std::string& persistent_namespace_id, | 122 const std::string& persistent_namespace_id, |
123 const GURL& origin, | 123 const GURL& origin, |
124 SessionStorageDatabase* session_storage_backing, | 124 SessionStorageDatabase* session_storage_backing, |
125 DOMStorageTaskRunner* task_runner) | 125 DOMStorageTaskRunner* task_runner) |
126 : namespace_id_(namespace_id), | 126 : namespace_id_(namespace_id), |
127 persistent_namespace_id_(persistent_namespace_id), | 127 persistent_namespace_id_(persistent_namespace_id), |
128 origin_(origin), | 128 origin_(origin), |
129 task_runner_(task_runner), | 129 task_runner_(task_runner), |
130 map_(new DOMStorageMap(kPerStorageAreaQuota + | 130 map_(new DOMStorageMap(kPerStorageAreaQuota + |
131 kPerStorageAreaOverQuotaAllowance)), | 131 kPerStorageAreaOverQuotaAllowance)), |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 is_initial_import_done_ = true; | 240 is_initial_import_done_ = true; |
241 | 241 |
242 if (backing_) { | 242 if (backing_) { |
243 CommitBatch* commit_batch = CreateCommitBatchIfNeeded(); | 243 CommitBatch* commit_batch = CreateCommitBatchIfNeeded(); |
244 commit_batch->clear_all_first = true; | 244 commit_batch->clear_all_first = true; |
245 commit_batch->changed_values.clear(); | 245 commit_batch->changed_values.clear(); |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 DOMStorageArea* DOMStorageArea::ShallowCopy( | 249 DOMStorageArea* DOMStorageArea::ShallowCopy( |
250 int64 destination_namespace_id, | 250 int64_t destination_namespace_id, |
251 const std::string& destination_persistent_namespace_id) { | 251 const std::string& destination_persistent_namespace_id) { |
252 DCHECK_NE(kLocalStorageNamespaceId, namespace_id_); | 252 DCHECK_NE(kLocalStorageNamespaceId, namespace_id_); |
253 DCHECK_NE(kLocalStorageNamespaceId, destination_namespace_id); | 253 DCHECK_NE(kLocalStorageNamespaceId, destination_namespace_id); |
254 | 254 |
255 DOMStorageArea* copy = new DOMStorageArea( | 255 DOMStorageArea* copy = new DOMStorageArea( |
256 destination_namespace_id, destination_persistent_namespace_id, origin_, | 256 destination_namespace_id, destination_persistent_namespace_id, origin_, |
257 session_storage_backing_.get(), task_runner_.get()); | 257 session_storage_backing_.get(), task_runner_.get()); |
258 copy->map_ = map_; | 258 copy->map_ = map_; |
259 copy->is_shutdown_ = is_shutdown_; | 259 copy->is_shutdown_ = is_shutdown_; |
260 copy->is_initial_import_done_ = true; | 260 copy->is_initial_import_done_ = true; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 commit_batch_->clear_all_first, | 475 commit_batch_->clear_all_first, |
476 commit_batch_->changed_values); | 476 commit_batch_->changed_values); |
477 DCHECK(success); | 477 DCHECK(success); |
478 } | 478 } |
479 commit_batch_.reset(); | 479 commit_batch_.reset(); |
480 backing_.reset(); | 480 backing_.reset(); |
481 session_storage_backing_ = NULL; | 481 session_storage_backing_ = NULL; |
482 } | 482 } |
483 | 483 |
484 } // namespace content | 484 } // namespace content |
OLD | NEW |