| 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 <inttypes.h> | 7 #include <inttypes.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cctype> // for std::isalnum | 10 #include <cctype> // for std::isalnum |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 map_ = new DOMStorageMap(kPerStorageAreaQuota + | 300 map_ = new DOMStorageMap(kPerStorageAreaQuota + |
| 301 kPerStorageAreaOverQuotaAllowance); | 301 kPerStorageAreaOverQuotaAllowance); |
| 302 if (backing_) { | 302 if (backing_) { |
| 303 is_initial_import_done_ = false; | 303 is_initial_import_done_ = false; |
| 304 backing_->Reset(); | 304 backing_->Reset(); |
| 305 backing_->DeleteFiles(); | 305 backing_->DeleteFiles(); |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 | 308 |
| 309 void DOMStorageArea::PurgeMemory() { | 309 void DOMStorageArea::PurgeMemory() { |
| 310 /* |
| 310 DCHECK(!is_shutdown_); | 311 DCHECK(!is_shutdown_); |
| 311 // Purging sessionStorage is not supported; it won't work with FastClear. | 312 // Purging sessionStorage is not supported; it won't work with FastClear. |
| 312 DCHECK(!session_storage_backing_.get()); | 313 DCHECK(!session_storage_backing_.get()); |
| 313 if (!is_initial_import_done_ || // We're not using any memory. | 314 if (!is_initial_import_done_ || // We're not using any memory. |
| 314 !backing_.get() || // We can't purge anything. | 315 !backing_.get() || // We can't purge anything. |
| 315 HasUncommittedChanges()) // We leave things alone with changes pending. | 316 HasUncommittedChanges()) // We leave things alone with changes pending. |
| 316 return; | 317 return; |
| 317 | 318 |
| 318 // Drop the in memory cache, we'll reload when needed. | 319 // Drop the in memory cache, we'll reload when needed. |
| 319 is_initial_import_done_ = false; | 320 is_initial_import_done_ = false; |
| 320 map_ = new DOMStorageMap(kPerStorageAreaQuota + | 321 map_ = new DOMStorageMap(kPerStorageAreaQuota + |
| 321 kPerStorageAreaOverQuotaAllowance); | 322 kPerStorageAreaOverQuotaAllowance); |
| 322 | 323 |
| 323 // Recreate the database object, this frees up the open sqlite connection | 324 // Recreate the database object, this frees up the open sqlite connection |
| 324 // and its page cache. | 325 // and its page cache. |
| 325 backing_->Reset(); | 326 backing_->Reset(); |
| 327 */ |
| 326 } | 328 } |
| 327 | 329 |
| 328 void DOMStorageArea::Shutdown() { | 330 void DOMStorageArea::Shutdown() { |
| 329 if (is_shutdown_) | 331 if (is_shutdown_) |
| 330 return; | 332 return; |
| 331 is_shutdown_ = true; | 333 is_shutdown_ = true; |
| 332 | 334 |
| 333 if (commit_batch_) { | 335 if (commit_batch_) { |
| 334 DCHECK(backing_); | 336 DCHECK(backing_); |
| 335 PopulateCommitBatchValues(); | 337 PopulateCommitBatchValues(); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 commit_batch_->clear_all_first, | 545 commit_batch_->clear_all_first, |
| 544 commit_batch_->changed_values); | 546 commit_batch_->changed_values); |
| 545 DCHECK(success); | 547 DCHECK(success); |
| 546 } | 548 } |
| 547 commit_batch_.reset(); | 549 commit_batch_.reset(); |
| 548 backing_.reset(); | 550 backing_.reset(); |
| 549 session_storage_backing_ = NULL; | 551 session_storage_backing_ = NULL; |
| 550 } | 552 } |
| 551 | 553 |
| 552 } // namespace content | 554 } // namespace content |
| OLD | NEW |