diff options
author | kaiwang@chromium.org <kaiwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-16 04:36:34 +0000 |
---|---|---|
committer | kaiwang@chromium.org <kaiwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-16 04:36:34 +0000 |
commit | edce70216d642db3b5433c540b2cbef93a183430 (patch) | |
tree | 2fd601b1a31a1ab8f32757e666f5e691a5486ee5 /chrome/browser/chromeos/boot_times_loader.h | |
parent | bab616bf4343e85877b951c8c96ad58196d23898 (diff) | |
download | chromium_src-edce70216d642db3b5433c540b2cbef93a183430.zip chromium_src-edce70216d642db3b5433c540b2cbef93a183430.tar.gz chromium_src-edce70216d642db3b5433c540b2cbef93a183430.tar.bz2 |
Add function to CancelableTaskTracker and convert BootTimeLoader
BUG=155883
Review URL: https://chromiumcodereview.appspot.com/11410073
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168134 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/boot_times_loader.h')
-rw-r--r-- | chrome/browser/chromeos/boot_times_loader.h | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/chrome/browser/chromeos/boot_times_loader.h b/chrome/browser/chromeos/boot_times_loader.h index 691a44ff..dc420e8 100644 --- a/chrome/browser/chromeos/boot_times_loader.h +++ b/chrome/browser/chromeos/boot_times_loader.h @@ -12,7 +12,7 @@ #include "base/callback_forward.h" #include "base/compiler_specific.h" #include "base/time.h" -#include "chrome/browser/common/cancelable_request.h" +#include "chrome/common/cancelable_task_tracker.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/render_widget_host.h" @@ -22,17 +22,14 @@ namespace chromeos { // BootTimesLoader loads the bootimes of Chrome OS from the file system. // Loading is done asynchronously on the file thread. Once loaded, // BootTimesLoader calls back to a method of your choice with the boot times. -// To use BootTimesLoader do the following: +// To use BootTimesLoader, do the following: // // . In your class define a member field of type chromeos::BootTimesLoader and -// CancelableRequestConsumerBase. +// CancelableTaskTracker. // . Define the callback method, something like: -// void OnBootTimesLoader(chromeos::BootTimesLoader::Handle, -// BootTimesLoader::BootTimes boot_times); -// . When you want the version invoke: loader.GetBootTimes(&consumer, callback); -class BootTimesLoader - : public CancelableRequestProvider, - public content::NotificationObserver { +// void OnBootTimesLoaded(const BootTimesLoader::BootTimes& boot_times); +// . When you want the version invoke: loader.GetBootTimes(callback, &tracker_); +class BootTimesLoader : public content::NotificationObserver { public: BootTimesLoader(); virtual ~BootTimesLoader(); @@ -60,17 +57,14 @@ class BootTimesLoader total(0) {} } BootTimes; - // Signature - typedef base::Callback<void(Handle, BootTimes)> GetBootTimesCallback; - - typedef CancelableRequest<GetBootTimesCallback> GetBootTimesRequest; - static BootTimesLoader* Get(); + typedef base::Callback<void(const BootTimes&)> GetBootTimesCallback; + // Asynchronously requests the info. - Handle GetBootTimes( - CancelableRequestConsumerBase* consumer, - const GetBootTimesCallback& callback); + CancelableTaskTracker::TaskId GetBootTimes( + const GetBootTimesCallback& callback, + CancelableTaskTracker* tracker); // Add a time marker for login. A timeline will be dumped to // /tmp/login-times-sent after login is done. If |send_to_uma| is true @@ -119,7 +113,9 @@ class BootTimesLoader public: Backend() {} - void GetBootTimes(const scoped_refptr<GetBootTimesRequest>& request); + void GetBootTimesAndRunCallback( + const CancelableTaskTracker::IsCanceledCallback& is_canceled_cb, + const GetBootTimesCallback& callback); private: friend class base::RefCountedThreadSafe<Backend>; |