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 "webkit/browser/database/database_tracker.h" | 5 #include "webkit/browser/database/database_tracker.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 deleted_size = origin_info->TotalSize(); | 395 deleted_size = origin_info->TotalSize(); |
396 } | 396 } |
397 | 397 |
398 origins_info_map_.erase(origin_identifier); | 398 origins_info_map_.erase(origin_identifier); |
399 base::FilePath origin_dir = db_dir_.AppendASCII(origin_identifier); | 399 base::FilePath origin_dir = db_dir_.AppendASCII(origin_identifier); |
400 | 400 |
401 // Create a temporary directory to move possibly still existing databases to, | 401 // Create a temporary directory to move possibly still existing databases to, |
402 // as we can't delete the origin directory on windows if it contains opened | 402 // as we can't delete the origin directory on windows if it contains opened |
403 // files. | 403 // files. |
404 base::FilePath new_origin_dir; | 404 base::FilePath new_origin_dir; |
405 file_util::CreateTemporaryDirInDir(db_dir_, | 405 base::CreateTemporaryDirInDir(db_dir_, |
406 kTemporaryDirectoryPrefix, | 406 kTemporaryDirectoryPrefix, |
407 &new_origin_dir); | 407 &new_origin_dir); |
408 base::FileEnumerator databases( | 408 base::FileEnumerator databases( |
409 origin_dir, | 409 origin_dir, |
410 false, | 410 false, |
411 base::FileEnumerator::FILES); | 411 base::FileEnumerator::FILES); |
412 for (base::FilePath database = databases.Next(); !database.empty(); | 412 for (base::FilePath database = databases.Next(); !database.empty(); |
413 database = databases.Next()) { | 413 database = databases.Next()) { |
414 base::FilePath new_file = new_origin_dir.Append(database.BaseName()); | 414 base::FilePath new_file = new_origin_dir.Append(database.BaseName()); |
415 base::Move(database, new_file); | 415 base::Move(database, new_file); |
416 } | 416 } |
417 base::DeleteFile(origin_dir, true); | 417 base::DeleteFile(origin_dir, true); |
(...skipping 444 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 webkit_database | 871 } // namespace webkit_database |
OLD | NEW |