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

Unified Diff: chrome/browser/performance_monitor/performance_monitor.h

Issue 10703078: Add Unclean Exit Watching to CPM (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_crash_event_watching
Patch Set: Requested changes made Created 8 years, 5 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/performance_monitor/performance_monitor.h
diff --git a/chrome/browser/performance_monitor/performance_monitor.h b/chrome/browser/performance_monitor/performance_monitor.h
index 3a900813981989c2b9ab352d7c0db51ab2c35d96..608acf015c7973b90f1f1f51ee39f074ab908fe8 100644
--- a/chrome/browser/performance_monitor/performance_monitor.h
+++ b/chrome/browser/performance_monitor/performance_monitor.h
@@ -10,6 +10,7 @@
#include "base/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
+#include "base/timer.h"
#include "chrome/browser/performance_monitor/database.h"
#include "chrome/browser/performance_monitor/event.h"
#include "content/public/browser/notification_details.h"
@@ -55,6 +56,10 @@ class PerformanceMonitor : public content::NotificationObserver {
private:
friend struct DefaultSingletonTraits<PerformanceMonitor>;
+ FRIEND_TEST_ALL_PREFIXES(PerformanceMonitorUncleanExitBrowserTest,
+ OneProfileUncleanExit);
+ FRIEND_TEST_ALL_PREFIXES(PerformanceMonitorUncleanExitBrowserTest,
+ TwoProfileUncleanExit);
PerformanceMonitor();
virtual ~PerformanceMonitor();
@@ -68,6 +73,15 @@ class PerformanceMonitor : public content::NotificationObserver {
// Register for the appropriate notifications as a NotificationObserver.
void RegisterForNotifications();
+ // Checks for whether the previous profiles closed uncleanly; this method
+ // should only be called once per run in order to avoid duplication of events
+ // (exceptions made for testing purposes where we construct the environment).
+ void CheckForUncleanExits();
+
+ // Find the last active time for the profile and insert the event into the
+ // database.
+ void AddUncleanExitEvent(std::string profile_name);
Yoyo Zhou 2012/07/12 18:13:44 Just noticed this one should also be a const std::
+
// Gets the corresponding value of |key| from the database, and then runs
// |callback| with that value as a parameter.
void GetStateValueOnBackgroundThread(
@@ -81,6 +95,15 @@ class PerformanceMonitor : public content::NotificationObserver {
void AddEventOnBackgroundThread(scoped_ptr<Event> event);
+ // Update the database record of the last time the active profiles were
+ // running; this is used in determining when an unclean exit occurred.
+ void UpdateLiveProfiles();
+ void UpdateLiveProfilesHelper(
+ scoped_ptr<std::set<std::string> > active_profiles, std::string time);
+
+ // Perform any collections that are done on a timed basis.
+ void DoTimedCollections();
+
// The location at which the database files are stored; if empty, the database
// will default to '<user_data_dir>/performance_monitor_dbs'.
FilePath database_path_;
@@ -89,6 +112,8 @@ class PerformanceMonitor : public content::NotificationObserver {
content::NotificationRegistrar registrar_;
+ base::RepeatingTimer<PerformanceMonitor> timer_;
+
DISALLOW_COPY_AND_ASSIGN(PerformanceMonitor);
};
« no previous file with comments | « chrome/browser/performance_monitor/events.json ('k') | chrome/browser/performance_monitor/performance_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698