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

Side by Side Diff: ios/chrome/browser/favicon/large_icon_cache.h

Issue 1413903008: Add LargeIconCache and LargeIconServiceFactory for iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using wrong thread pool Created 5 years, 1 month 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef IOS_CHROME_BROWSER_FAVICON_LARGE_ICON_CACHE_H_
6 #define IOS_CHROME_BROWSER_FAVICON_LARGE_ICON_CACHE_H_
7
8 #include "base/containers/mru_cache.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "components/keyed_service/core/keyed_service.h"
12
13 namespace ios {
sdefresne 2015/10/30 09:27:19 nit: ditto, sort namespaces.
justincohen 2015/10/30 11:59:20 Done.
14 class ChromeBrowserState;
15 }
16
17 namespace favicon_base {
18 struct LargeIconResult;
19 };
20
21 class GURL;
sdefresne 2015/10/30 09:27:19 nit: ditto, please put before namespaces.
justincohen 2015/10/30 11:59:21 Done.
22
23 // Provides a cache of most recently used LargeIconResult.
24 //
25 // Example usage:
26 // LargeIconCache* large_icon_cache =
27 // IOSChromeLargeIconServiceFactory::GetForBrowserState(browser_state);
28 // large_icon_cache->GetCachedResult(...);
sdefresne 2015/10/30 09:27:18 nit: scoped_ptr<favicon_base::LargeIconResult> ic
justincohen 2015/10/30 11:59:20 Done.
29 //
30 class LargeIconCache : public KeyedService {
31 public:
32 explicit LargeIconCache();
sdefresne 2015/10/30 09:27:19 style: do not use "explicit" for constructor witho
justincohen 2015/10/30 11:59:20 Done.
33 ~LargeIconCache() override;
34
35 // |LargeIconService| does everything on callbacks, and iOS needs to load the
36 // icons immediately on page load. This caches the LargeIconResult so we can
37 // immediately load.
38 void SetCachedResult(const GURL url, const favicon_base::LargeIconResult&);
sdefresne 2015/10/30 09:27:19 const GURL -> const GURL&
justincohen 2015/10/30 11:59:20 Done.
39
40 // Get a cached LargeIconResult.
sdefresne 2015/10/30 09:27:19 s/Get/Returns/
justincohen 2015/10/30 11:59:20 Done.
41 scoped_ptr<favicon_base::LargeIconResult> GetCachedResult(const GURL& url);
42
43 private:
44 // Clone a LargeIconResult.
sdefresne 2015/10/30 09:27:19 s/Clone/Clones/
justincohen 2015/10/30 11:59:21 Done.
45 scoped_ptr<favicon_base::LargeIconResult> CloneLargeIconResult(
46 const favicon_base::LargeIconResult& large_icon_result);
47
48 // Cache of LargeIconResult.
49 struct CacheEntry {
sdefresne 2015/10/30 09:27:19 Please forward-declare: class LargeIconCacheEntry
justincohen 2015/10/30 11:59:20 Done.
50 CacheEntry();
51 ~CacheEntry();
52
53 scoped_ptr<favicon_base::LargeIconResult> result;
54 };
55
56 base::OwningMRUCache<GURL, CacheEntry*> cache_;
57
58 DISALLOW_COPY_AND_ASSIGN(LargeIconCache);
59 };
60
61 #endif // IOS_CHROME_BROWSER_FAVICON_LARGE_ICON_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698