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

Side by Side Diff: components/history/core/browser/history_backend.cc

Issue 1004373002: Add last_requested field to the favicon_bitmaps table of the favicons database. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge GetFaviconBitmapLastRequestedtime into GetFaviconBitmap. Created 5 years, 8 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
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 "components/history/core/browser/history_backend.h" 5 #include "components/history/core/browser/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 favicon_base::IconType icon_type; 1522 favicon_base::IconType icon_type;
1523 if (!thumbnail_db_->GetFaviconHeader(largest_icon.icon_id, &icon_url, 1523 if (!thumbnail_db_->GetFaviconHeader(largest_icon.icon_id, &icon_url,
1524 &icon_type)) { 1524 &icon_type)) {
1525 return; 1525 return;
1526 } 1526 }
1527 1527
1528 base::Time last_updated; 1528 base::Time last_updated;
1529 favicon_base::FaviconRawBitmapResult bitmap_result; 1529 favicon_base::FaviconRawBitmapResult bitmap_result;
1530 bitmap_result.icon_url = icon_url; 1530 bitmap_result.icon_url = icon_url;
1531 bitmap_result.icon_type = icon_type; 1531 bitmap_result.icon_type = icon_type;
1532 if (!thumbnail_db_->GetFaviconBitmap(largest_icon.bitmap_id, &last_updated, 1532 if (!thumbnail_db_->GetFaviconBitmap(largest_icon.bitmap_id,
1533 &last_updated, nullptr,
1533 &bitmap_result.bitmap_data, 1534 &bitmap_result.bitmap_data,
1534 &bitmap_result.pixel_size)) { 1535 &bitmap_result.pixel_size)) {
1535 return; 1536 return;
1536 } 1537 }
1537 1538
1538 bitmap_result.expired = 1539 bitmap_result.expired =
1539 (Time::Now() - last_updated) > TimeDelta::FromDays(kFaviconRefetchDays); 1540 (Time::Now() - last_updated) > TimeDelta::FromDays(kFaviconRefetchDays);
1540 if (bitmap_result.is_valid()) 1541 if (bitmap_result.is_valid())
1541 *favicon_bitmap_result = bitmap_result; 1542 *favicon_bitmap_result = bitmap_result;
1542 1543
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 return favicon_bitmaps_changed; 1960 return favicon_bitmaps_changed;
1960 } 1961 }
1961 1962
1962 bool HistoryBackend::IsFaviconBitmapDataEqual( 1963 bool HistoryBackend::IsFaviconBitmapDataEqual(
1963 FaviconBitmapID bitmap_id, 1964 FaviconBitmapID bitmap_id,
1964 const scoped_refptr<base::RefCountedMemory>& new_bitmap_data) { 1965 const scoped_refptr<base::RefCountedMemory>& new_bitmap_data) {
1965 if (!new_bitmap_data.get()) 1966 if (!new_bitmap_data.get())
1966 return false; 1967 return false;
1967 1968
1968 scoped_refptr<base::RefCountedMemory> original_bitmap_data; 1969 scoped_refptr<base::RefCountedMemory> original_bitmap_data;
1969 thumbnail_db_->GetFaviconBitmap(bitmap_id, nullptr, &original_bitmap_data, 1970 thumbnail_db_->GetFaviconBitmap(bitmap_id, nullptr, nullptr,
1970 nullptr); 1971 &original_bitmap_data, nullptr);
1971 return new_bitmap_data->Equals(original_bitmap_data); 1972 return new_bitmap_data->Equals(original_bitmap_data);
1972 } 1973 }
1973 1974
1974 bool HistoryBackend::GetFaviconsFromDB( 1975 bool HistoryBackend::GetFaviconsFromDB(
1975 const GURL& page_url, 1976 const GURL& page_url,
1976 int icon_types, 1977 int icon_types,
1977 const std::vector<int>& desired_sizes, 1978 const std::vector<int>& desired_sizes,
1978 std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results) { 1979 std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results) {
1979 DCHECK(favicon_bitmap_results); 1980 DCHECK(favicon_bitmap_results);
1980 favicon_bitmap_results->clear(); 1981 favicon_bitmap_results->clear();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 &icon_type)) { 2050 &icon_type)) {
2050 return false; 2051 return false;
2051 } 2052 }
2052 2053
2053 for (size_t i = 0; i < best_bitmap_ids.size(); ++i) { 2054 for (size_t i = 0; i < best_bitmap_ids.size(); ++i) {
2054 base::Time last_updated; 2055 base::Time last_updated;
2055 favicon_base::FaviconRawBitmapResult bitmap_result; 2056 favicon_base::FaviconRawBitmapResult bitmap_result;
2056 bitmap_result.icon_url = icon_url; 2057 bitmap_result.icon_url = icon_url;
2057 bitmap_result.icon_type = icon_type; 2058 bitmap_result.icon_type = icon_type;
2058 if (!thumbnail_db_->GetFaviconBitmap(best_bitmap_ids[i], &last_updated, 2059 if (!thumbnail_db_->GetFaviconBitmap(best_bitmap_ids[i], &last_updated,
2059 &bitmap_result.bitmap_data, 2060 nullptr, &bitmap_result.bitmap_data,
2060 &bitmap_result.pixel_size)) { 2061 &bitmap_result.pixel_size)) {
2061 return false; 2062 return false;
2062 } 2063 }
2063 2064
2064 bitmap_result.expired = 2065 bitmap_result.expired =
2065 (Time::Now() - last_updated) > TimeDelta::FromDays(kFaviconRefetchDays); 2066 (Time::Now() - last_updated) > TimeDelta::FromDays(kFaviconRefetchDays);
2066 if (bitmap_result.is_valid()) 2067 if (bitmap_result.is_valid())
2067 favicon_bitmap_results->push_back(bitmap_result); 2068 favicon_bitmap_results->push_back(bitmap_result);
2068 } 2069 }
2069 return true; 2070 return true;
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
2660 info.url_id = visit.url_id; 2661 info.url_id = visit.url_id;
2661 info.time = visit.visit_time; 2662 info.time = visit.visit_time;
2662 info.transition = visit.transition; 2663 info.transition = visit.transition;
2663 // If we don't have a delegate yet during setup or shutdown, we will drop 2664 // If we don't have a delegate yet during setup or shutdown, we will drop
2664 // these notifications. 2665 // these notifications.
2665 if (delegate_) 2666 if (delegate_)
2666 delegate_->NotifyAddVisit(info); 2667 delegate_->NotifyAddVisit(info);
2667 } 2668 }
2668 2669
2669 } // namespace history 2670 } // namespace history
OLDNEW
« no previous file with comments | « chrome/test/data/History/Favicons.v8.sql ('k') | components/history/core/browser/history_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698