| OLD | NEW |
| 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 "ppapi/proxy/plugin_message_filter.h" | 5 #include "ppapi/proxy/plugin_message_filter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/single_thread_task_runner.h" |
| 9 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_channel.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 12 #include "ppapi/proxy/ppapi_messages.h" |
| 11 #include "ppapi/proxy/resource_message_params.h" | 13 #include "ppapi/proxy/resource_message_params.h" |
| 12 #include "ppapi/proxy/resource_reply_thread_registrar.h" | 14 #include "ppapi/proxy/resource_reply_thread_registrar.h" |
| 13 #include "ppapi/shared_impl/ppapi_globals.h" | 15 #include "ppapi/shared_impl/ppapi_globals.h" |
| 14 #include "ppapi/shared_impl/proxy_lock.h" | 16 #include "ppapi/shared_impl/proxy_lock.h" |
| 15 #include "ppapi/shared_impl/resource.h" | 17 #include "ppapi/shared_impl/resource.h" |
| 16 #include "ppapi/shared_impl/resource_tracker.h" | 18 #include "ppapi/shared_impl/resource_tracker.h" |
| 17 | 19 |
| 18 namespace ppapi { | 20 namespace ppapi { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 *usable = true; | 86 *usable = true; |
| 85 } | 87 } |
| 86 | 88 |
| 87 void PluginMessageFilter::OnMsgResourceReply( | 89 void PluginMessageFilter::OnMsgResourceReply( |
| 88 const ResourceMessageReplyParams& reply_params, | 90 const ResourceMessageReplyParams& reply_params, |
| 89 const IPC::Message& nested_msg) { | 91 const IPC::Message& nested_msg) { |
| 90 for (const auto& filter_ptr : resource_filters_) { | 92 for (const auto& filter_ptr : resource_filters_) { |
| 91 if (filter_ptr->OnResourceReplyReceived(reply_params, nested_msg)) | 93 if (filter_ptr->OnResourceReplyReceived(reply_params, nested_msg)) |
| 92 return; | 94 return; |
| 93 } | 95 } |
| 94 scoped_refptr<base::MessageLoopProxy> target = | 96 scoped_refptr<base::SingleThreadTaskRunner> target = |
| 95 resource_reply_thread_registrar_->GetTargetThread(reply_params, | 97 resource_reply_thread_registrar_->GetTargetThread(reply_params, |
| 96 nested_msg); | 98 nested_msg); |
| 97 target->PostTask( | 99 target->PostTask( |
| 98 FROM_HERE, base::Bind(&DispatchResourceReply, reply_params, nested_msg)); | 100 FROM_HERE, base::Bind(&DispatchResourceReply, reply_params, nested_msg)); |
| 99 } | 101 } |
| 100 | 102 |
| 101 // static | 103 // static |
| 102 void PluginMessageFilter::DispatchResourceReply( | 104 void PluginMessageFilter::DispatchResourceReply( |
| 103 const ResourceMessageReplyParams& reply_params, | 105 const ResourceMessageReplyParams& reply_params, |
| 104 const IPC::Message& nested_msg) { | 106 const IPC::Message& nested_msg) { |
| 105 ProxyAutoLock lock; | 107 ProxyAutoLock lock; |
| 106 Resource* resource = PpapiGlobals::Get()->GetResourceTracker()->GetResource( | 108 Resource* resource = PpapiGlobals::Get()->GetResourceTracker()->GetResource( |
| 107 reply_params.pp_resource()); | 109 reply_params.pp_resource()); |
| 108 if (!resource) { | 110 if (!resource) { |
| 109 DVLOG_IF(1, reply_params.sequence() != 0) | 111 DVLOG_IF(1, reply_params.sequence() != 0) |
| 110 << "Pepper resource reply message received but the resource doesn't " | 112 << "Pepper resource reply message received but the resource doesn't " |
| 111 "exist (probably has been destroyed)."; | 113 "exist (probably has been destroyed)."; |
| 112 return; | 114 return; |
| 113 } | 115 } |
| 114 resource->OnReplyReceived(reply_params, nested_msg); | 116 resource->OnReplyReceived(reply_params, nested_msg); |
| 115 } | 117 } |
| 116 | 118 |
| 117 } // namespace proxy | 119 } // namespace proxy |
| 118 } // namespace ppapi | 120 } // namespace ppapi |
| OLD | NEW |