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_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 27 matching lines...) Expand all Loading... |
38 #include "components/metrics/profiler/tracking_synchronizer.h" | 38 #include "components/metrics/profiler/tracking_synchronizer.h" |
39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
40 #include "content/public/browser/histogram_fetcher.h" | 40 #include "content/public/browser/histogram_fetcher.h" |
41 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
42 #include "content/public/browser/render_process_host.h" | 42 #include "content/public/browser/render_process_host.h" |
43 | 43 |
44 #if defined(OS_ANDROID) | 44 #if defined(OS_ANDROID) |
45 #include "chrome/browser/metrics/android_metrics_provider.h" | 45 #include "chrome/browser/metrics/android_metrics_provider.h" |
46 #endif | 46 #endif |
47 | 47 |
48 #if defined(ENABLE_FULL_PRINTING) | 48 #if defined(ENABLE_PRINT_PREVIEW) |
49 #include "chrome/browser/service_process/service_process_control.h" | 49 #include "chrome/browser/service_process/service_process_control.h" |
50 #endif | 50 #endif |
51 | 51 |
52 #if defined(ENABLE_EXTENSIONS) | 52 #if defined(ENABLE_EXTENSIONS) |
53 #include "chrome/browser/metrics/extensions_metrics_provider.h" | 53 #include "chrome/browser/metrics/extensions_metrics_provider.h" |
54 #endif | 54 #endif |
55 | 55 |
56 #if defined(ENABLE_PLUGINS) | 56 #if defined(ENABLE_PLUGINS) |
57 #include "chrome/browser/metrics/plugin_metrics_provider.h" | 57 #include "chrome/browser/metrics/plugin_metrics_provider.h" |
58 #endif | 58 #endif |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 // Create a callback_task for OnHistogramSynchronizationDone. | 391 // Create a callback_task for OnHistogramSynchronizationDone. |
392 base::Closure callback = base::Bind( | 392 base::Closure callback = base::Bind( |
393 &ChromeMetricsServiceClient::OnHistogramSynchronizationDone, | 393 &ChromeMetricsServiceClient::OnHistogramSynchronizationDone, |
394 weak_ptr_factory_.GetWeakPtr()); | 394 weak_ptr_factory_.GetWeakPtr()); |
395 | 395 |
396 base::TimeDelta timeout = | 396 base::TimeDelta timeout = |
397 base::TimeDelta::FromMilliseconds(kMaxHistogramGatheringWaitDuration); | 397 base::TimeDelta::FromMilliseconds(kMaxHistogramGatheringWaitDuration); |
398 | 398 |
399 DCHECK_EQ(num_async_histogram_fetches_in_progress_, 0); | 399 DCHECK_EQ(num_async_histogram_fetches_in_progress_, 0); |
400 | 400 |
401 #if !defined(ENABLE_FULL_PRINTING) | 401 #if !defined(ENABLE_PRINT_PREVIEW) |
402 num_async_histogram_fetches_in_progress_ = 1; | 402 num_async_histogram_fetches_in_progress_ = 1; |
403 #else // !ENABLE_FULL_PRINTING | 403 #else // !ENABLE_PRINT_PREVIEW |
404 num_async_histogram_fetches_in_progress_ = 2; | 404 num_async_histogram_fetches_in_progress_ = 2; |
405 // Run requests to service and content in parallel. | 405 // Run requests to service and content in parallel. |
406 if (!ServiceProcessControl::GetInstance()->GetHistograms(callback, timeout)) { | 406 if (!ServiceProcessControl::GetInstance()->GetHistograms(callback, timeout)) { |
407 // Assume |num_async_histogram_fetches_in_progress_| is not changed by | 407 // Assume |num_async_histogram_fetches_in_progress_| is not changed by |
408 // |GetHistograms()|. | 408 // |GetHistograms()|. |
409 DCHECK_EQ(num_async_histogram_fetches_in_progress_, 2); | 409 DCHECK_EQ(num_async_histogram_fetches_in_progress_, 2); |
410 // Assign |num_async_histogram_fetches_in_progress_| above and decrement it | 410 // Assign |num_async_histogram_fetches_in_progress_| above and decrement it |
411 // here to make code work even if |GetHistograms()| fired |callback|. | 411 // here to make code work even if |GetHistograms()| fired |callback|. |
412 --num_async_histogram_fetches_in_progress_; | 412 --num_async_histogram_fetches_in_progress_; |
413 } | 413 } |
414 #endif // !ENABLE_FULL_PRINTING | 414 #endif // !ENABLE_PRINT_PREVIEW |
415 | 415 |
416 // Set up the callback to task to call after we receive histograms from all | 416 // Set up the callback to task to call after we receive histograms from all |
417 // child processes. |timeout| specifies how long to wait before absolutely | 417 // child processes. |timeout| specifies how long to wait before absolutely |
418 // calling us back on the task. | 418 // calling us back on the task. |
419 content::FetchHistogramsAsynchronously(base::MessageLoop::current(), callback, | 419 content::FetchHistogramsAsynchronously(base::MessageLoop::current(), callback, |
420 timeout); | 420 timeout); |
421 } | 421 } |
422 | 422 |
423 void ChromeMetricsServiceClient::OnHistogramSynchronizationDone() { | 423 void ChromeMetricsServiceClient::OnHistogramSynchronizationDone() { |
424 DCHECK(thread_checker_.CalledOnValidThread()); | 424 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 // Capture the histogram samples. | 547 // Capture the histogram samples. |
548 if (dumps_with_crash != 0) | 548 if (dumps_with_crash != 0) |
549 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); | 549 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); |
550 if (dumps_with_no_crash != 0) | 550 if (dumps_with_no_crash != 0) |
551 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); | 551 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); |
552 int total_dumps = dumps_with_crash + dumps_with_no_crash; | 552 int total_dumps = dumps_with_crash + dumps_with_no_crash; |
553 if (total_dumps != 0) | 553 if (total_dumps != 0) |
554 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); | 554 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); |
555 } | 555 } |
556 #endif // defined(OS_WIN) | 556 #endif // defined(OS_WIN) |
OLD | NEW |