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

Side by Side Diff: chrome/browser/metrics/chrome_stability_metrics_provider.cc

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "base/metrics/sparse_histogram.h" 11 #include "base/metrics/sparse_histogram.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "content/public/browser/child_process_data.h" 14 #include "content/public/browser/child_process_data.h"
15 #include "content/public/browser/notification_service.h" 15 #include "content/public/browser/notification_service.h"
16 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
17 #include "extensions/features/features.h"
17 18
18 #if defined(ENABLE_EXTENSIONS) 19 #if BUILDFLAG(ENABLE_EXTENSIONS)
19 #include "extensions/browser/process_map.h" 20 #include "extensions/browser/process_map.h"
20 #endif 21 #endif
21 22
22 #if defined(ENABLE_PLUGINS) 23 #if defined(ENABLE_PLUGINS)
23 #include "chrome/browser/metrics/plugin_metrics_provider.h" 24 #include "chrome/browser/metrics/plugin_metrics_provider.h"
24 #endif 25 #endif
25 26
26 #if defined(OS_WIN) 27 #if defined(OS_WIN)
27 #include <windows.h> // Needed for STATUS_* codes 28 #include <windows.h> // Needed for STATUS_* codes
28 #include "chrome/common/metrics_constants_util_win.h" 29 #include "chrome/common/metrics_constants_util_win.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 case content::NOTIFICATION_LOAD_START: { 75 case content::NOTIFICATION_LOAD_START: {
75 helper_.LogLoadStarted(); 76 helper_.LogLoadStarted();
76 break; 77 break;
77 } 78 }
78 79
79 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { 80 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: {
80 content::RenderProcessHost::RendererClosedDetails* process_details = 81 content::RenderProcessHost::RendererClosedDetails* process_details =
81 content::Details<content::RenderProcessHost::RendererClosedDetails>( 82 content::Details<content::RenderProcessHost::RendererClosedDetails>(
82 details).ptr(); 83 details).ptr();
83 bool was_extension_process = false; 84 bool was_extension_process = false;
84 #if defined(ENABLE_EXTENSIONS) 85 #if BUILDFLAG(ENABLE_EXTENSIONS)
85 content::RenderProcessHost* host = 86 content::RenderProcessHost* host =
86 content::Source<content::RenderProcessHost>(source).ptr(); 87 content::Source<content::RenderProcessHost>(source).ptr();
87 if (extensions::ProcessMap::Get(host->GetBrowserContext()) 88 if (extensions::ProcessMap::Get(host->GetBrowserContext())
88 ->Contains(host->GetID())) { 89 ->Contains(host->GetID())) {
89 was_extension_process = true; 90 was_extension_process = true;
90 } 91 }
91 #endif 92 #endif
92 helper_.LogRendererCrash(was_extension_process, process_details->status, 93 helper_.LogRendererCrash(was_extension_process, process_details->status,
93 process_details->exit_code); 94 process_details->exit_code);
94 break; 95 break;
95 } 96 }
96 97
97 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: 98 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG:
98 helper_.LogRendererHang(); 99 helper_.LogRendererHang();
99 break; 100 break;
100 101
101 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { 102 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: {
102 bool was_extension_process = false; 103 bool was_extension_process = false;
103 #if defined(ENABLE_EXTENSIONS) 104 #if BUILDFLAG(ENABLE_EXTENSIONS)
104 content::RenderProcessHost* host = 105 content::RenderProcessHost* host =
105 content::Source<content::RenderProcessHost>(source).ptr(); 106 content::Source<content::RenderProcessHost>(source).ptr();
106 if (extensions::ProcessMap::Get(host->GetBrowserContext()) 107 if (extensions::ProcessMap::Get(host->GetBrowserContext())
107 ->Contains(host->GetID())) { 108 ->Contains(host->GetID())) {
108 was_extension_process = true; 109 was_extension_process = true;
109 } 110 }
110 #endif 111 #endif
111 helper_.LogRendererLaunched(was_extension_process); 112 helper_.LogRendererLaunched(was_extension_process);
112 break; 113 break;
113 } 114 }
114 115
115 default: 116 default:
116 NOTREACHED(); 117 NOTREACHED();
117 break; 118 break;
118 } 119 }
119 } 120 }
120 121
121 void ChromeStabilityMetricsProvider::BrowserChildProcessCrashed( 122 void ChromeStabilityMetricsProvider::BrowserChildProcessCrashed(
122 const content::ChildProcessData& data, 123 const content::ChildProcessData& data,
123 int exit_code) { 124 int exit_code) {
124 #if defined(ENABLE_PLUGINS) 125 #if defined(ENABLE_PLUGINS)
125 // Exclude plugin crashes from the count below because we report them via 126 // Exclude plugin crashes from the count below because we report them via
126 // a separate UMA metric. 127 // a separate UMA metric.
127 if (PluginMetricsProvider::IsPluginProcess(data.process_type)) 128 if (PluginMetricsProvider::IsPluginProcess(data.process_type))
128 return; 129 return;
129 #endif 130 #endif
130 131
131 helper_.BrowserChildProcessCrashed(); 132 helper_.BrowserChildProcessCrashed();
132 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698