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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 if (!base::DeleteFile(db_dir_, true)) | 473 if (!base::DeleteFile(db_dir_, true)) |
474 return false; | 474 return false; |
475 } | 475 } |
476 | 476 |
477 db_->set_histogram_tag("DatabaseTracker"); | 477 db_->set_histogram_tag("DatabaseTracker"); |
478 | 478 |
479 databases_table_.reset(new DatabasesTable(db_.get())); | 479 databases_table_.reset(new DatabasesTable(db_.get())); |
480 meta_table_.reset(new sql::MetaTable()); | 480 meta_table_.reset(new sql::MetaTable()); |
481 | 481 |
482 is_initialized_ = | 482 is_initialized_ = |
483 file_util::CreateDirectory(db_dir_) && | 483 base::CreateDirectory(db_dir_) && |
484 (db_->is_open() || | 484 (db_->is_open() || |
485 (is_incognito_ ? db_->OpenInMemory() : | 485 (is_incognito_ ? db_->OpenInMemory() : |
486 db_->Open(kTrackerDatabaseFullPath))) && | 486 db_->Open(kTrackerDatabaseFullPath))) && |
487 UpgradeToCurrentVersion(); | 487 UpgradeToCurrentVersion(); |
488 if (!is_initialized_) { | 488 if (!is_initialized_) { |
489 databases_table_.reset(NULL); | 489 databases_table_.reset(NULL); |
490 meta_table_.reset(NULL); | 490 meta_table_.reset(NULL); |
491 db_->Close(); | 491 db_->Close(); |
492 } | 492 } |
493 } | 493 } |
(...skipping 368 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 |