| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/database/database_tracker.h" | 5 #include "webkit/database/database_tracker.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "app/sql/connection.h" | 9 #include "app/sql/connection.h" |
| 10 #include "app/sql/meta_table.h" | 10 #include "app/sql/meta_table.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 origins_info_map_[origin_identifier].SetQuota(new_quota); | 201 origins_info_map_[origin_identifier].SetQuota(new_quota); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 void DatabaseTracker::SetOriginQuotaInMemory(const string16& origin_identifier, | 205 void DatabaseTracker::SetOriginQuotaInMemory(const string16& origin_identifier, |
| 206 int64 new_quota) { | 206 int64 new_quota) { |
| 207 DCHECK(new_quota >= 0); | 207 DCHECK(new_quota >= 0); |
| 208 in_memory_quotas_[origin_identifier] = new_quota; | 208 in_memory_quotas_[origin_identifier] = new_quota; |
| 209 } | 209 } |
| 210 | 210 |
| 211 void DatabaseTracker::ResetOriginQuotaInMemory( |
| 212 const string16& origin_identifier) { |
| 213 in_memory_quotas_.erase(origin_identifier); |
| 214 } |
| 215 |
| 211 bool DatabaseTracker::DeleteClosedDatabase(const string16& origin_identifier, | 216 bool DatabaseTracker::DeleteClosedDatabase(const string16& origin_identifier, |
| 212 const string16& database_name) { | 217 const string16& database_name) { |
| 213 if (!LazyInit()) | 218 if (!LazyInit()) |
| 214 return false; | 219 return false; |
| 215 | 220 |
| 216 // Check if the database is opened by any renderer. | 221 // Check if the database is opened by any renderer. |
| 217 if (database_connections_.IsDatabaseOpened(origin_identifier, database_name)) | 222 if (database_connections_.IsDatabaseOpened(origin_identifier, database_name)) |
| 218 return false; | 223 return false; |
| 219 | 224 |
| 220 // Try to delete the file on the hard drive. | 225 // Try to delete the file on the hard drive. |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 file_path = file_enumerator.Next()) { | 567 file_path = file_enumerator.Next()) { |
| 563 if (file_path.BaseName() != FilePath(kTrackerDatabaseFileName)) { | 568 if (file_path.BaseName() != FilePath(kTrackerDatabaseFileName)) { |
| 564 if (!StartsWith(file_path.BaseName().ToWStringHack(), | 569 if (!StartsWith(file_path.BaseName().ToWStringHack(), |
| 565 ASCIIToWide(kExtensionOriginIdentifierPrefix), true)) | 570 ASCIIToWide(kExtensionOriginIdentifierPrefix), true)) |
| 566 file_util::Delete(file_path, true); | 571 file_util::Delete(file_path, true); |
| 567 } | 572 } |
| 568 } | 573 } |
| 569 } | 574 } |
| 570 | 575 |
| 571 } // namespace webkit_database | 576 } // namespace webkit_database |
| OLD | NEW |