Chromium Code Reviews| 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/dom_storage/dom_storage_area.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 if (namespace_id == kLocalStorageNamespaceId && !directory.empty()) { | 64 if (namespace_id == kLocalStorageNamespaceId && !directory.empty()) { |
| 65 FilePath path = directory.Append(DatabaseFileNameFromOrigin(origin_)); | 65 FilePath path = directory.Append(DatabaseFileNameFromOrigin(origin_)); |
| 66 backing_.reset(new DomStorageDatabase(path)); | 66 backing_.reset(new DomStorageDatabase(path)); |
| 67 is_initial_import_done_ = false; | 67 is_initial_import_done_ = false; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 DomStorageArea::~DomStorageArea() { | 71 DomStorageArea::~DomStorageArea() { |
| 72 } | 72 } |
| 73 | 73 |
| 74 void DomStorageArea::ExtractValues(ValuesMap* map) { | |
| 75 if (is_shutdown_) | |
| 76 return; | |
| 77 InitialImportIfNeeded(); | |
| 78 ValuesMap current_values; | |
| 79 map_->SwapValues(¤t_values); | |
|
ericu
2012/04/20 23:36:00
As discussed, SwapValues leads to too much account
michaeln
2012/04/20 23:42:19
Yup, done.
| |
| 80 *map = current_values; | |
| 81 map_->SwapValues(¤t_values); | |
| 82 } | |
| 83 | |
| 74 unsigned DomStorageArea::Length() { | 84 unsigned DomStorageArea::Length() { |
| 75 if (is_shutdown_) | 85 if (is_shutdown_) |
| 76 return 0; | 86 return 0; |
| 77 InitialImportIfNeeded(); | 87 InitialImportIfNeeded(); |
| 78 return map_->Length(); | 88 return map_->Length(); |
| 79 } | 89 } |
| 80 | 90 |
| 81 NullableString16 DomStorageArea::Key(unsigned index) { | 91 NullableString16 DomStorageArea::Key(unsigned index) { |
| 82 if (is_shutdown_) | 92 if (is_shutdown_) |
| 83 return NullableString16(true); | 93 return NullableString16(true); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 commit_batch_->clear_all_first, | 307 commit_batch_->clear_all_first, |
| 298 commit_batch_->changed_values); | 308 commit_batch_->changed_values); |
| 299 DCHECK(success); | 309 DCHECK(success); |
| 300 } | 310 } |
| 301 commit_batch_.reset(); | 311 commit_batch_.reset(); |
| 302 in_flight_commit_batch_.reset(); | 312 in_flight_commit_batch_.reset(); |
| 303 backing_.reset(); | 313 backing_.reset(); |
| 304 } | 314 } |
| 305 | 315 |
| 306 } // namespace dom_storage | 316 } // namespace dom_storage |
| OLD | NEW |