| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/atomic_sequence_num.h" | 11 #include "base/atomic_sequence_num.h" |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/task/cancelable_task_tracker.h" |
| 14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 15 #include "chrome/common/cancelable_task_tracker.h" | |
| 16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "content/public/browser/render_widget_host.h" | 18 #include "content/public/browser/render_widget_host.h" |
| 19 | 19 |
| 20 namespace chromeos { | 20 namespace chromeos { |
| 21 | 21 |
| 22 // BootTimesLoader loads the bootimes of Chrome OS from the file system. | 22 // BootTimesLoader loads the bootimes of Chrome OS from the file system. |
| 23 // Loading is done asynchronously on the file thread. Once loaded, | 23 // Loading is done asynchronously on the file thread. Once loaded, |
| 24 // BootTimesLoader calls back to a method of your choice with the boot times. | 24 // BootTimesLoader calls back to a method of your choice with the boot times. |
| 25 // To use BootTimesLoader, do the following: | 25 // To use BootTimesLoader, do the following: |
| 26 // | 26 // |
| 27 // . In your class define a member field of type chromeos::BootTimesLoader and | 27 // . In your class define a member field of type chromeos::BootTimesLoader and |
| 28 // CancelableTaskTracker. | 28 // base::CancelableTaskTracker. |
| 29 // . Define the callback method, something like: | 29 // . Define the callback method, something like: |
| 30 // void OnBootTimesLoaded(const BootTimesLoader::BootTimes& boot_times); | 30 // void OnBootTimesLoaded(const BootTimesLoader::BootTimes& boot_times); |
| 31 // . When you want the version invoke: loader.GetBootTimes(callback, &tracker_); | 31 // . When you want the version invoke: loader.GetBootTimes(callback, &tracker_); |
| 32 class BootTimesLoader : public content::NotificationObserver { | 32 class BootTimesLoader : public content::NotificationObserver { |
| 33 public: | 33 public: |
| 34 BootTimesLoader(); | 34 BootTimesLoader(); |
| 35 virtual ~BootTimesLoader(); | 35 virtual ~BootTimesLoader(); |
| 36 | 36 |
| 37 static BootTimesLoader* Get(); | 37 static BootTimesLoader* Get(); |
| 38 | 38 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 std::vector<TimeMarker> login_time_markers_; | 142 std::vector<TimeMarker> login_time_markers_; |
| 143 std::vector<TimeMarker> logout_time_markers_; | 143 std::vector<TimeMarker> logout_time_markers_; |
| 144 std::set<content::RenderWidgetHost*> render_widget_hosts_loading_; | 144 std::set<content::RenderWidgetHost*> render_widget_hosts_loading_; |
| 145 | 145 |
| 146 DISALLOW_COPY_AND_ASSIGN(BootTimesLoader); | 146 DISALLOW_COPY_AND_ASSIGN(BootTimesLoader); |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 } // namespace chromeos | 149 } // namespace chromeos |
| 150 | 150 |
| 151 #endif // CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_ | 151 #endif // CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_ |
| OLD | NEW |