OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "webkit/dom_storage/dom_storage_area.h" | 5 #include "webkit/browser/dom_storage/dom_storage_area.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 13 #include "third_party/WebKit/public/platform/WebString.h" |
14 #include "webkit/base/file_path_string_conversions.h" | 14 #include "webkit/base/file_path_string_conversions.h" |
15 #include "webkit/base/origin_url_conversions.h" | 15 #include "webkit/base/origin_url_conversions.h" |
16 #include "webkit/browser/database/database_util.h" | 16 #include "webkit/browser/database/database_util.h" |
| 17 #include "webkit/browser/dom_storage/dom_storage_namespace.h" |
| 18 #include "webkit/browser/dom_storage/dom_storage_task_runner.h" |
| 19 #include "webkit/browser/dom_storage/local_storage_database_adapter.h" |
| 20 #include "webkit/browser/dom_storage/session_storage_database.h" |
| 21 #include "webkit/browser/dom_storage/session_storage_database_adapter.h" |
| 22 #include "webkit/common/dom_storage/dom_storage_map.h" |
| 23 #include "webkit/common/dom_storage/dom_storage_types.h" |
17 #include "webkit/common/fileapi/file_system_util.h" | 24 #include "webkit/common/fileapi/file_system_util.h" |
18 #include "webkit/dom_storage/dom_storage_map.h" | |
19 #include "webkit/dom_storage/dom_storage_namespace.h" | |
20 #include "webkit/dom_storage/dom_storage_task_runner.h" | |
21 #include "webkit/dom_storage/dom_storage_types.h" | |
22 #include "webkit/dom_storage/local_storage_database_adapter.h" | |
23 #include "webkit/dom_storage/session_storage_database.h" | |
24 #include "webkit/dom_storage/session_storage_database_adapter.h" | |
25 | 25 |
26 using webkit_database::DatabaseUtil; | 26 using webkit_database::DatabaseUtil; |
27 | 27 |
28 namespace dom_storage { | 28 namespace dom_storage { |
29 | 29 |
30 static const int kCommitTimerSeconds = 1; | 30 static const int kCommitTimerSeconds = 1; |
31 | 31 |
32 DomStorageArea::CommitBatch::CommitBatch() | 32 DomStorageArea::CommitBatch::CommitBatch() |
33 : clear_all_first(false) { | 33 : clear_all_first(false) { |
34 } | 34 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 } | 196 } |
197 | 197 |
198 DomStorageArea* DomStorageArea::ShallowCopy( | 198 DomStorageArea* DomStorageArea::ShallowCopy( |
199 int64 destination_namespace_id, | 199 int64 destination_namespace_id, |
200 const std::string& destination_persistent_namespace_id) { | 200 const std::string& destination_persistent_namespace_id) { |
201 DCHECK_NE(kLocalStorageNamespaceId, namespace_id_); | 201 DCHECK_NE(kLocalStorageNamespaceId, namespace_id_); |
202 DCHECK_NE(kLocalStorageNamespaceId, destination_namespace_id); | 202 DCHECK_NE(kLocalStorageNamespaceId, destination_namespace_id); |
203 | 203 |
204 DomStorageArea* copy = new DomStorageArea( | 204 DomStorageArea* copy = new DomStorageArea( |
205 destination_namespace_id, destination_persistent_namespace_id, origin_, | 205 destination_namespace_id, destination_persistent_namespace_id, origin_, |
206 session_storage_backing_, task_runner_); | 206 session_storage_backing_.get(), task_runner_.get()); |
207 copy->map_ = map_; | 207 copy->map_ = map_; |
208 copy->is_shutdown_ = is_shutdown_; | 208 copy->is_shutdown_ = is_shutdown_; |
209 copy->is_initial_import_done_ = true; | 209 copy->is_initial_import_done_ = true; |
210 | 210 |
211 // All the uncommitted changes to this area need to happen before the actual | 211 // All the uncommitted changes to this area need to happen before the actual |
212 // shallow copy is made (scheduled by the upper layer). Another OnCommitTimer | 212 // shallow copy is made (scheduled by the upper layer). Another OnCommitTimer |
213 // call might be in the event queue at this point, but it's handled gracefully | 213 // call might be in the event queue at this point, but it's handled gracefully |
214 // when it fires. | 214 // when it fires. |
215 if (commit_batch_) | 215 if (commit_batch_) |
216 OnCommitTimer(); | 216 OnCommitTimer(); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 commit_batch_->clear_all_first, | 389 commit_batch_->clear_all_first, |
390 commit_batch_->changed_values); | 390 commit_batch_->changed_values); |
391 DCHECK(success); | 391 DCHECK(success); |
392 } | 392 } |
393 commit_batch_.reset(); | 393 commit_batch_.reset(); |
394 backing_.reset(); | 394 backing_.reset(); |
395 session_storage_backing_ = NULL; | 395 session_storage_backing_ = NULL; |
396 } | 396 } |
397 | 397 |
398 } // namespace dom_storage | 398 } // namespace dom_storage |
OLD | NEW |