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

Side by Side Diff: ppapi/proxy/ppb_instance_proxy.cc

Issue 564573002: PPAPI: Make PPP_MessageHandler work in PNaCl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 6 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 unified diff | Download patch
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/tests/test_message_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ppb_instance_proxy.h" 5 #include "ppapi/proxy/ppb_instance_proxy.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "media/base/limits.h" 9 #include "media/base/limits.h"
10 #include "ppapi/c/pp_errors.h" 10 #include "ppapi/c/pp_errors.h"
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 PP_Var message) { 831 PP_Var message) {
832 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( 832 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage(
833 API_ID_PPB_INSTANCE, 833 API_ID_PPB_INSTANCE,
834 instance, SerializedVarSendInputShmem(dispatcher(), message, 834 instance, SerializedVarSendInputShmem(dispatcher(), message,
835 instance))); 835 instance)));
836 } 836 }
837 837
838 int32_t PPB_Instance_Proxy::RegisterMessageHandler( 838 int32_t PPB_Instance_Proxy::RegisterMessageHandler(
839 PP_Instance instance, 839 PP_Instance instance,
840 void* user_data, 840 void* user_data,
841 const PPP_MessageHandler_0_1* handler, 841 const PPP_MessageHandler_0_2* handler,
842 PP_Resource message_loop) { 842 PP_Resource message_loop) {
843 InstanceData* data = 843 InstanceData* data =
844 static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance); 844 static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance);
845 if (!data) 845 if (!data)
846 return PP_ERROR_BADARGUMENT; 846 return PP_ERROR_BADARGUMENT;
847 847
848 int32_t result = PP_ERROR_FAILED; 848 int32_t result = PP_ERROR_FAILED;
849 scoped_ptr<MessageHandler> message_handler = MessageHandler::Create( 849 scoped_ptr<MessageHandler> message_handler = MessageHandler::Create(
850 instance, handler, user_data, message_loop, &result); 850 instance, handler, user_data, message_loop, &result);
851 if (message_handler) 851 if (message_handler)
852 data->message_handler = message_handler.Pass(); 852 data->message_handler = message_handler.Pass();
853 return result; 853 return result;
854 } 854 }
855 855
856 // TODO(dmichael): Remove this. crbug.com/414398
857 int32_t PPB_Instance_Proxy::RegisterMessageHandler_1_1_Deprecated(
858 PP_Instance instance,
859 void* user_data,
860 const PPP_MessageHandler_0_1_Deprecated* handler,
861 PP_Resource message_loop) {
862 InstanceData* data =
863 static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance);
864 if (!data)
865 return PP_ERROR_BADARGUMENT;
866
867 int32_t result = PP_ERROR_FAILED;
868 scoped_ptr<MessageHandler> message_handler = MessageHandler::CreateDeprecated(
869 instance, handler, user_data, message_loop, &result);
870 if (message_handler)
871 data->message_handler = message_handler.Pass();
872 return result;
873 }
874
856 void PPB_Instance_Proxy::UnregisterMessageHandler(PP_Instance instance) { 875 void PPB_Instance_Proxy::UnregisterMessageHandler(PP_Instance instance) {
857 InstanceData* data = 876 InstanceData* data =
858 static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance); 877 static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance);
859 if (!data) 878 if (!data)
860 return; 879 return;
861 data->message_handler.reset(); 880 data->message_handler.reset();
862 } 881 }
863 882
864 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance, 883 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance,
865 PP_MouseCursor_Type type, 884 PP_MouseCursor_Type type,
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 PP_Instance instance) { 1588 PP_Instance instance) {
1570 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1589 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1571 GetInstanceData(instance); 1590 GetInstanceData(instance);
1572 if (!data) 1591 if (!data)
1573 return; // Instance was probably deleted. 1592 return; // Instance was probably deleted.
1574 data->should_do_request_surrounding_text = false; 1593 data->should_do_request_surrounding_text = false;
1575 } 1594 }
1576 1595
1577 } // namespace proxy 1596 } // namespace proxy
1578 } // namespace ppapi 1597 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/tests/test_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698