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

Unified Diff: ppapi/host/ppapi_host.cc

Issue 10909138: Convert the async device ID getter to a chrome resource host (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/host/ppapi_host.h ('k') | ppapi/ppapi_proxy.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/host/ppapi_host.cc
diff --git a/ppapi/host/ppapi_host.cc b/ppapi/host/ppapi_host.cc
index 247c78184ff0e83b821fc84fea37432513673568..0ec37b6e11d2c8ac9ff5a7c96593a5420a1e310e 100644
--- a/ppapi/host/ppapi_host.cc
+++ b/ppapi/host/ppapi_host.cc
@@ -26,10 +26,8 @@ const size_t kMaxResourcesPerPlugin = 1 << 14;
} // namespace
PpapiHost::PpapiHost(IPC::Sender* sender,
- HostFactory* host_factory,
const PpapiPermissions& perms)
: sender_(sender),
- host_factory_(host_factory),
permissions_(perms) {
}
@@ -73,6 +71,9 @@ void PpapiHost::SendReply(const proxy::ResourceMessageReplyParams& params,
Send(new PpapiPluginMsg_ResourceReply(params, msg));
}
+void PpapiHost::AddHostFactoryFilter(scoped_ptr<HostFactory> filter) {
+ host_factory_filters_.push_back(filter.release());
+}
void PpapiHost::AddInstanceMessageFilter(
scoped_ptr<InstanceMessageFilter> filter) {
@@ -121,8 +122,15 @@ void PpapiHost::OnHostMsgResourceCreated(
if (resources_.size() >= kMaxResourcesPerPlugin)
return;
- scoped_ptr<ResourceHost> resource_host(
- host_factory_->CreateResourceHost(this, params, instance, nested_msg));
+ // Run through all filters until one grabs this message.
+ scoped_ptr<ResourceHost> resource_host;
+ DCHECK(!host_factory_filters_.empty()); // Caller forgot to add a factory.
+ for (size_t i = 0; i < host_factory_filters_.size(); i++) {
+ resource_host = host_factory_filters_[i]->CreateResourceHost(
+ this, params, instance, nested_msg).Pass();
+ if (resource_host.get())
+ break;
+ }
if (!resource_host.get()) {
NOTREACHED();
return;
« no previous file with comments | « ppapi/host/ppapi_host.h ('k') | ppapi/ppapi_proxy.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698