| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/process/process_info.h" | 13 #include "base/process/process_info.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "content/browser/dom_storage/dom_storage_namespace.h" | 16 #include "content/browser/dom_storage/dom_storage_namespace.h" |
| 17 #include "content/browser/dom_storage/dom_storage_task_runner.h" | 17 #include "content/browser/dom_storage/dom_storage_task_runner.h" |
| 18 #include "content/browser/dom_storage/local_storage_database_adapter.h" | 18 #include "content/browser/dom_storage/local_storage_database_adapter.h" |
| 19 #include "content/browser/dom_storage/session_storage_database.h" | 19 #include "content/browser/dom_storage/session_storage_database.h" |
| 20 #include "content/browser/dom_storage/session_storage_database_adapter.h" | 20 #include "content/browser/dom_storage/session_storage_database_adapter.h" |
| 21 #include "content/common/dom_storage/dom_storage_map.h" | 21 #include "content/common/dom_storage/dom_storage_map.h" |
| 22 #include "content/common/dom_storage/dom_storage_types.h" | 22 #include "content/common/dom_storage/dom_storage_types.h" |
| 23 #include "content/public/browser/browser_thread.h" |
| 23 #include "storage/browser/database/database_util.h" | 24 #include "storage/browser/database/database_util.h" |
| 24 #include "storage/common/database/database_identifier.h" | 25 #include "storage/common/database/database_identifier.h" |
| 25 #include "storage/common/fileapi/file_system_util.h" | 26 #include "storage/common/fileapi/file_system_util.h" |
| 26 | 27 |
| 27 using storage::DatabaseUtil; | 28 using storage::DatabaseUtil; |
| 28 | 29 |
| 29 namespace content { | 30 namespace content { |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 390 |
| 390 void DOMStorageArea::OnCommitTimer() { | 391 void DOMStorageArea::OnCommitTimer() { |
| 391 if (is_shutdown_) | 392 if (is_shutdown_) |
| 392 return; | 393 return; |
| 393 | 394 |
| 394 // It's possible that there is nothing to commit if an immediate | 395 // It's possible that there is nothing to commit if an immediate |
| 395 // commit occured after the timer was scheduled but before it fired. | 396 // commit occured after the timer was scheduled but before it fired. |
| 396 if (!commit_batch_) | 397 if (!commit_batch_) |
| 397 return; | 398 return; |
| 398 | 399 |
| 399 PostCommitTask(); | 400 BrowserThread::PostAfterStartupTask( |
| 401 FROM_HERE, |
| 402 task_runner_, |
| 403 base::Bind(&DOMStorageArea::PostCommitTask, this)); |
| 400 } | 404 } |
| 401 | 405 |
| 402 void DOMStorageArea::PostCommitTask() { | 406 void DOMStorageArea::PostCommitTask() { |
| 403 if (is_shutdown_ || !commit_batch_) | 407 if (is_shutdown_ || !commit_batch_) |
| 404 return; | 408 return; |
| 405 | 409 |
| 406 DCHECK(backing_.get()); | 410 DCHECK(backing_.get()); |
| 407 | 411 |
| 408 commit_rate_limiter_.add_samples(1); | 412 commit_rate_limiter_.add_samples(1); |
| 409 data_rate_limiter_.add_samples(commit_batch_->GetDataSize()); | 413 data_rate_limiter_.add_samples(commit_batch_->GetDataSize()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 commit_batch_->clear_all_first, | 460 commit_batch_->clear_all_first, |
| 457 commit_batch_->changed_values); | 461 commit_batch_->changed_values); |
| 458 DCHECK(success); | 462 DCHECK(success); |
| 459 } | 463 } |
| 460 commit_batch_.reset(); | 464 commit_batch_.reset(); |
| 461 backing_.reset(); | 465 backing_.reset(); |
| 462 session_storage_backing_ = NULL; | 466 session_storage_backing_ = NULL; |
| 463 } | 467 } |
| 464 | 468 |
| 465 } // namespace content | 469 } // namespace content |
| OLD | NEW |