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 #include "chrome/browser/chromeos/boot_times_recorder.h" | 5 #include "chrome/browser/chromeos/boot_times_recorder.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 static const char kUmaLogout[] = "ShutdownTime.Logout"; | 130 static const char kUmaLogout[] = "ShutdownTime.Logout"; |
131 static const char kUmaLogoutPrefix[] = "ShutdownTime."; | 131 static const char kUmaLogoutPrefix[] = "ShutdownTime."; |
132 static const char kUmaRestart[] = "ShutdownTime.Restart"; | 132 static const char kUmaRestart[] = "ShutdownTime.Restart"; |
133 | 133 |
134 // Name of file collecting login times. | 134 // Name of file collecting login times. |
135 static const base::FilePath::CharType kLoginTimes[] = FPL("login-times"); | 135 static const base::FilePath::CharType kLoginTimes[] = FPL("login-times"); |
136 | 136 |
137 // Name of file collecting logout times. | 137 // Name of file collecting logout times. |
138 static const char kLogoutTimes[] = "logout-times"; | 138 static const char kLogoutTimes[] = "logout-times"; |
139 | 139 |
140 static base::LazyInstance<BootTimesRecorder> g_boot_times_recorder = | 140 static base::LazyInstance<BootTimesRecorder>::DestructorAtExit |
141 LAZY_INSTANCE_INITIALIZER; | 141 g_boot_times_recorder = LAZY_INSTANCE_INITIALIZER; |
142 | 142 |
143 // static | 143 // static |
144 BootTimesRecorder::Stats BootTimesRecorder::Stats::GetCurrentStats() { | 144 BootTimesRecorder::Stats BootTimesRecorder::Stats::GetCurrentStats() { |
145 const base::FilePath kProcUptime(FPL("/proc/uptime")); | 145 const base::FilePath kProcUptime(FPL("/proc/uptime")); |
146 const base::FilePath kDiskStat(FPL("/sys/block/sda/stat")); | 146 const base::FilePath kDiskStat(FPL("/sys/block/sda/stat")); |
147 Stats stats; | 147 Stats stats; |
148 // Callers of this method expect synchronous behavior. | 148 // Callers of this method expect synchronous behavior. |
149 // It's safe to allow IO here, because only virtual FS are accessed. | 149 // It's safe to allow IO here, because only virtual FS are accessed. |
150 base::ThreadRestrictions::ScopedAllowIO allow_io; | 150 base::ThreadRestrictions::ScopedAllowIO allow_io; |
151 base::ReadFileToString(kProcUptime, &stats.uptime_); | 151 base::ReadFileToString(kProcUptime, &stats.uptime_); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 GetRenderWidgetHost(&web_contents->GetController()); | 523 GetRenderWidgetHost(&web_contents->GetController()); |
524 render_widget_hosts_loading_.erase(render_widget_host); | 524 render_widget_hosts_loading_.erase(render_widget_host); |
525 break; | 525 break; |
526 } | 526 } |
527 default: | 527 default: |
528 break; | 528 break; |
529 } | 529 } |
530 } | 530 } |
531 | 531 |
532 } // namespace chromeos | 532 } // namespace chromeos |
OLD | NEW |