Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_H_ | 5 #ifndef CHROME_BROWSER_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_H_ |
| 6 #define CHROME_BROWSER_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_H_ | 6 #define CHROME_BROWSER_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/timer.h" | 14 #include "base/timer.h" |
| 15 #include "chrome/browser/performance_monitor/database.h" | 15 #include "chrome/browser/performance_monitor/database.h" |
| 16 #include "chrome/browser/performance_monitor/event.h" | 16 #include "chrome/browser/performance_monitor/event.h" |
| 17 #include "content/public/browser/notification_details.h" | 17 #include "content/public/browser/notification_details.h" |
| 18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
| 20 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
| 21 #include "content/public/browser/render_process_host.h" | |
| 22 | |
| 23 namespace extensions { | |
| 24 class Extension; | |
| 25 } | |
| 21 | 26 |
| 22 namespace performance_monitor { | 27 namespace performance_monitor { |
| 23 class Database; | 28 class Database; |
| 24 | 29 |
| 25 class PerformanceMonitor : public content::NotificationObserver { | 30 class PerformanceMonitor : public content::NotificationObserver { |
| 26 public: | 31 public: |
| 27 typedef base::Callback<void(const std::string&)> StateValueCallback; | 32 typedef base::Callback<void(const std::string&)> StateValueCallback; |
| 28 | 33 |
| 29 // Set the path which the PerformanceMonitor should use for the database files | 34 // Set the path which the PerformanceMonitor should use for the database files |
| 30 // constructed. This must be done prior to the initialization of the | 35 // constructed. This must be done prior to the initialization of the |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 | 105 |
| 101 // Update the database record of the last time the active profiles were | 106 // Update the database record of the last time the active profiles were |
| 102 // running; this is used in determining when an unclean exit occurred. | 107 // running; this is used in determining when an unclean exit occurred. |
| 103 void UpdateLiveProfiles(); | 108 void UpdateLiveProfiles(); |
| 104 void UpdateLiveProfilesHelper( | 109 void UpdateLiveProfilesHelper( |
| 105 scoped_ptr<std::set<std::string> > active_profiles, std::string time); | 110 scoped_ptr<std::set<std::string> > active_profiles, std::string time); |
| 106 | 111 |
| 107 // Perform any collections that are done on a timed basis. | 112 // Perform any collections that are done on a timed basis. |
| 108 void DoTimedCollections(); | 113 void DoTimedCollections(); |
| 109 | 114 |
| 115 // Generate an appropriate ExtensionEvent for an extension-related occurrance | |
| 116 // and insert it in the database. | |
| 117 void HandleExtensionEvent(EventType type, | |
|
Yoyo Zhou
2012/08/02 08:39:01
Why "Handle" and not "Add" for these names?
| |
| 118 const extensions::Extension* extension); | |
| 119 | |
| 120 // Generate an appropriate CrashEvent for a renderer crash and insert it in | |
| 121 // the database. | |
| 122 void HandleCrashEvent( | |
| 123 const content::RenderProcessHost::RendererClosedDetails& details); | |
| 124 | |
| 110 // The location at which the database files are stored; if empty, the database | 125 // The location at which the database files are stored; if empty, the database |
| 111 // will default to '<user_data_dir>/performance_monitor_dbs'. | 126 // will default to '<user_data_dir>/performance_monitor_dbs'. |
| 112 FilePath database_path_; | 127 FilePath database_path_; |
| 113 | 128 |
| 114 scoped_ptr<Database> database_; | 129 scoped_ptr<Database> database_; |
| 115 | 130 |
| 116 // The timer to signal PerformanceMonitor to perform its timed collections. | 131 // The timer to signal PerformanceMonitor to perform its timed collections. |
| 117 base::RepeatingTimer<PerformanceMonitor> timer_; | 132 base::RepeatingTimer<PerformanceMonitor> timer_; |
| 118 | 133 |
| 119 content::NotificationRegistrar registrar_; | 134 content::NotificationRegistrar registrar_; |
| 120 | 135 |
| 121 DISALLOW_COPY_AND_ASSIGN(PerformanceMonitor); | 136 DISALLOW_COPY_AND_ASSIGN(PerformanceMonitor); |
| 122 }; | 137 }; |
| 123 | 138 |
| 124 } // namespace performance_monitor | 139 } // namespace performance_monitor |
| 125 | 140 |
| 126 #endif // CHROME_BROWSER_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_H_ | 141 #endif // CHROME_BROWSER_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_H_ |
| OLD | NEW |