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

Unified Diff: chrome/browser/chromeos/boot_times_loader.h

Issue 303233004: Write "logout-started" event on next boot. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 6 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
Index: chrome/browser/chromeos/boot_times_loader.h
diff --git a/chrome/browser/chromeos/boot_times_loader.h b/chrome/browser/chromeos/boot_times_loader.h
index 854dccdabee2898f80009517cdd8fca85ef657b2..81e4776e3d1e52b60d8e196132743a253be2ed2c 100644
--- a/chrome/browser/chromeos/boot_times_loader.h
+++ b/chrome/browser/chromeos/boot_times_loader.h
@@ -17,6 +17,8 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/render_widget_host.h"
+class PrefService;
+
namespace chromeos {
// BootTimesLoader loads the bootimes of Chrome OS from the file system.
@@ -82,6 +84,12 @@ class BootTimesLoader : public content::NotificationObserver {
// Mark that WriteLogoutTimes should handle restart.
void set_restart_requested() { restart_requested_ = true; }
+ // This is called on Chrome process startup to write saved logout stats.
+ void OnBoot();
stevenjb 2014/05/30 16:20:23 "Boot" is rather unspecific, could you give this a
Alexander Alekseev 2014/05/30 21:12:45 There are many different OnProfileCreated events.
+
+ // This saves logout-started metric to Local State.
+ void OnLogoutStarted(PrefService* state);
+
private:
// BootTimesLoader calls into the Backend on the file thread to load
// the boot times.
@@ -121,19 +129,30 @@ class BootTimesLoader : public content::NotificationObserver {
struct Stats {
public:
+ std::string SerializeToString() const;
+ static Stats DeserializeFromString(const std::string& value);
+
std::string uptime;
std::string disk;
};
static void RecordStats(
const std::string& name, const Stats& stats);
+ void RecordStatsWithCallback(const std::string& name,
+ const Stats& stats,
+ const base::Closure& callback);
static Stats GetCurrentStats();
+ static std::string GetUptimeSeconds(const Stats& stats);
static void WriteTimes(const std::string base_name,
const std::string uma_name,
const std::string uma_prefix,
std::vector<TimeMarker> login_times);
static void AddMarker(std::vector<TimeMarker>* vector, TimeMarker marker);
+ // Clear saved logout-started metric in Local State.
+ // This method is called when logout-state was writen to file.
+ static void ClearLogoutStartedLastPreference();
+
// Used to hold the stats at main().
Stats chrome_main_stats_;
scoped_refptr<Backend> backend_;
« no previous file with comments | « no previous file | chrome/browser/chromeos/boot_times_loader.cc » ('j') | chrome/browser/chromeos/boot_times_loader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698