| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 waiting_for_collect_final_metrics_step_(false), | 126 waiting_for_collect_final_metrics_step_(false), |
| 127 num_async_histogram_fetches_in_progress_(0), | 127 num_async_histogram_fetches_in_progress_(0), |
| 128 profiler_metrics_provider_(nullptr), | 128 profiler_metrics_provider_(nullptr), |
| 129 #if defined(ENABLE_PLUGINS) | 129 #if defined(ENABLE_PLUGINS) |
| 130 plugin_metrics_provider_(nullptr), | 130 plugin_metrics_provider_(nullptr), |
| 131 #endif | 131 #endif |
| 132 #if defined(OS_WIN) | 132 #if defined(OS_WIN) |
| 133 google_update_metrics_provider_(nullptr), | 133 google_update_metrics_provider_(nullptr), |
| 134 #endif | 134 #endif |
| 135 drive_metrics_provider_(nullptr), | 135 drive_metrics_provider_(nullptr), |
| 136 start_time_(base::TimeTicks::Now()), |
| 136 weak_ptr_factory_(this) { | 137 weak_ptr_factory_(this) { |
| 137 DCHECK(thread_checker_.CalledOnValidThread()); | 138 DCHECK(thread_checker_.CalledOnValidThread()); |
| 138 RecordCommandLineMetrics(); | 139 RecordCommandLineMetrics(); |
| 139 RegisterForNotifications(); | 140 RegisterForNotifications(); |
| 140 } | 141 } |
| 141 | 142 |
| 142 ChromeMetricsServiceClient::~ChromeMetricsServiceClient() { | 143 ChromeMetricsServiceClient::~ChromeMetricsServiceClient() { |
| 143 DCHECK(thread_checker_.CalledOnValidThread()); | 144 DCHECK(thread_checker_.CalledOnValidThread()); |
| 144 } | 145 } |
| 145 | 146 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 #endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | 417 #endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) |
| 417 } | 418 } |
| 418 | 419 |
| 419 void ChromeMetricsServiceClient::OnInitTaskGotGoogleUpdateData() { | 420 void ChromeMetricsServiceClient::OnInitTaskGotGoogleUpdateData() { |
| 420 // Start the next part of the init task: fetching performance data. This will | 421 // Start the next part of the init task: fetching performance data. This will |
| 421 // call into |FinishedReceivingProfilerData()| when the task completes. | 422 // call into |FinishedReceivingProfilerData()| when the task completes. |
| 422 metrics::TrackingSynchronizer::FetchProfilerDataAsynchronously( | 423 metrics::TrackingSynchronizer::FetchProfilerDataAsynchronously( |
| 423 weak_ptr_factory_.GetWeakPtr()); | 424 weak_ptr_factory_.GetWeakPtr()); |
| 424 } | 425 } |
| 425 | 426 |
| 426 // TODO(vadimt): Consider wrapping params in a struct after the list of params | |
| 427 // to ReceivedProfilerData settles. crbug/456354. | |
| 428 void ChromeMetricsServiceClient::ReceivedProfilerData( | 427 void ChromeMetricsServiceClient::ReceivedProfilerData( |
| 428 const metrics::ProfilerDataAttributes& attributes, |
| 429 const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase, | 429 const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase, |
| 430 base::ProcessId process_id, | |
| 431 content::ProcessType process_type, | |
| 432 int profiling_phase, | |
| 433 base::TimeDelta phase_start, | |
| 434 base::TimeDelta phase_finish, | |
| 435 const metrics::ProfilerEvents& past_events) { | 430 const metrics::ProfilerEvents& past_events) { |
| 436 profiler_metrics_provider_->RecordProfilerData( | 431 profiler_metrics_provider_->RecordProfilerData( |
| 437 process_data_phase, process_id, process_type, profiling_phase, | 432 process_data_phase, attributes.process_id, attributes.process_type, |
| 438 phase_start, phase_finish, past_events); | 433 attributes.profiling_phase, attributes.phase_start - start_time_, |
| 434 attributes.phase_finish - start_time_, past_events); |
| 439 } | 435 } |
| 440 | 436 |
| 441 void ChromeMetricsServiceClient::FinishedReceivingProfilerData() { | 437 void ChromeMetricsServiceClient::FinishedReceivingProfilerData() { |
| 442 drive_metrics_provider_->GetDriveMetrics( | 438 drive_metrics_provider_->GetDriveMetrics( |
| 443 finished_gathering_initial_metrics_callback_); | 439 finished_gathering_initial_metrics_callback_); |
| 444 } | 440 } |
| 445 | 441 |
| 446 void ChromeMetricsServiceClient::OnMemoryDetailCollectionDone() { | 442 void ChromeMetricsServiceClient::OnMemoryDetailCollectionDone() { |
| 447 DCHECK(thread_checker_.CalledOnValidThread()); | 443 DCHECK(thread_checker_.CalledOnValidThread()); |
| 448 | 444 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 case content::NOTIFICATION_LOAD_START: | 553 case content::NOTIFICATION_LOAD_START: |
| 558 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: | 554 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: |
| 559 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: | 555 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: |
| 560 metrics_service_->OnApplicationNotIdle(); | 556 metrics_service_->OnApplicationNotIdle(); |
| 561 break; | 557 break; |
| 562 | 558 |
| 563 default: | 559 default: |
| 564 NOTREACHED(); | 560 NOTREACHED(); |
| 565 } | 561 } |
| 566 } | 562 } |
| OLD | NEW |