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_loader.h" | 5 #include "chrome/browser/chromeos/boot_times_loader.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 return; | 227 return; |
228 | 228 |
229 // Wait until firmware-boot-time file exists by reposting. | 229 // Wait until firmware-boot-time file exists by reposting. |
230 FilePath log_dir(kLogPath); | 230 FilePath log_dir(kLogPath); |
231 FilePath log_file = log_dir.Append(kFirmwareBootTime); | 231 FilePath log_file = log_dir.Append(kFirmwareBootTime); |
232 if (!file_util::PathExists(log_file)) { | 232 if (!file_util::PathExists(log_file)) { |
233 BrowserThread::PostDelayedTask( | 233 BrowserThread::PostDelayedTask( |
234 BrowserThread::FILE, | 234 BrowserThread::FILE, |
235 FROM_HERE, | 235 FROM_HERE, |
236 base::Bind(&Backend::GetBootTimes, this, request), | 236 base::Bind(&Backend::GetBootTimes, this, request), |
237 kReadAttemptDelayMs); | 237 base::TimeDelta::FromMilliseconds(kReadAttemptDelayMs)); |
238 return; | 238 return; |
239 } | 239 } |
240 | 240 |
241 BootTimes boot_times; | 241 BootTimes boot_times; |
242 | 242 |
243 GetTime(kFirmwareBootTime, &boot_times.firmware); | 243 GetTime(kFirmwareBootTime, &boot_times.firmware); |
244 GetTime(uptime_prefix + kPreStartup, &boot_times.pre_startup); | 244 GetTime(uptime_prefix + kPreStartup, &boot_times.pre_startup); |
245 GetTime(uptime_prefix + kXStarted, &boot_times.x_started); | 245 GetTime(uptime_prefix + kXStarted, &boot_times.x_started); |
246 GetTime(uptime_prefix + kChromeExec, &boot_times.chrome_exec); | 246 GetTime(uptime_prefix + kChromeExec, &boot_times.chrome_exec); |
247 GetTime(uptime_prefix + kChromeMain, &boot_times.chrome_main); | 247 GetTime(uptime_prefix + kChromeMain, &boot_times.chrome_main); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 content::NotificationService::AllSources()); | 359 content::NotificationService::AllSources()); |
360 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 360 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
361 content::NotificationService::AllSources()); | 361 content::NotificationService::AllSources()); |
362 registrar_.Remove(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, | 362 registrar_.Remove(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, |
363 content::NotificationService::AllSources()); | 363 content::NotificationService::AllSources()); |
364 // Don't swamp the FILE thread right away. | 364 // Don't swamp the FILE thread right away. |
365 BrowserThread::PostDelayedTask( | 365 BrowserThread::PostDelayedTask( |
366 BrowserThread::FILE, FROM_HERE, | 366 BrowserThread::FILE, FROM_HERE, |
367 base::Bind(&WriteTimes, kLoginTimes, kUmaLogin, kUmaLoginPrefix, | 367 base::Bind(&WriteTimes, kLoginTimes, kUmaLogin, kUmaLoginPrefix, |
368 login_time_markers_), | 368 login_time_markers_), |
369 kLoginTimeWriteDelayMs); | 369 base::TimeDelta::FromMilliseconds(kLoginTimeWriteDelayMs)); |
370 } | 370 } |
371 | 371 |
372 void BootTimesLoader::WriteLogoutTimes() { | 372 void BootTimesLoader::WriteLogoutTimes() { |
373 // Either we're on the browser thread, or (more likely) Chrome is in the | 373 // Either we're on the browser thread, or (more likely) Chrome is in the |
374 // process of shutting down and we're on the main thread but the message loop | 374 // process of shutting down and we're on the main thread but the message loop |
375 // has already been terminated. | 375 // has already been terminated. |
376 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || | 376 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
377 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); | 377 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); |
378 | 378 |
379 WriteTimes(kLogoutTimes, | 379 WriteTimes(kLogoutTimes, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 GetRenderWidgetHost(&web_contents->GetController()); | 510 GetRenderWidgetHost(&web_contents->GetController()); |
511 render_widget_hosts_loading_.erase(render_widget_host); | 511 render_widget_hosts_loading_.erase(render_widget_host); |
512 break; | 512 break; |
513 } | 513 } |
514 default: | 514 default: |
515 break; | 515 break; |
516 } | 516 } |
517 } | 517 } |
518 | 518 |
519 } // namespace chromeos | 519 } // namespace chromeos |
OLD | NEW |