summaryrefslogtreecommitdiffstats
path: root/chrome/browser/icon_manager.h
diff options
context:
space:
mode:
authorkaiwang@chromium.org <kaiwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-05 20:26:17 +0000
committerkaiwang@chromium.org <kaiwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-05 20:26:17 +0000
commitc189698a31f985fd4fc0989e8fba4e3d009975c7 (patch)
tree42ab0ac1c54a8894f9107254516841d56acf57cc /chrome/browser/icon_manager.h
parentc1bf78e353678cd033daaa23279db5199f9a1040 (diff)
downloadchromium_src-c189698a31f985fd4fc0989e8fba4e3d009975c7.zip
chromium_src-c189698a31f985fd4fc0989e8fba4e3d009975c7.tar.gz
chromium_src-c189698a31f985fd4fc0989e8fba4e3d009975c7.tar.bz2
Convert IconManager to use new CancelableTaskTracker
BUG=155883 Review URL: https://chromiumcodereview.appspot.com/11441006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171296 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/icon_manager.h')
-rw-r--r--chrome/browser/icon_manager.h36
1 files changed, 17 insertions, 19 deletions
diff --git a/chrome/browser/icon_manager.h b/chrome/browser/icon_manager.h
index f02b9aa..d6e17d4 100644
--- a/chrome/browser/icon_manager.h
+++ b/chrome/browser/icon_manager.h
@@ -47,15 +47,13 @@
#include <map>
-#include "base/hash_tables.h"
-#include "chrome/browser/common/cancelable_request.h"
#include "chrome/browser/icon_loader.h"
+#include "chrome/common/cancelable_task_tracker.h"
#include "ui/gfx/image/image.h"
class FilePath;
-class IconManager : public IconLoader::Delegate,
- public CancelableRequestProvider {
+class IconManager : public IconLoader::Delegate {
public:
IconManager();
virtual ~IconManager();
@@ -65,25 +63,27 @@ class IconManager : public IconLoader::Delegate,
// it via 'LoadIcon'. The returned bitmap is owned by the IconManager and must
// not be free'd by the caller. If the caller needs to modify the icon, it
// must make a copy and modify the copy.
- gfx::Image* LookupIcon(const FilePath& file_name,
- IconLoader::IconSize size);
+ gfx::Image* LookupIcon(const FilePath& file_name, IconLoader::IconSize size);
- typedef CancelableRequestProvider::Handle Handle;
- typedef base::Callback<void(Handle, gfx::Image*)> IconRequestCallback;
+ typedef base::Callback<void(gfx::Image*)> IconRequestCallback;
// Asynchronous call to lookup and return the icon associated with file. The
- // work is done on the file thread, with the callbacks running on the UI
- // thread. The return value is the 'request_id' that will be passed to the
- // client in the callback. Note: this does *not* check the cache.
+ // work is done on the file thread, with the callbacks running on the thread
+ // this function is called.
//
- // WATCH OUT: The returned bitmap pointer may be NULL if decoding failed.
- Handle LoadIcon(const FilePath& file_name,
- IconLoader::IconSize size,
- CancelableRequestConsumerBase* consumer,
- const IconRequestCallback& callback);
+ // Note:
+ // 1. This does *not* check the cache.
+ // 2. The returned bitmap pointer is *not* owned by callback. So callback
+ // should never keep it or delete it.
+ // 3. The gfx::Image pointer passed to the callback may be NULL if decoding
+ // failed.
+ CancelableTaskTracker::TaskId LoadIcon(const FilePath& file_name,
+ IconLoader::IconSize size,
+ const IconRequestCallback& callback,
+ CancelableTaskTracker* tracker);
// IconLoader::Delegate interface.
- virtual bool OnImageLoaded(IconLoader* source, gfx::Image* result) OVERRIDE;
+ virtual bool OnImageLoaded(IconLoader* loader, gfx::Image* result) OVERRIDE;
// Get the identifying string for the given file. The implementation
// is in icon_manager_[platform].cc.
@@ -103,8 +103,6 @@ class IconManager : public IconLoader::Delegate,
typedef std::map<CacheKey, gfx::Image*> IconMap;
IconMap icon_cache_;
- typedef CancelableRequest<IconRequestCallback> IconRequest;
-
// Asynchronous requests that have not yet been completed.
struct ClientRequest;
typedef std::map<IconLoader*, ClientRequest> ClientRequests;