OLD | NEW |
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/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "base/task_runner.h" | 9 #include "base/task_runner.h" |
10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 resource_host_ = resource_host; | 33 resource_host_ = resource_host; |
34 } | 34 } |
35 | 35 |
36 void ResourceMessageFilter::OnFilterDestroyed() { | 36 void ResourceMessageFilter::OnFilterDestroyed() { |
37 resource_host_ = NULL; | 37 resource_host_ = NULL; |
38 } | 38 } |
39 | 39 |
40 bool ResourceMessageFilter::HandleMessage(const IPC::Message& msg, | 40 bool ResourceMessageFilter::HandleMessage(const IPC::Message& msg, |
41 HostMessageContext* context) { | 41 HostMessageContext* context) { |
42 scoped_refptr<base::TaskRunner> runner = OverrideTaskRunnerForMessage(msg); | 42 scoped_refptr<base::TaskRunner> runner = OverrideTaskRunnerForMessage(msg); |
43 if (runner) { | 43 if (runner.get()) { |
44 // TODO(raymes): We need to make a copy so the context can be used on other | 44 // TODO(raymes): We need to make a copy so the context can be used on other |
45 // threads. It would be better to have a thread-safe refcounted context. | 45 // threads. It would be better to have a thread-safe refcounted context. |
46 HostMessageContext context_copy = *context; | 46 HostMessageContext context_copy = *context; |
47 runner->PostTask(FROM_HERE, base::Bind( | 47 runner->PostTask(FROM_HERE, base::Bind( |
48 &ResourceMessageFilter::DispatchMessage, this, msg, context_copy)); | 48 &ResourceMessageFilter::DispatchMessage, this, msg, context_copy)); |
49 return true; | 49 return true; |
50 } | 50 } |
51 | 51 |
52 return false; | 52 return false; |
53 } | 53 } |
(...skipping 14 matching lines...) Expand all Loading... |
68 return NULL; | 68 return NULL; |
69 } | 69 } |
70 | 70 |
71 void ResourceMessageFilter::DispatchMessage(const IPC::Message& msg, | 71 void ResourceMessageFilter::DispatchMessage(const IPC::Message& msg, |
72 HostMessageContext context) { | 72 HostMessageContext context) { |
73 RunMessageHandlerAndReply(msg, &context); | 73 RunMessageHandlerAndReply(msg, &context); |
74 } | 74 } |
75 | 75 |
76 } // namespace host | 76 } // namespace host |
77 } // namespace ppapi | 77 } // namespace ppapi |
OLD | NEW |