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

Unified Diff: ppapi/proxy/ppb_instance_proxy.cc

Issue 264303002: PPAPI: Implement synchronous postMessage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 6 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/proxy/ppapi_messages.h ('k') | ppapi/proxy/ppb_message_loop_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_instance_proxy.cc
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index 2b1a9889026c0474cb3b966871f8d0907cfe91b5..4f64e917af4413db9697ca6a3a7fc373d596b53d 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -26,6 +26,7 @@
#include "ppapi/proxy/gamepad_resource.h"
#include "ppapi/proxy/host_dispatcher.h"
#include "ppapi/proxy/isolated_file_system_private_resource.h"
+#include "ppapi/proxy/message_handler.h"
#include "ppapi/proxy/network_proxy_resource.h"
#include "ppapi/proxy/pdf_resource.h"
#include "ppapi/proxy/plugin_dispatcher.h"
@@ -773,17 +774,31 @@ void PPB_Instance_Proxy::PostMessage(PP_Instance instance,
instance, SerializedVarSendInputShmem(dispatcher(), message,
instance)));
}
+
int32_t PPB_Instance_Proxy::RegisterMessageHandler(
PP_Instance instance,
void* user_data,
const PPP_MessageHandler_0_1* handler,
PP_Resource message_loop) {
- // Not yet implemented. See crbug.com/367896
- return PP_ERROR_NOTSUPPORTED;
+ InstanceData* data =
+ static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance);
+ if (!data)
+ return PP_ERROR_BADARGUMENT;
+
+ int32_t result = PP_ERROR_FAILED;
+ scoped_ptr<MessageHandler> message_handler = MessageHandler::Create(
+ instance, handler, user_data, message_loop, &result);
+ if (message_handler)
+ data->message_handler = message_handler.Pass();
+ return result;
}
void PPB_Instance_Proxy::UnregisterMessageHandler(PP_Instance instance) {
- // Not yet implemented. See crbug.com/367896
+ InstanceData* data =
+ static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance);
+ if (!data)
+ return;
+ data->message_handler.reset();
}
PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance,
« no previous file with comments | « ppapi/proxy/ppapi_messages.h ('k') | ppapi/proxy/ppb_message_loop_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698