| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" | 5 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 void ChromeStabilityMetricsProvider::OnRecordingEnabled() { | 41 void ChromeStabilityMetricsProvider::OnRecordingEnabled() { |
| 42 registrar_.Add(this, | 42 registrar_.Add(this, |
| 43 content::NOTIFICATION_LOAD_START, | 43 content::NOTIFICATION_LOAD_START, |
| 44 content::NotificationService::AllSources()); | 44 content::NotificationService::AllSources()); |
| 45 registrar_.Add(this, | 45 registrar_.Add(this, |
| 46 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 46 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 47 content::NotificationService::AllSources()); | 47 content::NotificationService::AllSources()); |
| 48 registrar_.Add(this, | 48 registrar_.Add(this, |
| 49 content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, | 49 content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, |
| 50 content::NotificationService::AllSources()); | 50 content::NotificationService::AllSources()); |
| 51 registrar_.Add(this, |
| 52 content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
| 53 content::NotificationService::AllSources()); |
| 51 } | 54 } |
| 52 | 55 |
| 53 void ChromeStabilityMetricsProvider::OnRecordingDisabled() { | 56 void ChromeStabilityMetricsProvider::OnRecordingDisabled() { |
| 54 registrar_.RemoveAll(); | 57 registrar_.RemoveAll(); |
| 55 } | 58 } |
| 56 | 59 |
| 57 void ChromeStabilityMetricsProvider::ProvideStabilityMetrics( | 60 void ChromeStabilityMetricsProvider::ProvideStabilityMetrics( |
| 58 metrics::SystemProfileProto* system_profile_proto) { | 61 metrics::SystemProfileProto* system_profile_proto) { |
| 59 helper_.ProvideStabilityMetrics(system_profile_proto); | 62 helper_.ProvideStabilityMetrics(system_profile_proto); |
| 60 } | 63 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 88 #endif | 91 #endif |
| 89 helper_.LogRendererCrash(was_extension_process, process_details->status, | 92 helper_.LogRendererCrash(was_extension_process, process_details->status, |
| 90 process_details->exit_code); | 93 process_details->exit_code); |
| 91 break; | 94 break; |
| 92 } | 95 } |
| 93 | 96 |
| 94 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: | 97 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: |
| 95 helper_.LogRendererHang(); | 98 helper_.LogRendererHang(); |
| 96 break; | 99 break; |
| 97 | 100 |
| 101 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { |
| 102 bool was_extension_process = false; |
| 103 #if defined(ENABLE_EXTENSIONS) |
| 104 content::RenderProcessHost* host = |
| 105 content::Source<content::RenderProcessHost>(source).ptr(); |
| 106 if (extensions::ProcessMap::Get(host->GetBrowserContext()) |
| 107 ->Contains(host->GetID())) { |
| 108 was_extension_process = true; |
| 109 } |
| 110 #endif |
| 111 helper_.LogRendererLaunched(was_extension_process); |
| 112 break; |
| 113 } |
| 114 |
| 98 default: | 115 default: |
| 99 NOTREACHED(); | 116 NOTREACHED(); |
| 100 break; | 117 break; |
| 101 } | 118 } |
| 102 } | 119 } |
| 103 | 120 |
| 104 void ChromeStabilityMetricsProvider::BrowserChildProcessCrashed( | 121 void ChromeStabilityMetricsProvider::BrowserChildProcessCrashed( |
| 105 const content::ChildProcessData& data, | 122 const content::ChildProcessData& data, |
| 106 int exit_code) { | 123 int exit_code) { |
| 107 #if defined(ENABLE_PLUGINS) | 124 #if defined(ENABLE_PLUGINS) |
| 108 // Exclude plugin crashes from the count below because we report them via | 125 // Exclude plugin crashes from the count below because we report them via |
| 109 // a separate UMA metric. | 126 // a separate UMA metric. |
| 110 if (PluginMetricsProvider::IsPluginProcess(data.process_type)) | 127 if (PluginMetricsProvider::IsPluginProcess(data.process_type)) |
| 111 return; | 128 return; |
| 112 #endif | 129 #endif |
| 113 | 130 |
| 114 helper_.BrowserChildProcessCrashed(); | 131 helper_.BrowserChildProcessCrashed(); |
| 115 } | 132 } |
| OLD | NEW |