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

Unified Diff: chrome/browser/icon_loader.h

Issue 12211049: Removing base::ThreadRestrictions::ScopedAllowIO from icon_manager_linux.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix presubmit. Created 7 years, 9 months 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/extensions/api/downloads/downloads_api.cc ('k') | chrome/browser/icon_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/icon_loader.h
diff --git a/chrome/browser/icon_loader.h b/chrome/browser/icon_loader.h
index ff22c7a056c8995ca6952fbac554d5263c05e70e..531a9b709d2ae89f68ae12c723420fda7fd93174 100644
--- a/chrome/browser/icon_loader.h
+++ b/chrome/browser/icon_loader.h
@@ -10,6 +10,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop_proxy.h"
@@ -41,16 +42,25 @@ class IconLoader : public base::RefCountedThreadSafe<IconLoader> {
class Delegate {
public:
+ // Invoked when an icon group has been read, but before the icon data
+ // is read. If the icon is already cached, this method should call and
+ // return the results of OnImageLoaded with the cached image.
+ virtual bool OnGroupLoaded(IconLoader* source,
+ const IconGroupID& group) = 0;
// Invoked when an icon has been read. |source| is the IconLoader. If the
// icon has been successfully loaded, result is non-null. This method must
// return true if it is taking ownership of the returned image.
- virtual bool OnImageLoaded(IconLoader* source, gfx::Image* result) = 0;
+ virtual bool OnImageLoaded(IconLoader* source,
+ gfx::Image* result,
+ const IconGroupID& group) = 0;
protected:
virtual ~Delegate() {}
};
- IconLoader(const IconGroupID& group, IconSize size, Delegate* delegate);
+ IconLoader(const base::FilePath& file_path,
+ IconSize size,
+ Delegate* delegate);
// Start reading the icon on the file thread.
void Start();
@@ -60,6 +70,12 @@ class IconLoader : public base::RefCountedThreadSafe<IconLoader> {
virtual ~IconLoader();
+ // Get the identifying string for the given file. The implementation
+ // is in icon_loader_[platform].cc.
+ static IconGroupID ReadGroupIDFromFilepath(const base::FilePath& path);
+
+ void ReadGroup();
+ void OnReadGroup();
void ReadIcon();
void NotifyDelegate();
@@ -67,6 +83,8 @@ class IconLoader : public base::RefCountedThreadSafe<IconLoader> {
// The message loop object of the thread in which we notify the delegate.
scoped_refptr<base::MessageLoopProxy> target_message_loop_;
+ base::FilePath file_path_;
+
IconGroupID group_;
IconSize icon_size_;
« no previous file with comments | « chrome/browser/extensions/api/downloads/downloads_api.cc ('k') | chrome/browser/icon_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698