OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/text_database_manager.h" | 5 #include "chrome/browser/history/text_database_manager.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 db_cache_.ShrinkToSize(kCacheDBSize); | 140 db_cache_.ShrinkToSize(kCacheDBSize); |
141 } | 141 } |
142 | 142 |
143 void TextDatabaseManager::InitDBList() { | 143 void TextDatabaseManager::InitDBList() { |
144 if (present_databases_loaded_) | 144 if (present_databases_loaded_) |
145 return; | 145 return; |
146 | 146 |
147 present_databases_loaded_ = true; | 147 present_databases_loaded_ = true; |
148 | 148 |
149 // Find files on disk matching our pattern so we can quickly test for them. | 149 // Find files on disk matching our pattern so we can quickly test for them. |
150 file_util::FileEnumerator enumerator(dir_, false, | 150 file_util::FileEnumerator enumerator(FilePath::FromWStringHack(dir_), false, |
151 file_util::FileEnumerator::FILES, | 151 file_util::FileEnumerator::FILES, |
152 std::wstring(TextDatabase::file_base()) + L"*"); | 152 FilePath::FromWStringHack( |
| 153 std::wstring(TextDatabase::file_base()) + L"*").value()); |
153 std::wstring cur_file; | 154 std::wstring cur_file; |
154 while (!(cur_file = enumerator.Next()).empty()) { | 155 while (!(cur_file = enumerator.Next().ToWStringHack()).empty()) { |
155 // Convert to the number representing this file. | 156 // Convert to the number representing this file. |
156 TextDatabase::DBIdent id = TextDatabase::FileNameToID(cur_file); | 157 TextDatabase::DBIdent id = TextDatabase::FileNameToID(cur_file); |
157 if (id) // Will be 0 on error. | 158 if (id) // Will be 0 on error. |
158 present_databases_.insert(id); | 159 present_databases_.insert(id); |
159 } | 160 } |
160 } | 161 } |
161 | 162 |
162 void TextDatabaseManager::AddPageURL(const GURL& url, | 163 void TextDatabaseManager::AddPageURL(const GURL& url, |
163 URLID url_id, | 164 URLID url_id, |
164 VisitID visit_id, | 165 VisitID visit_id, |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 AddPageData(i->first, i->second.url_id(), i->second.visit_id(), | 540 AddPageData(i->first, i->second.url_id(), i->second.visit_id(), |
540 i->second.visit_time(), i->second.title(), i->second.body()); | 541 i->second.visit_time(), i->second.title(), i->second.body()); |
541 i = recent_changes_.Erase(i); | 542 i = recent_changes_.Erase(i); |
542 } | 543 } |
543 | 544 |
544 ScheduleFlushOldChanges(); | 545 ScheduleFlushOldChanges(); |
545 } | 546 } |
546 | 547 |
547 } // namespace history | 548 } // namespace history |
548 | 549 |
OLD | NEW |