| Index: chrome/browser/metrics/metrics_service.cc
|
| diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
|
| index 8d40156120dbe823759a3e26846e5a8c8d6d6c51..22552449352cf78d06773ab4c582ecac7246d002 100644
|
| --- a/chrome/browser/metrics/metrics_service.cc
|
| +++ b/chrome/browser/metrics/metrics_service.cc
|
| @@ -185,6 +185,7 @@
|
| #include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/io_thread.h"
|
| #include "chrome/browser/memory_details.h"
|
| +#include "chrome/browser/metrics/chrome_stability_metrics_provider.h"
|
| #include "chrome/browser/metrics/compression_utils.h"
|
| #include "chrome/browser/metrics/metrics_log.h"
|
| #include "chrome/browser/metrics/metrics_state_manager.h"
|
| @@ -216,7 +217,6 @@
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/common/process_type.h"
|
| #include "content/public/common/webplugininfo.h"
|
| -#include "extensions/browser/process_map.h"
|
| #include "net/base/load_flags.h"
|
| #include "net/url_request/url_fetcher.h"
|
|
|
| @@ -305,20 +305,6 @@ ResponseStatus ResponseCodeToStatus(int response_code) {
|
| }
|
| }
|
|
|
| -// Converts an exit code into something that can be inserted into our
|
| -// histograms (which expect non-negative numbers less than MAX_INT).
|
| -int MapCrashExitCodeForHistogram(int exit_code) {
|
| -#if defined(OS_WIN)
|
| - // Since |abs(STATUS_GUARD_PAGE_VIOLATION) == MAX_INT| it causes problems in
|
| - // histograms.cc. Solve this by remapping it to a smaller value, which
|
| - // hopefully doesn't conflict with other codes.
|
| - if (exit_code == STATUS_GUARD_PAGE_VIOLATION)
|
| - return 0x1FCF7EC3; // Randomly picked number.
|
| -#endif
|
| -
|
| - return std::abs(exit_code);
|
| -}
|
| -
|
| void MarkAppCleanShutdownAndCommit() {
|
| PrefService* pref = g_browser_process->local_state();
|
| pref->SetBoolean(prefs::kStabilityExitedCleanly, true);
|
| @@ -483,6 +469,8 @@ MetricsService::MetricsService(metrics::MetricsStateManager* state_manager,
|
| // TODO(asvitkine): Move this out of MetricsService.
|
| RegisterMetricsProvider(
|
| scoped_ptr<metrics::MetricsProvider>(new OmniboxMetricsProvider));
|
| + RegisterMetricsProvider(
|
| + scoped_ptr<metrics::MetricsProvider>(new ChromeStabilityMetricsProvider));
|
|
|
| BrowserChildProcessObserver::Add(this);
|
| }
|
| @@ -652,34 +640,12 @@ void MetricsService::Observe(int type,
|
| case chrome::NOTIFICATION_OMNIBOX_OPENED_URL:
|
| case chrome::NOTIFICATION_TAB_PARENTED:
|
| case chrome::NOTIFICATION_TAB_CLOSING:
|
| + case content::NOTIFICATION_LOAD_START:
|
| case content::NOTIFICATION_LOAD_STOP:
|
| - // These notifications are used only to break out of idle mode.
|
| - break;
|
| -
|
| - case content::NOTIFICATION_LOAD_START: {
|
| - content::NavigationController* controller =
|
| - content::Source<content::NavigationController>(source).ptr();
|
| - content::WebContents* web_contents = controller->GetWebContents();
|
| - LogLoadStarted(web_contents);
|
| - break;
|
| - }
|
| -
|
| - case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: {
|
| - content::RenderProcessHost::RendererClosedDetails* process_details =
|
| - content::Details<
|
| - content::RenderProcessHost::RendererClosedDetails>(
|
| - details).ptr();
|
| - content::RenderProcessHost* host =
|
| - content::Source<content::RenderProcessHost>(source).ptr();
|
| - LogRendererCrash(
|
| - host, process_details->status, process_details->exit_code);
|
| - break;
|
| - }
|
| -
|
| + case content::NOTIFICATION_RENDERER_PROCESS_CLOSED:
|
| case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG:
|
| - LogRendererHang();
|
| + // These notifications are used only to break out of idle mode.
|
| break;
|
| -
|
| default:
|
| NOTREACHED();
|
| break;
|
| @@ -1665,50 +1631,6 @@ void MetricsService::IncrementLongPrefsValue(const char* path) {
|
| pref->SetInt64(path, value + 1);
|
| }
|
|
|
| -void MetricsService::LogLoadStarted(content::WebContents* web_contents) {
|
| - content::RecordAction(base::UserMetricsAction("PageLoad"));
|
| - HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2);
|
| - IncrementPrefValue(prefs::kStabilityPageLoadCount);
|
| - IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount);
|
| - // We need to save the prefs, as page load count is a critical stat, and it
|
| - // might be lost due to a crash :-(.
|
| -}
|
| -
|
| -void MetricsService::LogRendererCrash(content::RenderProcessHost* host,
|
| - base::TerminationStatus status,
|
| - int exit_code) {
|
| - bool was_extension_process =
|
| - extensions::ProcessMap::Get(host->GetBrowserContext())
|
| - ->Contains(host->GetID());
|
| - if (status == base::TERMINATION_STATUS_PROCESS_CRASHED ||
|
| - status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) {
|
| - if (was_extension_process) {
|
| - IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount);
|
| -
|
| - UMA_HISTOGRAM_SPARSE_SLOWLY("CrashExitCodes.Extension",
|
| - MapCrashExitCodeForHistogram(exit_code));
|
| - } else {
|
| - IncrementPrefValue(prefs::kStabilityRendererCrashCount);
|
| -
|
| - UMA_HISTOGRAM_SPARSE_SLOWLY("CrashExitCodes.Renderer",
|
| - MapCrashExitCodeForHistogram(exit_code));
|
| - }
|
| -
|
| - UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes",
|
| - was_extension_process ? 2 : 1);
|
| - } else if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) {
|
| - UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildKills",
|
| - was_extension_process ? 2 : 1);
|
| - } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) {
|
| - UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.DisconnectedAlive",
|
| - was_extension_process ? 2 : 1);
|
| - }
|
| -}
|
| -
|
| -void MetricsService::LogRendererHang() {
|
| - IncrementPrefValue(prefs::kStabilityRendererHangCount);
|
| -}
|
| -
|
| bool MetricsService::UmaMetricsProperlyShutdown() {
|
| CHECK(clean_shutdown_status_ == CLEANLY_SHUTDOWN ||
|
| clean_shutdown_status_ == NEED_TO_SHUTDOWN);
|
|
|