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

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

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « chrome/browser/history/history_unittest_base.cc ('k') | chrome/browser/icon_loader_linux.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) 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 (!base::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 (!base::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())) {
410 LOG(WARNING) << "Failed to parse URLIndexPrivateData cache data read from " 410 LOG(WARNING) << "Failed to parse URLIndexPrivateData cache data read from "
411 << file_path.value(); 411 << file_path.value();
412 return restored_data; 412 return restored_data;
413 } 413 }
414 414
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 // recently visited (within the last 12/24 hours) as highly important. Get 1330 // recently visited (within the last 12/24 hours) as highly important. Get
1331 // input from mpearson. 1331 // input from mpearson.
1332 if (r1.typed_count() != r2.typed_count()) 1332 if (r1.typed_count() != r2.typed_count())
1333 return (r1.typed_count() > r2.typed_count()); 1333 return (r1.typed_count() > r2.typed_count());
1334 if (r1.visit_count() != r2.visit_count()) 1334 if (r1.visit_count() != r2.visit_count())
1335 return (r1.visit_count() > r2.visit_count()); 1335 return (r1.visit_count() > r2.visit_count());
1336 return (r1.last_visit() > r2.last_visit()); 1336 return (r1.last_visit() > r2.last_visit());
1337 } 1337 }
1338 1338
1339 } // namespace history 1339 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_unittest_base.cc ('k') | chrome/browser/icon_loader_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698