| 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 "ios/web/public/user_metrics.h" | 5 #include "ios/web/public/user_metrics.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/metrics/user_metrics.h" | 11 #include "base/metrics/user_metrics.h" |
| 12 #include "ios/web/public/web_thread.h" | 12 #include "ios/web/public/web_thread.h" |
| 13 | 13 |
| 14 namespace web { | 14 namespace web { |
| 15 | 15 |
| 16 // TODO(beaudoin): Get rid of these methods now that the base:: version does |
| 17 // thread hopping. Tracked in crbug.com/601483. |
| 16 void RecordAction(const base::UserMetricsAction& action) { | 18 void RecordAction(const base::UserMetricsAction& action) { |
| 17 if (!WebThread::CurrentlyOn(WebThread::UI)) { | |
| 18 WebThread::PostTask(WebThread::UI, FROM_HERE, | |
| 19 base::Bind(&web::RecordAction, action)); | |
| 20 return; | |
| 21 } | |
| 22 | |
| 23 base::RecordAction(action); | 19 base::RecordAction(action); |
| 24 } | 20 } |
| 25 | 21 |
| 26 void RecordComputedAction(const std::string& action) { | 22 void RecordComputedAction(const std::string& action) { |
| 27 if (!WebThread::CurrentlyOn(WebThread::UI)) { | |
| 28 WebThread::PostTask(WebThread::UI, FROM_HERE, | |
| 29 base::Bind(&web::RecordComputedAction, action)); | |
| 30 return; | |
| 31 } | |
| 32 | |
| 33 base::RecordComputedAction(action); | 23 base::RecordComputedAction(action); |
| 34 } | 24 } |
| 35 | 25 |
| 36 } // namespace web | 26 } // namespace web |
| OLD | NEW |