OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SYNC_SESSIONS_FAVICON_CACHE_H_ | 5 #ifndef COMPONENTS_SYNC_SESSIONS_FAVICON_CACHE_H_ |
6 #define COMPONENTS_SYNC_SESSIONS_FAVICON_CACHE_H_ | 6 #define COMPONENTS_SYNC_SESSIONS_FAVICON_CACHE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 FRIEND_TEST_ALL_PREFIXES(SyncFaviconCacheTest, HistorySubsetClear); | 116 FRIEND_TEST_ALL_PREFIXES(SyncFaviconCacheTest, HistorySubsetClear); |
117 | 117 |
118 // Functor for ordering SyncedFaviconInfo objects by recency; | 118 // Functor for ordering SyncedFaviconInfo objects by recency; |
119 struct FaviconRecencyFunctor { | 119 struct FaviconRecencyFunctor { |
120 bool operator()(const linked_ptr<SyncedFaviconInfo>& lhs, | 120 bool operator()(const linked_ptr<SyncedFaviconInfo>& lhs, |
121 const linked_ptr<SyncedFaviconInfo>& rhs) const; | 121 const linked_ptr<SyncedFaviconInfo>& rhs) const; |
122 }; | 122 }; |
123 | 123 |
124 | 124 |
125 // Map of favicon url to favicon image. | 125 // Map of favicon url to favicon image. |
126 typedef std::map<GURL, linked_ptr<SyncedFaviconInfo> > FaviconMap; | 126 using FaviconMap = std::map<GURL, linked_ptr<SyncedFaviconInfo>>; |
127 typedef std::set<linked_ptr<SyncedFaviconInfo>, | 127 using RecencySet = |
128 FaviconRecencyFunctor> RecencySet; | 128 std::set<linked_ptr<SyncedFaviconInfo>, FaviconRecencyFunctor>; |
129 // Map of page url to task id (for favicon loading). | 129 // Map of page url to task id (for favicon loading). |
130 typedef std::map<GURL, base::CancelableTaskTracker::TaskId> PageTaskMap; | 130 using PageTaskMap = std::map<GURL, base::CancelableTaskTracker::TaskId>; |
131 // Map of page url to favicon url. | 131 // Map of page url to favicon url. |
132 typedef std::map<GURL, GURL> PageFaviconMap; | 132 using PageFaviconMap = std::map<GURL, GURL>; |
133 | 133 |
134 // Helper method to perform OnReceivedSyncFavicon work without worrying about | 134 // Helper method to perform OnReceivedSyncFavicon work without worrying about |
135 // whether caller holds a sync transaction. | 135 // whether caller holds a sync transaction. |
136 void OnReceivedSyncFaviconImpl(const GURL& icon_url, | 136 void OnReceivedSyncFaviconImpl(const GURL& icon_url, |
137 const std::string& icon_bytes, | 137 const std::string& icon_bytes, |
138 int64_t visit_time_ms); | 138 int64_t visit_time_ms); |
139 | 139 |
140 // Callback method to store a tab's favicon into its sync node once it becomes | 140 // Callback method to store a tab's favicon into its sync node once it becomes |
141 // available. Does nothing if no favicon data was available. | 141 // available. Does nothing if no favicon data was available. |
142 void OnFaviconDataAvailable( | 142 void OnFaviconDataAvailable( |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 // Weak pointer factory for favicon loads. | 247 // Weak pointer factory for favicon loads. |
248 base::WeakPtrFactory<FaviconCache> weak_ptr_factory_; | 248 base::WeakPtrFactory<FaviconCache> weak_ptr_factory_; |
249 | 249 |
250 DISALLOW_COPY_AND_ASSIGN(FaviconCache); | 250 DISALLOW_COPY_AND_ASSIGN(FaviconCache); |
251 }; | 251 }; |
252 | 252 |
253 } // namespace sync_sessions | 253 } // namespace sync_sessions |
254 | 254 |
255 #endif // COMPONENTS_SYNC_SESSIONS_FAVICON_CACHE_H_ | 255 #endif // COMPONENTS_SYNC_SESSIONS_FAVICON_CACHE_H_ |
OLD | NEW |