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" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/files/file.h" |
13 #include "base/files/file_enumerator.h" | 14 #include "base/files/file_enumerator.h" |
14 #include "base/message_loop/message_loop_proxy.h" | 15 #include "base/message_loop/message_loop_proxy.h" |
15 #include "base/platform_file.h" | |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
19 #include "sql/connection.h" | 19 #include "sql/connection.h" |
20 #include "sql/meta_table.h" | 20 #include "sql/meta_table.h" |
21 #include "sql/transaction.h" | 21 #include "sql/transaction.h" |
22 #include "third_party/sqlite/sqlite3.h" | 22 #include "third_party/sqlite/sqlite3.h" |
23 #include "webkit/browser/database/database_quota_client.h" | 23 #include "webkit/browser/database/database_quota_client.h" |
24 #include "webkit/browser/database/database_util.h" | 24 #include "webkit/browser/database/database_util.h" |
25 #include "webkit/browser/database/databases_table.h" | 25 #include "webkit/browser/database/databases_table.h" |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 continue; | 821 continue; |
822 if (special_storage_policy_->IsStorageProtected(origin_url)) | 822 if (special_storage_policy_->IsStorageProtected(origin_url)) |
823 continue; | 823 continue; |
824 webkit_database::OriginInfo origin_info; | 824 webkit_database::OriginInfo origin_info; |
825 std::vector<base::string16> databases; | 825 std::vector<base::string16> databases; |
826 GetOriginInfo(*origin, &origin_info); | 826 GetOriginInfo(*origin, &origin_info); |
827 origin_info.GetAllDatabaseNames(&databases); | 827 origin_info.GetAllDatabaseNames(&databases); |
828 | 828 |
829 for (std::vector<base::string16>::iterator database = databases.begin(); | 829 for (std::vector<base::string16>::iterator database = databases.begin(); |
830 database != databases.end(); ++database) { | 830 database != databases.end(); ++database) { |
831 base::PlatformFile file_handle = base::CreatePlatformFile( | 831 base::File file(GetFullDBFilePath(*origin, *database), |
832 GetFullDBFilePath(*origin, *database), | 832 base::File::FLAG_OPEN_ALWAYS | |
833 base::PLATFORM_FILE_OPEN_ALWAYS | | 833 base::File::FLAG_SHARE_DELETE | |
834 base::PLATFORM_FILE_SHARE_DELETE | | 834 base::File::FLAG_DELETE_ON_CLOSE | |
835 base::PLATFORM_FILE_DELETE_ON_CLOSE | | 835 base::File::FLAG_READ); |
836 base::PLATFORM_FILE_READ, | |
837 NULL, NULL); | |
838 base::ClosePlatformFile(file_handle); | |
839 } | 836 } |
840 DeleteOrigin(*origin, true); | 837 DeleteOrigin(*origin, true); |
841 } | 838 } |
842 } | 839 } |
843 | 840 |
844 | 841 |
845 void DatabaseTracker::Shutdown() { | 842 void DatabaseTracker::Shutdown() { |
846 DCHECK(db_tracker_thread_.get()); | 843 DCHECK(db_tracker_thread_.get()); |
847 DCHECK(db_tracker_thread_->BelongsToCurrentThread()); | 844 DCHECK(db_tracker_thread_->BelongsToCurrentThread()); |
848 if (shutting_down_) { | 845 if (shutting_down_) { |
(...skipping 13 matching lines...) Expand all Loading... |
862 if (!db_tracker_thread_->BelongsToCurrentThread()) { | 859 if (!db_tracker_thread_->BelongsToCurrentThread()) { |
863 db_tracker_thread_->PostTask( | 860 db_tracker_thread_->PostTask( |
864 FROM_HERE, | 861 FROM_HERE, |
865 base::Bind(&DatabaseTracker::SetForceKeepSessionState, this)); | 862 base::Bind(&DatabaseTracker::SetForceKeepSessionState, this)); |
866 return; | 863 return; |
867 } | 864 } |
868 force_keep_session_state_ = true; | 865 force_keep_session_state_ = true; |
869 } | 866 } |
870 | 867 |
871 } // namespace webkit_database | 868 } // namespace webkit_database |
OLD | NEW |