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

Unified Diff: chrome/browser/chromeos/browser_notification_observers.cc

Issue 2112006: Cleaned up some constants for stats reading (Closed)
Patch Set: Review mods Created 10 years, 7 months 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 | « chrome/browser/chromeos/boot_times_loader.cc ('k') | chrome/browser/chromeos/login/background_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/browser_notification_observers.cc
diff --git a/chrome/browser/chromeos/browser_notification_observers.cc b/chrome/browser/chromeos/browser_notification_observers.cc
index 366e6543a6f1d4858ad98e47f808737198c65b46..f63ade1910dbc05aa1d5e2fd27e3875992d2b470 100644
--- a/chrome/browser/chromeos/browser_notification_observers.cc
+++ b/chrome/browser/chromeos/browser_notification_observers.cc
@@ -8,23 +8,10 @@
#include "base/file_util.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/chromeos/boot_times_loader.h"
#include "chrome/browser/chromeos/login/authentication_notification_details.h"
#include "chrome/common/notification_service.h"
-namespace {
-
-// Static function that records uptime in /proc/uptime to tmp for metrics use.
-void RecordUptime(const std::string& filename) {
- std::string uptime;
- const FilePath proc_uptime = FilePath("/proc/uptime");
- const FilePath uptime_output = FilePath(filename);
-
- if (file_util::ReadFileToString(proc_uptime, &uptime))
- file_util::WriteFile(uptime_output, uptime.data(), uptime.size());
-}
-
-} // namespace
-
namespace chromeos {
InitialTabNotificationObserver::InitialTabNotificationObserver() {
@@ -40,13 +27,9 @@ void InitialTabNotificationObserver::Observe(
const NotificationSource& source,
const NotificationDetails& details) {
// Only log for first tab to render. Make sure this is only done once.
- if (type == NotificationType::LOAD_START &&
- num_tabs_.GetNext() == 0) {
+ if (type == NotificationType::LOAD_START && num_tabs_.GetNext() == 0) {
// If we can't post it, it doesn't matter.
- ChromeThread::PostTask(
- ChromeThread::FILE, FROM_HERE,
- NewRunnableFunction(RecordUptime,
- std::string("/tmp/uptime-chrome-first-render")));
+ BootTimesLoader::RecordCurrentStats("chrome-first-render");
registrar_.Remove(this, NotificationType::LOAD_START,
NotificationService::AllSources());
}
@@ -67,9 +50,7 @@ void LogLoginSuccessObserver::Observe(NotificationType type,
Details<AuthenticationNotificationDetails> auth_details(details);
if (auth_details->success()) {
// If we can't post it, it doesn't matter.
- ChromeThread::PostTask(ChromeThread::FILE, FROM_HERE,
- NewRunnableFunction(RecordUptime,
- std::string("/tmp/uptime-login-successful")));
+ BootTimesLoader::RecordCurrentStats("login-successful");
registrar_.Remove(this, NotificationType::LOGIN_AUTHENTICATION,
NotificationService::AllSources());
}
« no previous file with comments | « chrome/browser/chromeos/boot_times_loader.cc ('k') | chrome/browser/chromeos/login/background_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698