| 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 "content/browser/indexed_db/indexed_db_context_impl.h" | 5 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 } | 461 } |
| 462 | 462 |
| 463 void IndexedDBContextImpl::DatabaseDeleted(const Origin& origin) { | 463 void IndexedDBContextImpl::DatabaseDeleted(const Origin& origin) { |
| 464 AddToOriginSet(origin); | 464 AddToOriginSet(origin); |
| 465 QueryDiskAndUpdateQuotaUsage(origin); | 465 QueryDiskAndUpdateQuotaUsage(origin); |
| 466 } | 466 } |
| 467 | 467 |
| 468 IndexedDBContextImpl::~IndexedDBContextImpl() { | 468 IndexedDBContextImpl::~IndexedDBContextImpl() { |
| 469 if (factory_.get()) { | 469 if (factory_.get()) { |
| 470 TaskRunner()->PostTask(FROM_HERE, | 470 TaskRunner()->PostTask(FROM_HERE, |
| 471 base::Bind(&IndexedDBFactory::ContextDestroyed, | 471 base::BindOnce(&IndexedDBFactory::ContextDestroyed, |
| 472 base::Passed(&factory_))); | 472 base::Passed(&factory_))); |
| 473 } | 473 } |
| 474 | 474 |
| 475 if (data_path_.empty()) | 475 if (data_path_.empty()) |
| 476 return; | 476 return; |
| 477 | 477 |
| 478 if (force_keep_session_state_) | 478 if (force_keep_session_state_) |
| 479 return; | 479 return; |
| 480 | 480 |
| 481 bool has_session_only_databases = | 481 bool has_session_only_databases = |
| 482 special_storage_policy_.get() && | 482 special_storage_policy_.get() && |
| 483 special_storage_policy_->HasSessionOnlyOrigins(); | 483 special_storage_policy_->HasSessionOnlyOrigins(); |
| 484 | 484 |
| 485 // Clearing only session-only databases, and there are none. | 485 // Clearing only session-only databases, and there are none. |
| 486 if (!has_session_only_databases) | 486 if (!has_session_only_databases) |
| 487 return; | 487 return; |
| 488 | 488 |
| 489 TaskRunner()->PostTask( | 489 TaskRunner()->PostTask(FROM_HERE, |
| 490 FROM_HERE, | 490 base::BindOnce(&ClearSessionOnlyOrigins, data_path_, |
| 491 base::Bind( | 491 special_storage_policy_)); |
| 492 &ClearSessionOnlyOrigins, data_path_, special_storage_policy_)); | |
| 493 } | 492 } |
| 494 | 493 |
| 495 // static | 494 // static |
| 496 base::FilePath IndexedDBContextImpl::GetBlobStoreFileName( | 495 base::FilePath IndexedDBContextImpl::GetBlobStoreFileName( |
| 497 const Origin& origin) { | 496 const Origin& origin) { |
| 498 std::string origin_id = storage::GetIdentifierFromOrigin(origin.GetURL()); | 497 std::string origin_id = storage::GetIdentifierFromOrigin(origin.GetURL()); |
| 499 return base::FilePath() | 498 return base::FilePath() |
| 500 .AppendASCII(origin_id) | 499 .AppendASCII(origin_id) |
| 501 .AddExtension(kIndexedDBExtension) | 500 .AddExtension(kIndexedDBExtension) |
| 502 .AddExtension(kBlobExtension); | 501 .AddExtension(kBlobExtension); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 void IndexedDBContextImpl::ResetCaches() { | 562 void IndexedDBContextImpl::ResetCaches() { |
| 564 origin_set_.reset(); | 563 origin_set_.reset(); |
| 565 origin_size_map_.clear(); | 564 origin_size_map_.clear(); |
| 566 } | 565 } |
| 567 | 566 |
| 568 base::SequencedTaskRunner* IndexedDBContextImpl::TaskRunner() const { | 567 base::SequencedTaskRunner* IndexedDBContextImpl::TaskRunner() const { |
| 569 return task_runner_.get(); | 568 return task_runner_.get(); |
| 570 } | 569 } |
| 571 | 570 |
| 572 } // namespace content | 571 } // namespace content |
| OLD | NEW |