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

Side by Side Diff: ppapi/host/resource_message_filter.cc

Issue 2886913005: Rename TaskRunner::RunsTasksOnCurrentThread() in //dbus, //chromeos, //ppapi (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « dbus/exported_object.cc ('k') | ppapi/proxy/udp_socket_filter.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ppapi/host/resource_message_filter.h" 5 #include "ppapi/host/resource_message_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/task_runner.h" 10 #include "base/task_runner.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 void ResourceMessageFilter::OnFilterDestroyed() { 56 void ResourceMessageFilter::OnFilterDestroyed() {
57 resource_host_ = NULL; 57 resource_host_ = NULL;
58 } 58 }
59 59
60 bool ResourceMessageFilter::HandleMessage(const IPC::Message& msg, 60 bool ResourceMessageFilter::HandleMessage(const IPC::Message& msg,
61 HostMessageContext* context) { 61 HostMessageContext* context) {
62 scoped_refptr<base::TaskRunner> runner = OverrideTaskRunnerForMessage(msg); 62 scoped_refptr<base::TaskRunner> runner = OverrideTaskRunnerForMessage(msg);
63 if (runner.get()) { 63 if (runner.get()) {
64 if (runner->RunsTasksOnCurrentThread()) { 64 if (runner->RunsTasksInCurrentSequence()) {
65 DispatchMessage(msg, *context); 65 DispatchMessage(msg, *context);
66 } else { 66 } else {
67 // TODO(raymes): We need to make a copy so the context can be used on 67 // TODO(raymes): We need to make a copy so the context can be used on
68 // other threads. It would be better to have a thread-safe refcounted 68 // other threads. It would be better to have a thread-safe refcounted
69 // context. 69 // context.
70 HostMessageContext context_copy = *context; 70 HostMessageContext context_copy = *context;
71 runner->PostTask(FROM_HERE, base::Bind( 71 runner->PostTask(FROM_HERE, base::Bind(
72 &ResourceMessageFilter::DispatchMessage, this, msg, context_copy)); 72 &ResourceMessageFilter::DispatchMessage, this, msg, context_copy));
73 } 73 }
74 return true; 74 return true;
(...skipping 19 matching lines...) Expand all
94 return NULL; 94 return NULL;
95 } 95 }
96 96
97 void ResourceMessageFilter::DispatchMessage(const IPC::Message& msg, 97 void ResourceMessageFilter::DispatchMessage(const IPC::Message& msg,
98 HostMessageContext context) { 98 HostMessageContext context) {
99 RunMessageHandlerAndReply(msg, &context); 99 RunMessageHandlerAndReply(msg, &context);
100 } 100 }
101 101
102 } // namespace host 102 } // namespace host
103 } // namespace ppapi 103 } // namespace ppapi
OLDNEW
« no previous file with comments | « dbus/exported_object.cc ('k') | ppapi/proxy/udp_socket_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698