| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 directory = directories.Next()) { | 461 directory = directories.Next()) { |
| 462 base::Delete(directory, true); | 462 base::Delete(directory, true); |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 | 465 |
| 466 // If the tracker database exists, but it's corrupt or doesn't | 466 // If the tracker database exists, but it's corrupt or doesn't |
| 467 // have a meta table, delete the database directory. | 467 // have a meta table, delete the database directory. |
| 468 const base::FilePath kTrackerDatabaseFullPath = | 468 const base::FilePath kTrackerDatabaseFullPath = |
| 469 db_dir_.Append(base::FilePath(kTrackerDatabaseFileName)); | 469 db_dir_.Append(base::FilePath(kTrackerDatabaseFileName)); |
| 470 if (file_util::DirectoryExists(db_dir_) && | 470 if (file_util::DirectoryExists(db_dir_) && |
| 471 file_util::PathExists(kTrackerDatabaseFullPath) && | 471 base::PathExists(kTrackerDatabaseFullPath) && |
| 472 (!db_->Open(kTrackerDatabaseFullPath) || | 472 (!db_->Open(kTrackerDatabaseFullPath) || |
| 473 !sql::MetaTable::DoesTableExist(db_.get()))) { | 473 !sql::MetaTable::DoesTableExist(db_.get()))) { |
| 474 db_->Close(); | 474 db_->Close(); |
| 475 if (!base::Delete(db_dir_, true)) | 475 if (!base::Delete(db_dir_, true)) |
| 476 return false; | 476 return false; |
| 477 } | 477 } |
| 478 | 478 |
| 479 db_->set_histogram_tag("DatabaseTracker"); | 479 db_->set_histogram_tag("DatabaseTracker"); |
| 480 | 480 |
| 481 databases_table_.reset(new DatabasesTable(db_.get())); | 481 databases_table_.reset(new DatabasesTable(db_.get())); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 if (!db_tracker_thread_->BelongsToCurrentThread()) { | 865 if (!db_tracker_thread_->BelongsToCurrentThread()) { |
| 866 db_tracker_thread_->PostTask( | 866 db_tracker_thread_->PostTask( |
| 867 FROM_HERE, | 867 FROM_HERE, |
| 868 base::Bind(&DatabaseTracker::SetForceKeepSessionState, this)); | 868 base::Bind(&DatabaseTracker::SetForceKeepSessionState, this)); |
| 869 return; | 869 return; |
| 870 } | 870 } |
| 871 force_keep_session_state_ = true; | 871 force_keep_session_state_ = true; |
| 872 } | 872 } |
| 873 | 873 |
| 874 } // namespace webkit_database | 874 } // namespace webkit_database |
| OLD | NEW |