diff options
author | kaiwang@chromium.org <kaiwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-07 01:32:01 +0000 |
---|---|---|
committer | kaiwang@chromium.org <kaiwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-07 01:32:01 +0000 |
commit | 0ea3db50aa19bcc15dcf15fcf4e7b20be3b004fb (patch) | |
tree | 972c588c6b25ddbbcce41e50193c4346993f496e /chrome/browser/jumplist_win.h | |
parent | 2494ceabbea6b78e7b5dda93717dcbcfbb1bc5a4 (diff) | |
download | chromium_src-0ea3db50aa19bcc15dcf15fcf4e7b20be3b004fb.zip chromium_src-0ea3db50aa19bcc15dcf15fcf4e7b20be3b004fb.tar.gz chromium_src-0ea3db50aa19bcc15dcf15fcf4e7b20be3b004fb.tar.bz2 |
Convert some FaviconService functions to use New CancelableTaskTracker
This CL converts:
FaviconService::GetFaviconImageForURL
FaviconService::GetRawFaviconForURL
FaviconService::GetFaviconForURL
---------- They depends on ---------
HistoryService::GetFaviconsForURL
---------- which depends on --------
HistoryBackend::GetFaviconsForURL
So please review above changes first.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FaviconService::GetFaviconImageForURL
---------- is used by --------------
bookmarks/bookmark_model.cc
ui/intents/web_intent_icon_loader.cc
ui/cocoa/history_menu_bridge.mm
ui/toolbar/recent_tabs_sub_menu_model.cc
ui/toolbar/back_forward_menu_model.cc
ui/webui/ntp/app_launcher_handler.cc
jumplist_win.cc
FaviconService::GetRawFaviconForURL
---------- is used by --------------
android/provider/chrome_browser_provider.cc
bookmarks/bookmark_html_writer.cc
sync/glue/session_model_associator.cc
ui/webui/extensions/extension_icon_source.cc
ui/webui/favicon_source.cc
ui/webui/ntp/android/bookmarks_handler.cc
ui/webui/ntp/favicon_webui_handler.cc
FaviconService::GetFaviconForURL
---------- is used by --------------
favicon/favicon_handler.h
BUG=155883
Review URL: https://chromiumcodereview.appspot.com/11421188
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/jumplist_win.h')
-rw-r--r-- | chrome/browser/jumplist_win.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/chrome/browser/jumplist_win.h b/chrome/browser/jumplist_win.h index 7aebd6d..8a801ba 100644 --- a/chrome/browser/jumplist_win.h +++ b/chrome/browser/jumplist_win.h @@ -13,11 +13,12 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/synchronization/lock.h" -#include "chrome/browser/common/cancelable_request.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/sessions/tab_restore_service.h" #include "chrome/browser/sessions/tab_restore_service_observer.h" +#include "chrome/common/cancelable_task_tracker.h" +#include "content/public/browser/browser_thread.h" #include "third_party/skia/include/core/SkBitmap.h" namespace content { @@ -105,9 +106,13 @@ typedef std::vector<scoped_refptr<ShellLinkItem> > ShellLinkItemList; // Updating a JumpList requires some file operations and it is not good to // update it in a UI thread. To solve this problem, this class posts to a // runnable method when it actually updates a JumpList. +// +// Note. CancelableTaskTracker is not thread safe, so we always delete JumpList +// on UI thread (the same thread it got constructed on). class JumpList : public TabRestoreServiceObserver, public content::NotificationObserver, - public base::RefCountedThreadSafe<JumpList> { + public base::RefCountedThreadSafe< + JumpList, content::BrowserThread::DeleteOnUIThread> { public: JumpList(); @@ -178,9 +183,7 @@ class JumpList : public TabRestoreServiceObserver, // is available. // To avoid file operations, this function just attaches the given data to // a ShellLinkItem object. - void OnFaviconDataAvailable( - HistoryService::Handle handle, - const history::FaviconImageResult& image_result); + void OnFaviconDataAvailable(const history::FaviconImageResult& image_result); // Callback for TopSites that notifies when the "Most // Visited" list is available. This function updates the ShellLinkItemList @@ -198,14 +201,16 @@ class JumpList : public TabRestoreServiceObserver, void CreateIconFiles(const ShellLinkItemList& item_list); private: - friend class base::RefCountedThreadSafe<JumpList>; + friend struct content::BrowserThread::DeleteOnThread< + content::BrowserThread::UI>; + friend class base::DeleteHelper<JumpList>; ~JumpList(); // For callbacks may be run after destruction. base::WeakPtrFactory<JumpList> weak_ptr_factory_; - // Our consumers for HistoryService. - CancelableRequestConsumer favicon_consumer_; + // Tracks FaviconService tasks. + CancelableTaskTracker cancelable_task_tracker_; // The Profile object is used to listen for events Profile* profile_; @@ -232,9 +237,9 @@ class JumpList : public TabRestoreServiceObserver, typedef std::pair<std::string, scoped_refptr<ShellLinkItem> > URLPair; std::list<URLPair> icon_urls_; - // Handle of last favicon request used to cancel if a new request - // comes in before the current one returns. - FaviconService::Handle handle_; + // Id of last favicon task. It's used to cancel current task if a new one + // comes in before it finishes. + CancelableTaskTracker::TaskId task_id_; // Lock for most_visited_pages_, recently_closed_pages_, icon_urls_ // as they may be used by up to 3 threads. |