Chromium Code Reviews| 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 "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 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1502 favicon_base::IconType icon_type; | 1502 favicon_base::IconType icon_type; |
| 1503 if (!thumbnail_db_->GetFaviconHeader(largest_icon.icon_id, &icon_url, | 1503 if (!thumbnail_db_->GetFaviconHeader(largest_icon.icon_id, &icon_url, |
| 1504 &icon_type)) { | 1504 &icon_type)) { |
| 1505 return; | 1505 return; |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 base::Time last_updated; | 1508 base::Time last_updated; |
| 1509 favicon_base::FaviconRawBitmapResult bitmap_result; | 1509 favicon_base::FaviconRawBitmapResult bitmap_result; |
| 1510 bitmap_result.icon_url = icon_url; | 1510 bitmap_result.icon_url = icon_url; |
| 1511 bitmap_result.icon_type = icon_type; | 1511 bitmap_result.icon_type = icon_type; |
| 1512 if (!thumbnail_db_->GetFaviconBitmap(largest_icon.bitmap_id, | 1512 if (!thumbnail_db_->GetFaviconBitmap( |
| 1513 &last_updated, nullptr, | 1513 largest_icon.bitmap_id, /*access_time=*/Time::Now(), &last_updated, |
|
jkrcal
2017/05/02 13:57:25
For all call 3 sites here, I need to pass Time() i
jkrcal
2017/05/15 14:26:57
Because of the privacy discussion, I still believe
sky
2017/05/15 15:57:13
You will have to change callers to supply whether
jkrcal
2017/05/15 18:36:29
Huh, now I see better why you pushed in the direct
| |
| 1514 &bitmap_result.bitmap_data, | 1514 &bitmap_result.bitmap_data, &bitmap_result.pixel_size)) { |
| 1515 &bitmap_result.pixel_size)) { | |
| 1516 return; | 1515 return; |
| 1517 } | 1516 } |
| 1518 | 1517 |
| 1519 bitmap_result.expired = | 1518 bitmap_result.expired = |
| 1520 (Time::Now() - last_updated) > TimeDelta::FromDays(kFaviconRefetchDays); | 1519 (Time::Now() - last_updated) > TimeDelta::FromDays(kFaviconRefetchDays); |
| 1521 if (bitmap_result.is_valid()) | 1520 if (bitmap_result.is_valid()) |
| 1522 *favicon_bitmap_result = bitmap_result; | 1521 *favicon_bitmap_result = bitmap_result; |
| 1523 | 1522 |
| 1524 LOCAL_HISTOGRAM_TIMES("History.GetLargestFaviconForURL", | 1523 LOCAL_HISTOGRAM_TIMES("History.GetLargestFaviconForURL", |
| 1525 TimeTicks::Now() - beginning_time); | 1524 TimeTicks::Now() - beginning_time); |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1987 return favicon_bitmaps_changed; | 1986 return favicon_bitmaps_changed; |
| 1988 } | 1987 } |
| 1989 | 1988 |
| 1990 bool HistoryBackend::IsFaviconBitmapDataEqual( | 1989 bool HistoryBackend::IsFaviconBitmapDataEqual( |
| 1991 FaviconBitmapID bitmap_id, | 1990 FaviconBitmapID bitmap_id, |
| 1992 const scoped_refptr<base::RefCountedMemory>& new_bitmap_data) { | 1991 const scoped_refptr<base::RefCountedMemory>& new_bitmap_data) { |
| 1993 if (!new_bitmap_data) | 1992 if (!new_bitmap_data) |
| 1994 return false; | 1993 return false; |
| 1995 | 1994 |
| 1996 scoped_refptr<base::RefCountedMemory> original_bitmap_data; | 1995 scoped_refptr<base::RefCountedMemory> original_bitmap_data; |
| 1997 thumbnail_db_->GetFaviconBitmap(bitmap_id, nullptr, nullptr, | 1996 thumbnail_db_->GetFaviconBitmap(bitmap_id, /*access_time=*/Time::Now(), |
| 1998 &original_bitmap_data, nullptr); | 1997 nullptr, &original_bitmap_data, nullptr); |
| 1999 return new_bitmap_data->Equals(original_bitmap_data); | 1998 return new_bitmap_data->Equals(original_bitmap_data); |
| 2000 } | 1999 } |
| 2001 | 2000 |
| 2002 bool HistoryBackend::GetFaviconsFromDB( | 2001 bool HistoryBackend::GetFaviconsFromDB( |
| 2003 const GURL& page_url, | 2002 const GURL& page_url, |
| 2004 int icon_types, | 2003 int icon_types, |
| 2005 const std::vector<int>& desired_sizes, | 2004 const std::vector<int>& desired_sizes, |
| 2006 std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results) { | 2005 std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results) { |
| 2007 DCHECK(favicon_bitmap_results); | 2006 DCHECK(favicon_bitmap_results); |
| 2008 favicon_bitmap_results->clear(); | 2007 favicon_bitmap_results->clear(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2076 if (!thumbnail_db_->GetFaviconHeader(best_favicon_id, &icon_url, | 2075 if (!thumbnail_db_->GetFaviconHeader(best_favicon_id, &icon_url, |
| 2077 &icon_type)) { | 2076 &icon_type)) { |
| 2078 return false; | 2077 return false; |
| 2079 } | 2078 } |
| 2080 | 2079 |
| 2081 for (size_t i = 0; i < best_bitmap_ids.size(); ++i) { | 2080 for (size_t i = 0; i < best_bitmap_ids.size(); ++i) { |
| 2082 base::Time last_updated; | 2081 base::Time last_updated; |
| 2083 favicon_base::FaviconRawBitmapResult bitmap_result; | 2082 favicon_base::FaviconRawBitmapResult bitmap_result; |
| 2084 bitmap_result.icon_url = icon_url; | 2083 bitmap_result.icon_url = icon_url; |
| 2085 bitmap_result.icon_type = icon_type; | 2084 bitmap_result.icon_type = icon_type; |
| 2086 if (!thumbnail_db_->GetFaviconBitmap(best_bitmap_ids[i], &last_updated, | 2085 if (!thumbnail_db_->GetFaviconBitmap( |
| 2087 nullptr, &bitmap_result.bitmap_data, | 2086 best_bitmap_ids[i], /*access_time=*/Time::Now(), &last_updated, |
| 2088 &bitmap_result.pixel_size)) { | 2087 &bitmap_result.bitmap_data, &bitmap_result.pixel_size)) { |
| 2089 return false; | 2088 return false; |
| 2090 } | 2089 } |
| 2091 | 2090 |
| 2092 bitmap_result.expired = | 2091 bitmap_result.expired = |
| 2093 (Time::Now() - last_updated) > TimeDelta::FromDays(kFaviconRefetchDays); | 2092 (Time::Now() - last_updated) > TimeDelta::FromDays(kFaviconRefetchDays); |
| 2094 if (bitmap_result.is_valid()) | 2093 if (bitmap_result.is_valid()) |
| 2095 favicon_bitmap_results->push_back(bitmap_result); | 2094 favicon_bitmap_results->push_back(bitmap_result); |
| 2096 } | 2095 } |
| 2097 return true; | 2096 return true; |
| 2098 } | 2097 } |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2661 // transaction is currently open. | 2660 // transaction is currently open. |
| 2662 db_->CommitTransaction(); | 2661 db_->CommitTransaction(); |
| 2663 db_->Vacuum(); | 2662 db_->Vacuum(); |
| 2664 db_->BeginTransaction(); | 2663 db_->BeginTransaction(); |
| 2665 db_->GetStartDate(&first_recorded_time_); | 2664 db_->GetStartDate(&first_recorded_time_); |
| 2666 | 2665 |
| 2667 return true; | 2666 return true; |
| 2668 } | 2667 } |
| 2669 | 2668 |
| 2670 } // namespace history | 2669 } // namespace history |
| OLD | NEW |