Index: ppapi/proxy/plugin_message_filter.cc |
diff --git a/ppapi/proxy/plugin_message_filter.cc b/ppapi/proxy/plugin_message_filter.cc |
index f2f1cbeef144475778d7119a4dcfc2b4d04d99b1..d9dadc37f581824c26470c10f7568983d8369d0f 100644 |
--- a/ppapi/proxy/plugin_message_filter.cc |
+++ b/ppapi/proxy/plugin_message_filter.cc |
@@ -54,6 +54,11 @@ bool PluginMessageFilter::Send(IPC::Message* msg) { |
return false; |
} |
+void PluginMessageFilter::AddResourceMessageFilter( |
+ const scoped_refptr<ResourceMessageFilter>& filter) { |
+ resource_filters_.push_back(filter); |
+} |
+ |
// static |
void PluginMessageFilter::DispatchResourceReplyForTest( |
const ResourceMessageReplyParams& reply_params, |
@@ -82,17 +87,15 @@ void PluginMessageFilter::OnMsgReserveInstanceId(PP_Instance instance, |
void PluginMessageFilter::OnMsgResourceReply( |
const ResourceMessageReplyParams& reply_params, |
const IPC::Message& nested_msg) { |
+ for (const auto& filter_ptr : resource_filters_) { |
+ if (filter_ptr->OnResourceReplyReceived(reply_params, nested_msg)) |
+ return; |
+ } |
scoped_refptr<base::MessageLoopProxy> target = |
resource_reply_thread_registrar_->GetTargetThread(reply_params, |
nested_msg); |
- |
- if (!target.get()) { |
- DispatchResourceReply(reply_params, nested_msg); |
- } else { |
- target->PostTask( |
- FROM_HERE, |
- base::Bind(&DispatchResourceReply, reply_params, nested_msg)); |
- } |
+ target->PostTask( |
+ FROM_HERE, base::Bind(&DispatchResourceReply, reply_params, nested_msg)); |
} |
// static |