| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Signature | 47 // Signature |
| 48 typedef Callback2<Handle, BootTimes>::Type GetBootTimesCallback; | 48 typedef Callback2<Handle, BootTimes>::Type GetBootTimesCallback; |
| 49 | 49 |
| 50 typedef CancelableRequest<GetBootTimesCallback> GetBootTimesRequest; | 50 typedef CancelableRequest<GetBootTimesCallback> GetBootTimesRequest; |
| 51 | 51 |
| 52 // Asynchronously requests the info. | 52 // Asynchronously requests the info. |
| 53 Handle GetBootTimes( | 53 Handle GetBootTimes( |
| 54 CancelableRequestConsumerBase* consumer, | 54 CancelableRequestConsumerBase* consumer, |
| 55 GetBootTimesCallback* callback); | 55 GetBootTimesCallback* callback); |
| 56 | 56 |
| 57 // Records current uptime and disk usage for metrics use. |
| 58 // Posts task to file thread. |
| 59 // name will be used as part of file names in /tmp. |
| 60 // Existing stats files will not be overwritten. |
| 61 static void RecordCurrentStats(const std::string& name); |
| 62 |
| 63 // Saves away the stats at main, so the can be recorded later. At main() time |
| 64 // the necessary threads don't exist yet for recording the data. |
| 65 static void SaveChromeMainStats(); |
| 66 |
| 67 // Records the data previously saved by SaveChromeMainStats(), using the |
| 68 // file thread. |
| 69 // Existing stats files will not be overwritten. |
| 70 static void RecordChromeMainStats(); |
| 71 |
| 57 private: | 72 private: |
| 58 // BootTimesLoader calls into the Backend on the file thread to load | 73 // BootTimesLoader calls into the Backend on the file thread to load |
| 59 // and extract the boot times. | 74 // and extract the boot times. |
| 60 class Backend : public base::RefCountedThreadSafe<Backend> { | 75 class Backend : public base::RefCountedThreadSafe<Backend> { |
| 61 public: | 76 public: |
| 62 Backend() {} | 77 Backend() {} |
| 63 | 78 |
| 64 void GetBootTimes(scoped_refptr<GetBootTimesRequest> request); | 79 void GetBootTimes(scoped_refptr<GetBootTimesRequest> request); |
| 65 | 80 |
| 66 private: | 81 private: |
| 67 friend class base::RefCountedThreadSafe<Backend>; | 82 friend class base::RefCountedThreadSafe<Backend>; |
| 68 | 83 |
| 69 ~Backend() {} | 84 ~Backend() {} |
| 70 | 85 |
| 71 DISALLOW_COPY_AND_ASSIGN(Backend); | 86 DISALLOW_COPY_AND_ASSIGN(Backend); |
| 72 }; | 87 }; |
| 73 | 88 |
| 74 scoped_refptr<Backend> backend_; | 89 scoped_refptr<Backend> backend_; |
| 75 | 90 |
| 76 DISALLOW_COPY_AND_ASSIGN(BootTimesLoader); | 91 DISALLOW_COPY_AND_ASSIGN(BootTimesLoader); |
| 77 }; | 92 }; |
| 78 | 93 |
| 79 } // namespace chromeos | 94 } // namespace chromeos |
| 80 | 95 |
| 81 #endif // CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_ | 96 #endif // CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_ |
| OLD | NEW |