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 25 matching lines...) Expand all Loading... | |
36 #include "chrome/common/render_messages.h" | 36 #include "chrome/common/render_messages.h" |
37 #include "components/metrics/metrics_service.h" | 37 #include "components/metrics/metrics_service.h" |
38 #include "components/metrics/net/net_metrics_log_uploader.h" | 38 #include "components/metrics/net/net_metrics_log_uploader.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 #else | 46 #endif |
47 | |
48 #if defined(ENABLE_FULL_PRINTING) | |
47 #include "chrome/browser/service_process/service_process_control.h" | 49 #include "chrome/browser/service_process/service_process_control.h" |
48 #endif | 50 #endif |
49 | 51 |
50 #if defined(ENABLE_EXTENSIONS) | 52 #if defined(ENABLE_EXTENSIONS) |
51 #include "chrome/browser/metrics/extensions_metrics_provider.h" | 53 #include "chrome/browser/metrics/extensions_metrics_provider.h" |
52 #endif | 54 #endif |
53 | 55 |
54 #if defined(ENABLE_PLUGINS) | 56 #if defined(ENABLE_PLUGINS) |
55 #include "chrome/browser/metrics/plugin_metrics_provider.h" | 57 #include "chrome/browser/metrics/plugin_metrics_provider.h" |
56 #endif | 58 #endif |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 // Create a callback_task for OnHistogramSynchronizationDone. | 389 // Create a callback_task for OnHistogramSynchronizationDone. |
388 base::Closure callback = base::Bind( | 390 base::Closure callback = base::Bind( |
389 &ChromeMetricsServiceClient::OnHistogramSynchronizationDone, | 391 &ChromeMetricsServiceClient::OnHistogramSynchronizationDone, |
390 weak_ptr_factory_.GetWeakPtr()); | 392 weak_ptr_factory_.GetWeakPtr()); |
391 | 393 |
392 base::TimeDelta timeout = | 394 base::TimeDelta timeout = |
393 base::TimeDelta::FromMilliseconds(kMaxHistogramGatheringWaitDuration); | 395 base::TimeDelta::FromMilliseconds(kMaxHistogramGatheringWaitDuration); |
394 | 396 |
395 DCHECK_EQ(num_async_histogram_fetches_in_progress_, 0); | 397 DCHECK_EQ(num_async_histogram_fetches_in_progress_, 0); |
396 | 398 |
397 #if defined(OS_ANDROID) | 399 #if !defined(ENABLE_FULL_PRINTING) |
398 // Android has no service process. | 400 // Android has no service process. |
Lei Zhang
2014/09/08 18:50:35
remove android comment
Vitaly Buka (NO REVIEWS)
2014/09/08 21:21:45
Done.
| |
399 num_async_histogram_fetches_in_progress_ = 1; | 401 num_async_histogram_fetches_in_progress_ = 1; |
400 #else // OS_ANDROID | 402 #else // !ENABLE_FULL_PRINTING |
401 num_async_histogram_fetches_in_progress_ = 2; | 403 num_async_histogram_fetches_in_progress_ = 2; |
402 // Run requests to service and content in parallel. | 404 // Run requests to service and content in parallel. |
403 if (!ServiceProcessControl::GetInstance()->GetHistograms(callback, timeout)) { | 405 if (!ServiceProcessControl::GetInstance()->GetHistograms(callback, timeout)) { |
404 // Assume |num_async_histogram_fetches_in_progress_| is not changed by | 406 // Assume |num_async_histogram_fetches_in_progress_| is not changed by |
405 // |GetHistograms()|. | 407 // |GetHistograms()|. |
406 DCHECK_EQ(num_async_histogram_fetches_in_progress_, 2); | 408 DCHECK_EQ(num_async_histogram_fetches_in_progress_, 2); |
407 // Assign |num_async_histogram_fetches_in_progress_| above and decrement it | 409 // Assign |num_async_histogram_fetches_in_progress_| above and decrement it |
408 // here to make code work even if |GetHistograms()| fired |callback|. | 410 // here to make code work even if |GetHistograms()| fired |callback|. |
409 --num_async_histogram_fetches_in_progress_; | 411 --num_async_histogram_fetches_in_progress_; |
410 } | 412 } |
411 #endif // OS_ANDROID | 413 #endif // !ENABLE_FULL_PRINTING |
412 | 414 |
413 // Set up the callback to task to call after we receive histograms from all | 415 // Set up the callback to task to call after we receive histograms from all |
414 // child processes. |timeout| specifies how long to wait before absolutely | 416 // child processes. |timeout| specifies how long to wait before absolutely |
415 // calling us back on the task. | 417 // calling us back on the task. |
416 content::FetchHistogramsAsynchronously(base::MessageLoop::current(), callback, | 418 content::FetchHistogramsAsynchronously(base::MessageLoop::current(), callback, |
417 timeout); | 419 timeout); |
418 } | 420 } |
419 | 421 |
420 void ChromeMetricsServiceClient::OnHistogramSynchronizationDone() { | 422 void ChromeMetricsServiceClient::OnHistogramSynchronizationDone() { |
421 DCHECK(thread_checker_.CalledOnValidThread()); | 423 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 // Capture the histogram samples. | 546 // Capture the histogram samples. |
545 if (dumps_with_crash != 0) | 547 if (dumps_with_crash != 0) |
546 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); | 548 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); |
547 if (dumps_with_no_crash != 0) | 549 if (dumps_with_no_crash != 0) |
548 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); | 550 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); |
549 int total_dumps = dumps_with_crash + dumps_with_no_crash; | 551 int total_dumps = dumps_with_crash + dumps_with_no_crash; |
550 if (total_dumps != 0) | 552 if (total_dumps != 0) |
551 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); | 553 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); |
552 } | 554 } |
553 #endif // defined(OS_WIN) | 555 #endif // defined(OS_WIN) |
OLD | NEW |