| Index: chrome/browser/icon_manager.h
|
| diff --git a/chrome/browser/icon_manager.h b/chrome/browser/icon_manager.h
|
| index 0b5ec07d416154d7ab1fe8201af40efa2ab0225c..ca3744e25de36fb5b7c6f5aab3f4c39fc95619db 100644
|
| --- a/chrome/browser/icon_manager.h
|
| +++ b/chrome/browser/icon_manager.h
|
| @@ -34,7 +34,7 @@
|
| // 2. An asynchronous icon load from a file on the file thread:
|
| // IconManager::LoadIcon()
|
| //
|
| -// When using the second (asychronous) method, callers must supply a callback
|
| +// When using the second (asynchronous) method, callers must supply a callback
|
| // which will be run once the icon has been extracted. The icon manager will
|
| // cache the results of the icon extraction so that subsequent lookups will be
|
| // fast.
|
| @@ -59,14 +59,14 @@ class IconManager : public IconLoader::Delegate {
|
| ~IconManager() override;
|
|
|
| // Synchronous call to examine the internal caches for the icon. Returns the
|
| - // icon if we have already loaded it, NULL if we don't have it and must load
|
| + // icon if we have already loaded it, null if we don't have it and must load
|
| // 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* LookupIconFromFilepath(const base::FilePath& file_name,
|
| + gfx::Image* LookupIconFromFilepath(const base::FilePath& file_path,
|
| IconLoader::IconSize size);
|
|
|
| - typedef base::Callback<void(gfx::Image*)> IconRequestCallback;
|
| + using IconRequestCallback = base::Callback<void(gfx::Image*)>;
|
|
|
| // 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 thread
|
| @@ -76,7 +76,7 @@ class IconManager : public IconLoader::Delegate {
|
| // 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
|
| + // 3. The gfx::Image pointer passed to the callback may be null if decoding
|
| // failed.
|
| base::CancelableTaskTracker::TaskId LoadIcon(
|
| const base::FilePath& file_name,
|
| @@ -85,35 +85,26 @@ class IconManager : public IconLoader::Delegate {
|
| base::CancelableTaskTracker* tracker);
|
|
|
| // IconLoader::Delegate interface.
|
| - bool OnGroupLoaded(IconLoader* loader, const IconGroupID& group) override;
|
| - bool OnImageLoaded(IconLoader* loader,
|
| - gfx::Image* result,
|
| - const IconGroupID& group) override;
|
| + void OnImageLoaded(IconLoader* loader,
|
| + std::unique_ptr<gfx::Image> result,
|
| + const IconLoader::IconGroup& group) override;
|
|
|
| private:
|
| struct CacheKey {
|
| - CacheKey(const IconGroupID& group, IconLoader::IconSize size);
|
| + CacheKey(const IconLoader::IconGroup& group, IconLoader::IconSize size);
|
|
|
| // Used as a key in the map below, so we need this comparator.
|
| bool operator<(const CacheKey &other) const;
|
|
|
| - IconGroupID group;
|
| + IconLoader::IconGroup group;
|
| IconLoader::IconSize size;
|
| };
|
|
|
| - gfx::Image* LookupIconFromGroup(const IconGroupID& group,
|
| - IconLoader::IconSize size);
|
| -
|
| - typedef std::map<CacheKey, gfx::Image*> IconMap;
|
| - IconMap icon_cache_;
|
| -
|
| - typedef std::map<base::FilePath, IconGroupID> GroupMap;
|
| - GroupMap group_cache_;
|
| + std::map<CacheKey, std::unique_ptr<gfx::Image>> icon_cache_;
|
|
|
| // Asynchronous requests that have not yet been completed.
|
| struct ClientRequest;
|
| - typedef std::map<IconLoader*, ClientRequest> ClientRequests;
|
| - ClientRequests requests_;
|
| + std::map<IconLoader*, ClientRequest> requests_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(IconManager);
|
| };
|
|
|