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/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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 base::TimeTicks beginning_time = base::TimeTicks::Now(); | 891 base::TimeTicks beginning_time = base::TimeTicks::Now(); |
892 InMemoryURLIndexCacheItem index_cache; | 892 InMemoryURLIndexCacheItem index_cache; |
893 SavePrivateData(&index_cache); | 893 SavePrivateData(&index_cache); |
894 std::string data; | 894 std::string data; |
895 if (!index_cache.SerializeToString(&data)) { | 895 if (!index_cache.SerializeToString(&data)) { |
896 LOG(WARNING) << "Failed to serialize the InMemoryURLIndex cache."; | 896 LOG(WARNING) << "Failed to serialize the InMemoryURLIndex cache."; |
897 return false; | 897 return false; |
898 } | 898 } |
899 | 899 |
900 int size = data.size(); | 900 int size = data.size(); |
901 if (file_util::WriteFile(file_path, data.c_str(), size) != size) { | 901 if (base::WriteFile(file_path, data.c_str(), size) != size) { |
902 LOG(WARNING) << "Failed to write " << file_path.value(); | 902 LOG(WARNING) << "Failed to write " << file_path.value(); |
903 return false; | 903 return false; |
904 } | 904 } |
905 UMA_HISTOGRAM_TIMES("History.InMemoryURLIndexSaveCacheTime", | 905 UMA_HISTOGRAM_TIMES("History.InMemoryURLIndexSaveCacheTime", |
906 base::TimeTicks::Now() - beginning_time); | 906 base::TimeTicks::Now() - beginning_time); |
907 return true; | 907 return true; |
908 } | 908 } |
909 | 909 |
910 void URLIndexPrivateData::SavePrivateData( | 910 void URLIndexPrivateData::SavePrivateData( |
911 InMemoryURLIndexCacheItem* cache) const { | 911 InMemoryURLIndexCacheItem* cache) const { |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 // recently visited (within the last 12/24 hours) as highly important. Get | 1331 // recently visited (within the last 12/24 hours) as highly important. Get |
1332 // input from mpearson. | 1332 // input from mpearson. |
1333 if (r1.typed_count() != r2.typed_count()) | 1333 if (r1.typed_count() != r2.typed_count()) |
1334 return (r1.typed_count() > r2.typed_count()); | 1334 return (r1.typed_count() > r2.typed_count()); |
1335 if (r1.visit_count() != r2.visit_count()) | 1335 if (r1.visit_count() != r2.visit_count()) |
1336 return (r1.visit_count() > r2.visit_count()); | 1336 return (r1.visit_count() > r2.visit_count()); |
1337 return (r1.last_visit() > r2.last_visit()); | 1337 return (r1.last_visit() > r2.last_visit()); |
1338 } | 1338 } |
1339 | 1339 |
1340 } // namespace history | 1340 } // namespace history |
OLD | NEW |