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); |
}; |