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

Unified Diff: chrome/browser/icon_manager.h

Issue 2577273002: Clean up IconLoader. (Closed)
Patch Set: bind Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/icon_loader_win.cc ('k') | chrome/browser/icon_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/icon_manager.h
diff --git a/chrome/browser/icon_manager.h b/chrome/browser/icon_manager.h
index 43c36acedc0e64f6e91e00f4e7c84878081fe16a..5cda41d469b3ebc645b66d0c3c95409565585b46 100644
--- a/chrome/browser/icon_manager.h
+++ b/chrome/browser/icon_manager.h
@@ -50,14 +50,15 @@
#include "base/files/file_path.h"
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "base/task/cancelable_task_tracker.h"
#include "chrome/browser/icon_loader.h"
#include "ui/gfx/image/image.h"
-class IconManager : public IconLoader::Delegate {
+class IconManager {
public:
IconManager();
- ~IconManager() override;
+ ~IconManager();
// Synchronous call to examine the internal caches for the icon. Returns the
// icon if we have already loaded it, or null if we don't have it and must
@@ -86,10 +87,11 @@ class IconManager : public IconLoader::Delegate {
base::CancelableTaskTracker* tracker);
private:
- // IconLoader::Delegate interface.
- void OnImageLoaded(IconLoader* loader,
- std::unique_ptr<gfx::Image> result,
- const IconLoader::IconGroup& group) override;
+ void OnIconLoaded(IconRequestCallback callback,
+ base::FilePath file_path,
+ IconLoader::IconSize size,
+ std::unique_ptr<gfx::Image> result,
+ const IconLoader::IconGroup& group);
struct CacheKey {
CacheKey(const IconLoader::IconGroup& group, IconLoader::IconSize size);
@@ -104,9 +106,7 @@ class IconManager : public IconLoader::Delegate {
std::map<base::FilePath, IconLoader::IconGroup> group_cache_;
std::map<CacheKey, std::unique_ptr<gfx::Image>> icon_cache_;
- // Asynchronous requests that have not yet been completed.
- struct ClientRequest;
- std::map<IconLoader*, ClientRequest> requests_;
+ base::WeakPtrFactory<IconManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(IconManager);
};
« no previous file with comments | « chrome/browser/icon_loader_win.cc ('k') | chrome/browser/icon_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698