Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: ios/web/user_metrics.cc

Issue 1859213002: Move the thread hop for UMA user actions from content:: to base::. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initializing in content. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698