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

Unified Diff: ppapi/host/resource_host.cc

Issue 11359097: Refactored the PPB_Flash_File_ModuleLocal/FileRef to the new ppapi resource model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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
Index: ppapi/host/resource_host.cc
diff --git a/ppapi/host/resource_host.cc b/ppapi/host/resource_host.cc
index b67be089ac0191c4a5d793ceb0acce229d672eae..4720a23a9d0f69ef3e40c997a3926861122fb9b6 100644
--- a/ppapi/host/resource_host.cc
+++ b/ppapi/host/resource_host.cc
@@ -5,6 +5,8 @@
#include "ppapi/host/resource_host.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/host/ppapi_host.h"
+#include "ppapi/host/resource_message_filter.h"
namespace ppapi {
namespace host {
@@ -18,11 +20,30 @@ ResourceHost::ResourceHost(PpapiHost* host,
}
ResourceHost::~ResourceHost() {
+ for (size_t i = 0; i < message_filters_.size(); ++i)
+ message_filters_[i]->OnFilterDestroyed();
}
-int32_t ResourceHost::OnResourceMessageReceived(const IPC::Message& msg,
- HostMessageContext* context) {
- return PP_ERROR_NOTSUPPORTED;
+bool ResourceHost::HandleMessage(const IPC::Message& msg,
+ HostMessageContext* context) {
+ // First see if the message is handled off-thread by message filters.
+ for (size_t i = 0; i < message_filters_.size(); ++i) {
+ if (message_filters_[i]->HandleMessage(msg, context))
+ return true;
+ }
+ // Run this ResourceHosts message handler.
+ RunMessageHandlerAndReply(msg, context);
+ return true;
+}
+
+void ResourceHost::SendReply(const ReplyMessageContext& context,
+ const IPC::Message& msg) {
+ host_->SendReply(context, msg);
+}
+
+void ResourceHost::AddFilter(scoped_refptr<ResourceMessageFilter> filter) {
+ message_filters_.push_back(filter);
+ filter->OnFilterAdded(this);
}
} // namespace host

Powered by Google App Engine
This is Rietveld 408576698