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/logging.h" | 8 #include "base/logging.h" |
9 #include "ipc/ipc_channel.h" | 9 #include "ipc/ipc_channel.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // This instance ID is new so we can return that it's usable and mark it as | 76 // This instance ID is new so we can return that it's usable and mark it as |
77 // used for future reference. | 77 // used for future reference. |
78 seen_instance_ids_->insert(instance); | 78 seen_instance_ids_->insert(instance); |
79 *usable = true; | 79 *usable = true; |
80 } | 80 } |
81 | 81 |
82 void PluginMessageFilter::OnMsgResourceReply( | 82 void PluginMessageFilter::OnMsgResourceReply( |
83 const ResourceMessageReplyParams& reply_params, | 83 const ResourceMessageReplyParams& reply_params, |
84 const IPC::Message& nested_msg) { | 84 const IPC::Message& nested_msg) { |
85 scoped_refptr<base::MessageLoopProxy> target = | 85 scoped_refptr<base::MessageLoopProxy> target = |
86 resource_reply_thread_registrar_->GetTargetThreadAndUnregister( | 86 resource_reply_thread_registrar_->GetTargetThread(reply_params, |
87 reply_params.pp_resource(), reply_params.sequence()); | 87 nested_msg); |
88 | 88 |
89 target->PostTask( | 89 if (!target.get()) { |
90 FROM_HERE, | 90 DispatchResourceReply(reply_params, nested_msg); |
91 base::Bind(&DispatchResourceReply, reply_params, nested_msg)); | 91 } else { |
| 92 target->PostTask( |
| 93 FROM_HERE, |
| 94 base::Bind(&DispatchResourceReply, reply_params, nested_msg)); |
| 95 } |
92 } | 96 } |
93 | 97 |
94 // static | 98 // static |
95 void PluginMessageFilter::DispatchResourceReply( | 99 void PluginMessageFilter::DispatchResourceReply( |
96 const ResourceMessageReplyParams& reply_params, | 100 const ResourceMessageReplyParams& reply_params, |
97 const IPC::Message& nested_msg) { | 101 const IPC::Message& nested_msg) { |
98 ProxyAutoLock lock; | 102 ProxyAutoLock lock; |
99 Resource* resource = PpapiGlobals::Get()->GetResourceTracker()->GetResource( | 103 Resource* resource = PpapiGlobals::Get()->GetResourceTracker()->GetResource( |
100 reply_params.pp_resource()); | 104 reply_params.pp_resource()); |
101 if (!resource) { | 105 if (!resource) { |
102 DVLOG_IF(1, reply_params.sequence() != 0) | 106 DVLOG_IF(1, reply_params.sequence() != 0) |
103 << "Pepper resource reply message received but the resource doesn't " | 107 << "Pepper resource reply message received but the resource doesn't " |
104 "exist (probably has been destroyed)."; | 108 "exist (probably has been destroyed)."; |
105 return; | 109 return; |
106 } | 110 } |
107 resource->OnReplyReceived(reply_params, nested_msg); | 111 resource->OnReplyReceived(reply_params, nested_msg); |
108 } | 112 } |
109 | 113 |
110 } // namespace proxy | 114 } // namespace proxy |
111 } // namespace ppapi | 115 } // namespace ppapi |
OLD | NEW |