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

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

Issue 289283011: Introduce ChromeStabilityMetricsProvider (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.h
diff --git a/chrome/browser/metrics/chrome_stability_metrics_provider.h b/chrome/browser/metrics/chrome_stability_metrics_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..051d26009d4f59a471c8aa0067511806cb70fbe9
--- /dev/null
+++ b/chrome/browser/metrics/chrome_stability_metrics_provider.h
@@ -0,0 +1,64 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_
+#define CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_
+
+#include "base/basictypes.h"
+#include "base/metrics/user_metrics.h"
+#include "base/process/kill.h"
+#include "components/metrics/metrics_provider.h"
+#include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+
+namespace content {
+class RenderProcessHost;
+class WebContents;
+}
+
+// ChromeStabilityMetricsProvider gathers and logs Chrome-specific stability-
+// related metrics.
+class ChromeStabilityMetricsProvider : public metrics::MetricsProvider,
+ public content::NotificationObserver {
+ public:
+ ChromeStabilityMetricsProvider();
+ virtual ~ChromeStabilityMetricsProvider();
+
+ // metrics::MetricsDataProvider:
+ virtual void OnRecordingEnabled() OVERRIDE;
+ virtual void OnRecordingDisabled() OVERRIDE;
+ virtual void ProvideStabilityMetrics(
+ metrics::SystemProfileProto_Stability* stability_proto) OVERRIDE;
+
+ private:
+ // content::NotificationObserver:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ // Logs the initiation of a page load and uses |web_contents| to do
+ // additional logging of the type of page loaded.
+ void LogLoadStarted(content::WebContents* web_contents);
+
+ // Records a renderer process crash.
+ void LogRendererCrash(content::RenderProcessHost* host,
+ base::TerminationStatus status,
+ int exit_code);
+
+ // Records a renderer process hang.
+ void LogRendererHang();
+
+ // Registrar for receiving stability-related notifications.
+ content::NotificationRegistrar registrar_;
+
+ // TODO(blundell): Is this needed?
Alexei Svitkine (slow) 2014/05/21 15:02:29 I don't think it is in this case.
blundell 2014/05/21 15:14:17 Done.
+ // Saved cache of generated Stability event protos, to be copied into the UMA
+ // proto when ProvideGeneralMetrics() is called.
+ metrics::ChromeUserMetricsExtension omnibox_events_cache;
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeStabilityMetricsProvider);
+};
+
+#endif // CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698