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

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

Issue 8515027: Define the public version of the browser side RenderProcessHost interface. This interface is not ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 //------------------------------------------------------------------------------ 5 //------------------------------------------------------------------------------
6 // Description of the life cycle of a instance of MetricsService. 6 // Description of the life cycle of a instance of MetricsService.
7 // 7 //
8 // OVERVIEW 8 // OVERVIEW
9 // 9 //
10 // A MetricsService instance is typically created at application startup. It 10 // A MetricsService instance is typically created at application startup. It
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 #include "chrome/browser/ui/browser_list.h" 171 #include "chrome/browser/ui/browser_list.h"
172 #include "chrome/common/child_process_logging.h" 172 #include "chrome/common/child_process_logging.h"
173 #include "chrome/common/chrome_notification_types.h" 173 #include "chrome/common/chrome_notification_types.h"
174 #include "chrome/common/chrome_switches.h" 174 #include "chrome/common/chrome_switches.h"
175 #include "chrome/common/guid.h" 175 #include "chrome/common/guid.h"
176 #include "chrome/common/metrics_log_manager.h" 176 #include "chrome/common/metrics_log_manager.h"
177 #include "chrome/common/pref_names.h" 177 #include "chrome/common/pref_names.h"
178 #include "chrome/common/render_messages.h" 178 #include "chrome/common/render_messages.h"
179 #include "content/browser/load_notification_details.h" 179 #include "content/browser/load_notification_details.h"
180 #include "content/browser/plugin_service.h" 180 #include "content/browser/plugin_service.h"
181 #include "content/browser/renderer_host/render_process_host.h"
182 #include "content/public/browser/notification_service.h" 181 #include "content/public/browser/notification_service.h"
182 #include "content/public/browser/render_process_host.h"
183 #include "content/public/common/url_fetcher.h" 183 #include "content/public/common/url_fetcher.h"
184 #include "webkit/plugins/webplugininfo.h" 184 #include "webkit/plugins/webplugininfo.h"
185 185
186 // TODO(port): port browser_distribution.h. 186 // TODO(port): port browser_distribution.h.
187 #if !defined(OS_POSIX) 187 #if !defined(OS_POSIX)
188 #include "chrome/installer/util/browser_distribution.h" 188 #include "chrome/installer/util/browser_distribution.h"
189 #endif 189 #endif
190 190
191 #if defined(OS_CHROMEOS) 191 #if defined(OS_CHROMEOS)
192 #include "chrome/browser/chromeos/cros/cros_library.h" 192 #include "chrome/browser/chromeos/cros/cros_library.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 518
519 case content::NOTIFICATION_LOAD_STOP: 519 case content::NOTIFICATION_LOAD_STOP:
520 LogLoadComplete(type, source, details); 520 LogLoadComplete(type, source, details);
521 break; 521 break;
522 522
523 case content::NOTIFICATION_LOAD_START: 523 case content::NOTIFICATION_LOAD_START:
524 LogLoadStarted(); 524 LogLoadStarted();
525 break; 525 break;
526 526
527 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { 527 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: {
528 RenderProcessHost::RendererClosedDetails* process_details = 528 content::RenderProcessHost::RendererClosedDetails* process_details =
529 content::Details<RenderProcessHost::RendererClosedDetails>( 529 content::Details<
530 details).ptr(); 530 content::RenderProcessHost::RendererClosedDetails>(
531 RenderProcessHost* host = 531 details).ptr();
532 content::Source<RenderProcessHost>(source).ptr(); 532 content::RenderProcessHost* host =
533 content::Source<content::RenderProcessHost>(source).ptr();
533 LogRendererCrash( 534 LogRendererCrash(
534 host, process_details->status, process_details->was_alive); 535 host, process_details->status, process_details->was_alive);
535 } 536 }
536 break; 537 break;
537 538
538 case content::NOTIFICATION_RENDERER_PROCESS_HANG: 539 case content::NOTIFICATION_RENDERER_PROCESS_HANG:
539 LogRendererHang(); 540 LogRendererHang();
540 break; 541 break;
541 542
542 case content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED: 543 case content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED:
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 DCHECK(!waiting_for_asynchronus_reporting_step_); 874 DCHECK(!waiting_for_asynchronus_reporting_step_);
874 waiting_for_asynchronus_reporting_step_ = true; 875 waiting_for_asynchronus_reporting_step_ = true;
875 876
876 Task* task = log_sender_factory_. 877 Task* task = log_sender_factory_.
877 NewRunnableMethod(&MetricsService::OnMemoryDetailCollectionDone); 878 NewRunnableMethod(&MetricsService::OnMemoryDetailCollectionDone);
878 879
879 scoped_refptr<MetricsMemoryDetails> details(new MetricsMemoryDetails(task)); 880 scoped_refptr<MetricsMemoryDetails> details(new MetricsMemoryDetails(task));
880 details->StartFetch(); 881 details->StartFetch();
881 882
882 // Collect WebCore cache information to put into a histogram. 883 // Collect WebCore cache information to put into a histogram.
883 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); 884 for (content::RenderProcessHost::iterator i(
885 content::RenderProcessHost::AllHostsIterator());
884 !i.IsAtEnd(); i.Advance()) 886 !i.IsAtEnd(); i.Advance())
885 i.GetCurrentValue()->Send(new ChromeViewMsg_GetCacheResourceStats()); 887 i.GetCurrentValue()->Send(new ChromeViewMsg_GetCacheResourceStats());
886 } 888 }
887 889
888 void MetricsService::OnMemoryDetailCollectionDone() { 890 void MetricsService::OnMemoryDetailCollectionDone() {
889 DCHECK(IsSingleThreaded()); 891 DCHECK(IsSingleThreaded());
890 // This function should only be called as the callback from an ansynchronous 892 // This function should only be called as the callback from an ansynchronous
891 // step. 893 // step.
892 DCHECK(waiting_for_asynchronus_reporting_step_); 894 DCHECK(waiting_for_asynchronus_reporting_step_);
893 895
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 } 1234 }
1233 1235
1234 void MetricsService::LogLoadStarted() { 1236 void MetricsService::LogLoadStarted() {
1235 HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2); 1237 HISTOGRAM_ENUMERATION("Chrome.UmaPageloadCounter", 1, 2);
1236 IncrementPrefValue(prefs::kStabilityPageLoadCount); 1238 IncrementPrefValue(prefs::kStabilityPageLoadCount);
1237 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount); 1239 IncrementLongPrefsValue(prefs::kUninstallMetricsPageLoadCount);
1238 // We need to save the prefs, as page load count is a critical stat, and it 1240 // We need to save the prefs, as page load count is a critical stat, and it
1239 // might be lost due to a crash :-(. 1241 // might be lost due to a crash :-(.
1240 } 1242 }
1241 1243
1242 void MetricsService::LogRendererCrash(RenderProcessHost* host, 1244 void MetricsService::LogRendererCrash(content::RenderProcessHost* host,
1243 base::TerminationStatus status, 1245 base::TerminationStatus status,
1244 bool was_alive) { 1246 bool was_alive) {
1245 Profile* profile = Profile::FromBrowserContext(host->browser_context()); 1247 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
1246 ExtensionService* service = profile->GetExtensionService(); 1248 ExtensionService* service = profile->GetExtensionService();
1247 bool was_extension_process = 1249 bool was_extension_process =
1248 service && service->process_map()->Contains(host->id()); 1250 service && service->process_map()->Contains(host->GetID());
1249 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED || 1251 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED ||
1250 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { 1252 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) {
1251 if (was_extension_process) 1253 if (was_extension_process)
1252 IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount); 1254 IncrementPrefValue(prefs::kStabilityExtensionRendererCrashCount);
1253 else 1255 else
1254 IncrementPrefValue(prefs::kStabilityRendererCrashCount); 1256 IncrementPrefValue(prefs::kStabilityRendererCrashCount);
1255 1257
1256 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes", 1258 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes",
1257 was_extension_process ? 2 : 1); 1259 was_extension_process ? 2 : 1);
1258 if (was_alive) { 1260 if (was_alive) {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 if (local_state) { 1547 if (local_state) {
1546 const PrefService::Preference* uma_pref = 1548 const PrefService::Preference* uma_pref =
1547 local_state->FindPreference(prefs::kMetricsReportingEnabled); 1549 local_state->FindPreference(prefs::kMetricsReportingEnabled);
1548 if (uma_pref) { 1550 if (uma_pref) {
1549 bool success = uma_pref->GetValue()->GetAsBoolean(&result); 1551 bool success = uma_pref->GetValue()->GetAsBoolean(&result);
1550 DCHECK(success); 1552 DCHECK(success);
1551 } 1553 }
1552 } 1554 }
1553 return result; 1555 return result;
1554 } 1556 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | chrome/browser/metrics/tracking_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698