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

Side by Side Diff: content/browser/user_metrics.cc

Issue 8536037: base::Bind: Low-hanging fruit conversions of NewRunnableFunction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix 4. Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/plugin_service_browsertest.cc ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/user_metrics.h" 5 #include "content/browser/user_metrics.h"
6 6
7 #include "base/bind.h"
7 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
8 #include "content/public/browser/notification_service.h" 9 #include "content/public/browser/notification_service.h"
9 #include "content/public/browser/notification_types.h" 10 #include "content/public/browser/notification_types.h"
10 11
11 using content::BrowserThread; 12 using content::BrowserThread;
12 13
13 void UserMetrics::RecordAction(const UserMetricsAction& action) { 14 void UserMetrics::RecordAction(const UserMetricsAction& action) {
14 Record(action.str_); 15 Record(action.str_);
15 } 16 }
16 17
17 void UserMetrics::RecordComputedAction(const std::string& action) { 18 void UserMetrics::RecordComputedAction(const std::string& action) {
18 Record(action.c_str()); 19 Record(action.c_str());
19 } 20 }
20 21
21 void UserMetrics::Record(const char *action) { 22 void UserMetrics::Record(const char *action) {
22 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 23 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
23 BrowserThread::PostTask( 24 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
24 BrowserThread::UI, FROM_HERE, 25 base::Bind(&UserMetrics::CallRecordOnUI, action));
25 NewRunnableFunction(&UserMetrics::CallRecordOnUI, action));
26 return; 26 return;
27 } 27 }
28 28
29 content::NotificationService::current()->Notify( 29 content::NotificationService::current()->Notify(
30 content::NOTIFICATION_USER_ACTION, 30 content::NOTIFICATION_USER_ACTION,
31 content::NotificationService::AllSources(), 31 content::NotificationService::AllSources(),
32 content::Details<const char*>(&action)); 32 content::Details<const char*>(&action));
33 } 33 }
34 34
35 void UserMetrics::CallRecordOnUI(const std::string& action) { 35 void UserMetrics::CallRecordOnUI(const std::string& action) {
36 Record(action.c_str()); 36 Record(action.c_str());
37 } 37 }
OLDNEW
« no previous file with comments | « content/browser/plugin_service_browsertest.cc ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698