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

Unified Diff: chrome/browser/chromeos/boot_times_loader.h

Issue 11410073: Add function to CancelableTaskTracker and convert BootTimeLoader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again and add tests Created 8 years, 1 month 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 | « no previous file | chrome/browser/chromeos/boot_times_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/boot_times_loader.h
diff --git a/chrome/browser/chromeos/boot_times_loader.h b/chrome/browser/chromeos/boot_times_loader.h
index 691a44ffd97039d8775c48da9060d6fee87ea024..dc420e851d6810355665ccd31414112cd4a5fb01 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>;
« no previous file with comments | « no previous file | chrome/browser/chromeos/boot_times_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698