| 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 "storage/browser/database/database_tracker.h" | 5 #include "storage/browser/database/database_tracker.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 if (old_size != new_size) { | 607 if (old_size != new_size) { |
| 608 database_connections_.SetOpenDatabaseSize(origin_id, name, new_size); | 608 database_connections_.SetOpenDatabaseSize(origin_id, name, new_size); |
| 609 if (info) | 609 if (info) |
| 610 info->SetDatabaseSize(name, new_size); | 610 info->SetDatabaseSize(name, new_size); |
| 611 if (quota_manager_proxy_.get()) | 611 if (quota_manager_proxy_.get()) |
| 612 quota_manager_proxy_->NotifyStorageModified( | 612 quota_manager_proxy_->NotifyStorageModified( |
| 613 storage::QuotaClient::kDatabase, | 613 storage::QuotaClient::kDatabase, |
| 614 storage::GetOriginFromIdentifier(origin_id), | 614 storage::GetOriginFromIdentifier(origin_id), |
| 615 storage::kStorageTypeTemporary, | 615 storage::kStorageTypeTemporary, |
| 616 new_size - old_size); | 616 new_size - old_size); |
| 617 FOR_EACH_OBSERVER(Observer, observers_, OnDatabaseSizeChanged( | 617 for (auto& observer : observers_) |
| 618 origin_id, name, new_size)); | 618 observer.OnDatabaseSizeChanged(origin_id, name, new_size); |
| 619 } | 619 } |
| 620 return new_size; | 620 return new_size; |
| 621 } | 621 } |
| 622 | 622 |
| 623 void DatabaseTracker::ScheduleDatabaseForDeletion( | 623 void DatabaseTracker::ScheduleDatabaseForDeletion( |
| 624 const std::string& origin_identifier, | 624 const std::string& origin_identifier, |
| 625 const base::string16& database_name) { | 625 const base::string16& database_name) { |
| 626 DCHECK(database_connections_.IsDatabaseOpened(origin_identifier, | 626 DCHECK(database_connections_.IsDatabaseOpened(origin_identifier, |
| 627 database_name)); | 627 database_name)); |
| 628 dbs_to_be_deleted_[origin_identifier].insert(database_name); | 628 dbs_to_be_deleted_[origin_identifier].insert(database_name); |
| 629 FOR_EACH_OBSERVER(Observer, observers_, OnDatabaseScheduledForDeletion( | 629 for (auto& observer : observers_) |
| 630 origin_identifier, database_name)); | 630 observer.OnDatabaseScheduledForDeletion(origin_identifier, database_name); |
| 631 } | 631 } |
| 632 | 632 |
| 633 void DatabaseTracker::ScheduleDatabasesForDeletion( | 633 void DatabaseTracker::ScheduleDatabasesForDeletion( |
| 634 const DatabaseSet& databases, | 634 const DatabaseSet& databases, |
| 635 const net::CompletionCallback& callback) { | 635 const net::CompletionCallback& callback) { |
| 636 DCHECK(!databases.empty()); | 636 DCHECK(!databases.empty()); |
| 637 | 637 |
| 638 if (!callback.is_null()) | 638 if (!callback.is_null()) |
| 639 deletion_callbacks_.push_back(std::make_pair(callback, databases)); | 639 deletion_callbacks_.push_back(std::make_pair(callback, databases)); |
| 640 for (DatabaseSet::const_iterator ori = databases.begin(); | 640 for (DatabaseSet::const_iterator ori = databases.begin(); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 if (!db_tracker_thread_->BelongsToCurrentThread()) { | 862 if (!db_tracker_thread_->BelongsToCurrentThread()) { |
| 863 db_tracker_thread_->PostTask( | 863 db_tracker_thread_->PostTask( |
| 864 FROM_HERE, | 864 FROM_HERE, |
| 865 base::Bind(&DatabaseTracker::SetForceKeepSessionState, this)); | 865 base::Bind(&DatabaseTracker::SetForceKeepSessionState, this)); |
| 866 return; | 866 return; |
| 867 } | 867 } |
| 868 force_keep_session_state_ = true; | 868 force_keep_session_state_ = true; |
| 869 } | 869 } |
| 870 | 870 |
| 871 } // namespace storage | 871 } // namespace storage |
| OLD | NEW |