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

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

Issue 658903002: Starting a refactor to allow adding metrics on upload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 6 years, 2 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 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_metrics_service_client.h" 5 #include "chrome/browser/metrics/chrome_metrics_service_client.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 collect_final_metrics_done_callback_ = done_callback; 232 collect_final_metrics_done_callback_ = done_callback;
233 233
234 // Begin the multi-step process of collecting memory usage histograms: 234 // Begin the multi-step process of collecting memory usage histograms:
235 // First spawn a task to collect the memory details; when that task is 235 // First spawn a task to collect the memory details; when that task is
236 // finished, it will call OnMemoryDetailCollectionDone. That will in turn 236 // finished, it will call OnMemoryDetailCollectionDone. That will in turn
237 // call HistogramSynchronization to collect histograms from all renderers and 237 // call HistogramSynchronization to collect histograms from all renderers and
238 // then call OnHistogramSynchronizationDone to continue processing. 238 // then call OnHistogramSynchronizationDone to continue processing.
239 DCHECK(!waiting_for_collect_final_metrics_step_); 239 DCHECK(!waiting_for_collect_final_metrics_step_);
240 waiting_for_collect_final_metrics_step_ = true; 240 waiting_for_collect_final_metrics_step_ = true;
241 241
242 #if !defined(OS_CHROMEOS) && !defined(OS_IOS)
243 // Record the signin status histogram value.
244 signin_status_metrics_provider_->RecordSigninStatusHistogram();
245 #endif
246
247 base::Closure callback = 242 base::Closure callback =
248 base::Bind(&ChromeMetricsServiceClient::OnMemoryDetailCollectionDone, 243 base::Bind(&ChromeMetricsServiceClient::OnMemoryDetailCollectionDone,
249 weak_ptr_factory_.GetWeakPtr()); 244 weak_ptr_factory_.GetWeakPtr());
250 245
251 scoped_refptr<MetricsMemoryDetails> details( 246 scoped_refptr<MetricsMemoryDetails> details(
252 new MetricsMemoryDetails(callback, &memory_growth_tracker_)); 247 new MetricsMemoryDetails(callback, &memory_growth_tracker_));
253 details->StartFetch(MemoryDetails::UPDATE_USER_METRICS); 248 details->StartFetch(MemoryDetails::UPDATE_USER_METRICS);
254 249
255 // Collect WebCore cache information to put into a histogram. 250 // Collect WebCore cache information to put into a histogram.
256 for (content::RenderProcessHost::iterator i( 251 for (content::RenderProcessHost::iterator i(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 327
333 #if defined(OS_CHROMEOS) 328 #if defined(OS_CHROMEOS)
334 ChromeOSMetricsProvider* chromeos_metrics_provider = 329 ChromeOSMetricsProvider* chromeos_metrics_provider =
335 new ChromeOSMetricsProvider; 330 new ChromeOSMetricsProvider;
336 chromeos_metrics_provider_ = chromeos_metrics_provider; 331 chromeos_metrics_provider_ = chromeos_metrics_provider;
337 metrics_service_->RegisterMetricsProvider( 332 metrics_service_->RegisterMetricsProvider(
338 scoped_ptr<metrics::MetricsProvider>(chromeos_metrics_provider)); 333 scoped_ptr<metrics::MetricsProvider>(chromeos_metrics_provider));
339 #endif // defined(OS_CHROMEOS) 334 #endif // defined(OS_CHROMEOS)
340 335
341 #if !defined(OS_CHROMEOS) && !defined(OS_IOS) 336 #if !defined(OS_CHROMEOS) && !defined(OS_IOS)
342 signin_status_metrics_provider_ =
343 SigninStatusMetricsProvider::CreateInstance();
344 metrics_service_->RegisterMetricsProvider( 337 metrics_service_->RegisterMetricsProvider(
345 scoped_ptr<metrics::MetricsProvider>(signin_status_metrics_provider_)); 338 scoped_ptr<metrics::MetricsProvider>(
339 SigninStatusMetricsProvider::CreateInstance()));
346 #endif 340 #endif
347 } 341 }
348 342
349 void ChromeMetricsServiceClient::OnInitTaskGotHardwareClass() { 343 void ChromeMetricsServiceClient::OnInitTaskGotHardwareClass() {
350 const base::Closure got_plugin_info_callback = 344 const base::Closure got_plugin_info_callback =
351 base::Bind(&ChromeMetricsServiceClient::OnInitTaskGotPluginInfo, 345 base::Bind(&ChromeMetricsServiceClient::OnInitTaskGotPluginInfo,
352 weak_ptr_factory_.GetWeakPtr()); 346 weak_ptr_factory_.GetWeakPtr());
353 347
354 #if defined(ENABLE_PLUGINS) 348 #if defined(ENABLE_PLUGINS)
355 plugin_metrics_provider_->GetPluginInformation(got_plugin_info_callback); 349 plugin_metrics_provider_->GetPluginInformation(got_plugin_info_callback);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 // Capture the histogram samples. 547 // Capture the histogram samples.
554 if (dumps_with_crash != 0) 548 if (dumps_with_crash != 0)
555 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); 549 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash);
556 if (dumps_with_no_crash != 0) 550 if (dumps_with_no_crash != 0)
557 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); 551 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash);
558 int total_dumps = dumps_with_crash + dumps_with_no_crash; 552 int total_dumps = dumps_with_crash + dumps_with_no_crash;
559 if (total_dumps != 0) 553 if (total_dumps != 0)
560 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); 554 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps);
561 } 555 }
562 #endif // defined(OS_WIN) 556 #endif // defined(OS_WIN)
OLDNEW
« no previous file with comments | « chrome/browser/metrics/chrome_metrics_service_client.h ('k') | chrome/browser/metrics/signin_status_metrics_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698