| 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 "chrome/browser/history/in_memory_url_index.h" | 5 #include "chrome/browser/history/in_memory_url_index.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/history/history_notifications.h" | 9 #include "chrome/browser/history/history_notifications.h" |
| 10 #include "chrome/browser/history/url_database.h" | 10 #include "chrome/browser/history/url_database.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 RebuildPrivateDataFromHistoryDBTask( | 58 RebuildPrivateDataFromHistoryDBTask( |
| 59 InMemoryURLIndex* index, | 59 InMemoryURLIndex* index, |
| 60 const std::string& languages, | 60 const std::string& languages, |
| 61 const std::set<std::string>& scheme_whitelist) | 61 const std::set<std::string>& scheme_whitelist) |
| 62 : index_(index), | 62 : index_(index), |
| 63 languages_(languages), | 63 languages_(languages), |
| 64 scheme_whitelist_(scheme_whitelist), | 64 scheme_whitelist_(scheme_whitelist), |
| 65 succeeded_(false) { | 65 succeeded_(false) { |
| 66 } | 66 } |
| 67 | 67 |
| 68 InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask:: | |
| 69 ~RebuildPrivateDataFromHistoryDBTask() {} | |
| 70 | |
| 71 bool InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask::RunOnDBThread( | 68 bool InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask::RunOnDBThread( |
| 72 HistoryBackend* backend, | 69 HistoryBackend* backend, |
| 73 HistoryDatabase* db) { | 70 HistoryDatabase* db) { |
| 74 data_ = URLIndexPrivateData::RebuildFromHistory(db, languages_, | 71 data_ = URLIndexPrivateData::RebuildFromHistory(db, languages_, |
| 75 scheme_whitelist_); | 72 scheme_whitelist_); |
| 76 succeeded_ = data_.get() && !data_->Empty(); | 73 succeeded_ = data_.get() && !data_->Empty(); |
| 77 if (!succeeded_ && data_.get()) | 74 if (!succeeded_ && data_.get()) |
| 78 data_->Clear(); | 75 data_->Clear(); |
| 79 return true; | 76 return true; |
| 80 } | 77 } |
| 81 | 78 |
| 82 void InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask:: | 79 void InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask:: |
| 83 DoneRunOnMainThread() { | 80 DoneRunOnMainThread() { |
| 84 index_->DoneRebuidingPrivateDataFromHistoryDB(succeeded_, data_); | 81 index_->DoneRebuidingPrivateDataFromHistoryDB(succeeded_, data_); |
| 85 } | 82 } |
| 86 | 83 |
| 84 InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask:: |
| 85 ~RebuildPrivateDataFromHistoryDBTask() { |
| 86 } |
| 87 |
| 87 // InMemoryURLIndex ------------------------------------------------------------ | 88 // InMemoryURLIndex ------------------------------------------------------------ |
| 88 | 89 |
| 89 InMemoryURLIndex::InMemoryURLIndex(Profile* profile, | 90 InMemoryURLIndex::InMemoryURLIndex(Profile* profile, |
| 90 const FilePath& history_dir, | 91 const FilePath& history_dir, |
| 91 const std::string& languages) | 92 const std::string& languages) |
| 92 : profile_(profile), | 93 : profile_(profile), |
| 93 history_dir_(history_dir), | 94 history_dir_(history_dir), |
| 94 languages_(languages), | 95 languages_(languages), |
| 95 private_data_(new URLIndexPrivateData), | 96 private_data_(new URLIndexPrivateData), |
| 96 restore_cache_observer_(NULL), | 97 restore_cache_observer_(NULL), |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 309 } |
| 309 } | 310 } |
| 310 | 311 |
| 311 void InMemoryURLIndex::OnCacheSaveDone( | 312 void InMemoryURLIndex::OnCacheSaveDone( |
| 312 scoped_refptr<RefCountedBool> succeeded) { | 313 scoped_refptr<RefCountedBool> succeeded) { |
| 313 if (save_cache_observer_) | 314 if (save_cache_observer_) |
| 314 save_cache_observer_->OnCacheSaveFinished(succeeded->value()); | 315 save_cache_observer_->OnCacheSaveFinished(succeeded->value()); |
| 315 } | 316 } |
| 316 | 317 |
| 317 } // namespace history | 318 } // namespace history |
| OLD | NEW |