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 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 favicon_base::IconType icon_type, | 749 favicon_base::IconType icon_type, |
750 const GURL& icon_url, | 750 const GURL& icon_url, |
751 const std::vector<SkBitmap>& bitmaps); | 751 const std::vector<SkBitmap>& bitmaps); |
752 | 752 |
753 // Same as SetFavicons with three differences: | 753 // Same as SetFavicons with three differences: |
754 // 1) It will be a no-op if there is an existing cached favicon for *any* type | 754 // 1) It will be a no-op if there is an existing cached favicon for *any* type |
755 // for |page_url|. | 755 // for |page_url|. |
756 // 2) If |icon_url| is known to the database, |bitmaps| will be ignored (i.e. | 756 // 2) If |icon_url| is known to the database, |bitmaps| will be ignored (i.e. |
757 // the icon won't be overwritten) but the mappings from |page_url| to | 757 // the icon won't be overwritten) but the mappings from |page_url| to |
758 // |icon_url| will be stored (conditioned to point 1 above). | 758 // |icon_url| will be stored (conditioned to point 1 above). |
759 // 3) If |icon_url| is stored, it will be marked as expired. | 759 // 3) If |icon_url| is stored, it will be marked as "on-demand". |
760 // | |
761 // On-demand favicons are those that are fetched without visiting their page. | |
762 // For this reason, their life-time cannot be bound to the life-time of the | |
763 // corresponding visit in history. | |
764 // - These bitmaps are evicted from the database based on the last time they | |
765 // get requested. The last requested time is initially set to Now() and is | |
766 // further updated by calling TouchOnDemandFavicon(). | |
767 // - Furthermore, on-demand bitmaps are immediately marked as expired. Hence, | |
768 // they are always replaced by standard favicons whenever their page gets | |
769 // visited. | |
760 // The callback will receive whether the write actually happened. | 770 // The callback will receive whether the write actually happened. |
761 void SetLastResortFavicons(const GURL& page_url, | 771 void SetOnDemandFavicons(const GURL& page_url, |
762 favicon_base::IconType icon_type, | 772 favicon_base::IconType icon_type, |
763 const GURL& icon_url, | 773 const GURL& icon_url, |
764 const std::vector<SkBitmap>& bitmaps, | 774 const std::vector<SkBitmap>& bitmaps, |
765 base::Callback<void(bool)> callback); | 775 base::Callback<void(bool)> callback); |
766 | 776 |
767 // Used by the FaviconService to mark the favicon for the page as being out | 777 // Used by the FaviconService to mark the favicon for the page as being out |
768 // of date. | 778 // of date. |
769 void SetFaviconsOutOfDateForPage(const GURL& page_url); | 779 void SetFaviconsOutOfDateForPage(const GURL& page_url); |
770 | 780 |
781 // Mark that the on-demand favicon at |icon_url| was requested now. This | |
782 // postpones the automatic eviction of the favicon from the database. Not all | |
783 // calls end up in a write into the DB: | |
784 // - it is no-op if the bitmaps are not stored using SetOnDemandFavicons(); | |
785 // - the updates of the last requested time have limited frequency for each | |
pkotwicz
2017/06/07 17:40:52
Nit: Add quotes around "last requested time"
jkrcal
2017/06/09 16:38:37
Done.
| |
786 // particular favicon (e.g. once per week). This limits the overhead of | |
787 // cache management for on-demand favicons. | |
788 void TouchOnDemandFavicon(const GURL& icon_url); | |
789 | |
771 // Used by the FaviconService for importing many favicons for many pages at | 790 // Used by the FaviconService for importing many favicons for many pages at |
772 // once. The pages must exist, any favicon sets for unknown pages will be | 791 // once. The pages must exist, any favicon sets for unknown pages will be |
773 // discarded. Existing favicons will not be overwritten. | 792 // discarded. Existing favicons will not be overwritten. |
774 void SetImportedFavicons( | 793 void SetImportedFavicons( |
775 const favicon_base::FaviconUsageDataList& favicon_usage); | 794 const favicon_base::FaviconUsageDataList& favicon_usage); |
776 | 795 |
777 // Sets the in-memory URL database. This is called by the backend once the | 796 // Sets the in-memory URL database. This is called by the backend once the |
778 // database is loaded to make it available. | 797 // database is loaded to make it available. |
779 void SetInMemoryBackend(std::unique_ptr<InMemoryHistoryBackend> mem_backend); | 798 void SetInMemoryBackend(std::unique_ptr<InMemoryHistoryBackend> mem_backend); |
780 | 799 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
839 | 858 |
840 // All vended weak pointers are invalidated in Cleanup(). | 859 // All vended weak pointers are invalidated in Cleanup(). |
841 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; | 860 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; |
842 | 861 |
843 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 862 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
844 }; | 863 }; |
845 | 864 |
846 } // namespace history | 865 } // namespace history |
847 | 866 |
848 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 867 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
OLD | NEW |