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

Unified Diff: chrome/browser/metrics/chrome_stability_metrics_provider.cc

Issue 299153004: Move child process observing from MetricsService to stability provider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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/metrics/chrome_stability_metrics_provider.cc
===================================================================
--- chrome/browser/metrics/chrome_stability_metrics_provider.cc (revision 272600)
+++ chrome/browser/metrics/chrome_stability_metrics_provider.cc (working copy)
@@ -9,17 +9,23 @@
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
+#include "base/prefs/pref_registry_simple.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
#include "components/metrics/proto/system_profile.pb.h"
+#include "content/public/browser/child_process_data.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/process_map.h"
+#if defined(ENABLE_PLUGINS)
+#include "chrome/browser/metrics/plugin_metrics_provider.h"
+#endif
+
#if defined(OS_WIN)
#include <windows.h> // Needed for STATUS_* codes
#endif
@@ -57,9 +63,11 @@
} // namespace
ChromeStabilityMetricsProvider::ChromeStabilityMetricsProvider() {
+ BrowserChildProcessObserver::Add(this);
}
ChromeStabilityMetricsProvider::~ChromeStabilityMetricsProvider() {
+ BrowserChildProcessObserver::Remove(this);
}
void ChromeStabilityMetricsProvider::OnRecordingEnabled() {
@@ -109,6 +117,18 @@
}
}
+// static
+void ChromeStabilityMetricsProvider::RegisterPrefs(
+ PrefRegistrySimple* registry) {
+ registry->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityExtensionRendererCrashCount,
+ 0);
+ registry->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0);
+ registry->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0);
+ registry->RegisterInt64Pref(prefs::kUninstallMetricsPageLoadCount, 0);
+}
+
void ChromeStabilityMetricsProvider::Observe(
int type,
const content::NotificationSource& source,
@@ -143,6 +163,18 @@
}
}
+void ChromeStabilityMetricsProvider::BrowserChildProcessCrashed(
+ const content::ChildProcessData& data) {
+#if defined(ENABLE_PLUGINS)
+ // Exclude plugin crashes from the count below because we report them via
+ // a separate UMA metric.
+ if (PluginMetricsProvider::IsPluginProcess(data.process_type))
+ return;
+#endif
+
+ IncrementPrefValue(prefs::kStabilityChildProcessCrashCount);
+}
+
void ChromeStabilityMetricsProvider::LogLoadStarted(
content::WebContents* web_contents) {
content::RecordAction(base::UserMetricsAction("PageLoad"));
« no previous file with comments | « chrome/browser/metrics/chrome_stability_metrics_provider.h ('k') | chrome/browser/metrics/metrics_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698