| 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/google_update_metrics_provider_win.h" | 5 #include "chrome/browser/metrics/google_update_metrics_provider_win.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/location.h" |
| 8 #include "base/single_thread_task_runner.h" |
| 8 #include "base/task_runner_util.h" | 9 #include "base/task_runner_util.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "components/metrics/proto/system_profile.pb.h" | 11 #include "components/metrics/proto/system_profile.pb.h" |
| 10 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 11 | 13 |
| 12 typedef metrics::SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; | 14 typedef metrics::SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; |
| 13 | 15 |
| 14 namespace { | 16 namespace { |
| 15 | 17 |
| 16 // Helper function for checking if this is an official build. Used instead of | 18 // Helper function for checking if this is an official build. Used instead of |
| 17 // the macro to allow checking for successful code compilation on non-official | 19 // the macro to allow checking for successful code compilation on non-official |
| 18 // builds. | 20 // builds. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 42 GoogleUpdateMetricsProviderWin::GoogleUpdateMetricsProviderWin() | 44 GoogleUpdateMetricsProviderWin::GoogleUpdateMetricsProviderWin() |
| 43 : weak_ptr_factory_(this) { | 45 : weak_ptr_factory_(this) { |
| 44 } | 46 } |
| 45 | 47 |
| 46 GoogleUpdateMetricsProviderWin::~GoogleUpdateMetricsProviderWin() { | 48 GoogleUpdateMetricsProviderWin::~GoogleUpdateMetricsProviderWin() { |
| 47 } | 49 } |
| 48 | 50 |
| 49 void GoogleUpdateMetricsProviderWin::GetGoogleUpdateData( | 51 void GoogleUpdateMetricsProviderWin::GetGoogleUpdateData( |
| 50 const base::Closure& done_callback) { | 52 const base::Closure& done_callback) { |
| 51 if (!IsOfficialBuild()) { | 53 if (!IsOfficialBuild()) { |
| 52 base::MessageLoop::current()->PostTask(FROM_HERE, done_callback); | 54 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, done_callback); |
| 53 return; | 55 return; |
| 54 } | 56 } |
| 55 | 57 |
| 56 // Schedules a task on a blocking pool thread to gather Google Update | 58 // Schedules a task on a blocking pool thread to gather Google Update |
| 57 // statistics (requires Registry reads). | 59 // statistics (requires Registry reads). |
| 58 base::PostTaskAndReplyWithResult( | 60 base::PostTaskAndReplyWithResult( |
| 59 content::BrowserThread::GetBlockingPool(), | 61 content::BrowserThread::GetBlockingPool(), |
| 60 FROM_HERE, | 62 FROM_HERE, |
| 61 base::Bind( | 63 base::Bind( |
| 62 &GoogleUpdateMetricsProviderWin::GetGoogleUpdateDataOnBlockingPool), | 64 &GoogleUpdateMetricsProviderWin::GetGoogleUpdateDataOnBlockingPool), |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 &google_update_metrics.product_data); | 128 &google_update_metrics.product_data); |
| 127 return google_update_metrics; | 129 return google_update_metrics; |
| 128 } | 130 } |
| 129 | 131 |
| 130 void GoogleUpdateMetricsProviderWin::ReceiveGoogleUpdateData( | 132 void GoogleUpdateMetricsProviderWin::ReceiveGoogleUpdateData( |
| 131 const base::Closure& done_callback, | 133 const base::Closure& done_callback, |
| 132 const GoogleUpdateMetrics& google_update_metrics) { | 134 const GoogleUpdateMetrics& google_update_metrics) { |
| 133 google_update_metrics_ = google_update_metrics; | 135 google_update_metrics_ = google_update_metrics; |
| 134 done_callback.Run(); | 136 done_callback.Run(); |
| 135 } | 137 } |
| OLD | NEW |