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

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

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months 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
OLDNEW
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/url_index_private_data.h" 5 #include "chrome/browser/history/url_index_private_data.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <iterator> 9 #include <iterator>
10 #include <limits> 10 #include <limits>
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 RemoveRowFromIndex(pos->second.url_row); 389 RemoveRowFromIndex(pos->second.url_row);
390 search_term_cache_.clear(); // This invalidates the cache. 390 search_term_cache_.clear(); // This invalidates the cache.
391 return true; 391 return true;
392 } 392 }
393 393
394 // static 394 // static
395 scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RestoreFromFile( 395 scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RestoreFromFile(
396 const base::FilePath& file_path, 396 const base::FilePath& file_path,
397 const std::string& languages) { 397 const std::string& languages) {
398 base::TimeTicks beginning_time = base::TimeTicks::Now(); 398 base::TimeTicks beginning_time = base::TimeTicks::Now();
399 if (!file_util::PathExists(file_path)) 399 if (!base::PathExists(file_path))
400 return NULL; 400 return NULL;
401 std::string data; 401 std::string data;
402 // If there is no cache file then simply give up. This will cause us to 402 // If there is no cache file then simply give up. This will cause us to
403 // attempt to rebuild from the history database. 403 // attempt to rebuild from the history database.
404 if (!file_util::ReadFileToString(file_path, &data)) 404 if (!file_util::ReadFileToString(file_path, &data))
405 return NULL; 405 return NULL;
406 406
407 scoped_refptr<URLIndexPrivateData> restored_data(new URLIndexPrivateData); 407 scoped_refptr<URLIndexPrivateData> restored_data(new URLIndexPrivateData);
408 InMemoryURLIndexCacheItem index_cache; 408 InMemoryURLIndexCacheItem index_cache;
409 if (!index_cache.ParseFromArray(data.c_str(), data.size())) { 409 if (!index_cache.ParseFromArray(data.c_str(), data.size())) {
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 // recently visited (within the last 12/24 hours) as highly important. Get 1332 // recently visited (within the last 12/24 hours) as highly important. Get
1333 // input from mpearson. 1333 // input from mpearson.
1334 if (r1.typed_count() != r2.typed_count()) 1334 if (r1.typed_count() != r2.typed_count())
1335 return (r1.typed_count() > r2.typed_count()); 1335 return (r1.typed_count() > r2.typed_count());
1336 if (r1.visit_count() != r2.visit_count()) 1336 if (r1.visit_count() != r2.visit_count())
1337 return (r1.visit_count() > r2.visit_count()); 1337 return (r1.visit_count() > r2.visit_count());
1338 return (r1.last_visit() > r2.last_visit()); 1338 return (r1.last_visit() > r2.last_visit());
1339 } 1339 }
1340 1340
1341 } // namespace history 1341 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/top_sites_likely_impl_unittest.cc ('k') | chrome/browser/importer/firefox3_importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698