Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: chrome/browser/history/text_database_manager.cc

Issue 13315: Move file enumeration to filepaths. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/greasemonkey_master.cc ('k') | chrome/browser/importer/firefox2_importer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/greasemonkey_master.cc ('k') | chrome/browser/importer/firefox2_importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698