| OLD | NEW |
| 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 "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/c/pp_time.h" | 8 #include "ppapi/c/pp_time.h" |
| 9 #include "ppapi/c/pp_var.h" | 9 #include "ppapi/c/pp_var.h" |
| 10 #include "ppapi/c/ppb_audio_config.h" | 10 #include "ppapi/c/ppb_audio_config.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_NeedKey, | 158 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_NeedKey, |
| 159 OnHostMsgNeedKey) | 159 OnHostMsgNeedKey) |
| 160 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyAdded, | 160 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyAdded, |
| 161 OnHostMsgKeyAdded) | 161 OnHostMsgKeyAdded) |
| 162 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyMessage, | 162 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyMessage, |
| 163 OnHostMsgKeyMessage) | 163 OnHostMsgKeyMessage) |
| 164 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyError, | 164 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyError, |
| 165 OnHostMsgKeyError) | 165 OnHostMsgKeyError) |
| 166 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock, | 166 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock, |
| 167 OnHostMsgDeliverBlock) | 167 OnHostMsgDeliverBlock) |
| 168 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DecoderReset, |
| 169 OnHostMsgDecoderReset) |
| 170 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DecoderStopped, |
| 171 OnHostMsgDecoderStopped) |
| 168 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverFrame, | 172 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverFrame, |
| 169 OnHostMsgDeliverFrame) | 173 OnHostMsgDeliverFrame) |
| 170 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverSamples, | 174 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverSamples, |
| 171 OnHostMsgDeliverSamples) | 175 OnHostMsgDeliverSamples) |
| 172 #endif // !defined(OS_NACL) | 176 #endif // !defined(OS_NACL) |
| 173 | 177 |
| 174 // Host -> Plugin messages. | 178 // Host -> Plugin messages. |
| 175 IPC_MESSAGE_HANDLER(PpapiMsg_PPBInstance_MouseLockComplete, | 179 IPC_MESSAGE_HANDLER(PpapiMsg_PPBInstance_MouseLockComplete, |
| 176 OnPluginMsgMouseLockComplete) | 180 OnPluginMsgMouseLockComplete) |
| 177 | 181 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 if (!SerializeBlockInfo(*block_info, &serialized_block_info)) | 505 if (!SerializeBlockInfo(*block_info, &serialized_block_info)) |
| 502 return; | 506 return; |
| 503 | 507 |
| 504 dispatcher()->Send( | 508 dispatcher()->Send( |
| 505 new PpapiHostMsg_PPBInstance_DeliverBlock(API_ID_PPB_INSTANCE, | 509 new PpapiHostMsg_PPBInstance_DeliverBlock(API_ID_PPB_INSTANCE, |
| 506 instance, | 510 instance, |
| 507 object->host_resource().host_resource(), | 511 object->host_resource().host_resource(), |
| 508 serialized_block_info)); | 512 serialized_block_info)); |
| 509 } | 513 } |
| 510 | 514 |
| 515 void PPB_Instance_Proxy::DecoderReset(PP_Instance instance, |
| 516 uint32_t request_id) { |
| 517 dispatcher()->Send( |
| 518 new PpapiHostMsg_PPBInstance_DecoderReset( |
| 519 API_ID_PPB_INSTANCE, |
| 520 instance, |
| 521 request_id)); |
| 522 } |
| 523 |
| 524 void PPB_Instance_Proxy::DecoderStopped(PP_Instance instance, |
| 525 uint32_t request_id) { |
| 526 dispatcher()->Send( |
| 527 new PpapiHostMsg_PPBInstance_DecoderStopped( |
| 528 API_ID_PPB_INSTANCE, |
| 529 instance, |
| 530 request_id)); |
| 531 } |
| 532 |
| 511 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, | 533 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, |
| 512 PP_Resource decrypted_frame, | 534 PP_Resource decrypted_frame, |
| 513 const PP_DecryptedFrameInfo* frame_info) { | 535 const PP_DecryptedFrameInfo* frame_info) { |
| 514 Resource* object = | 536 Resource* object = |
| 515 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_frame); | 537 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_frame); |
| 516 if (!object || object->pp_instance() != instance) | 538 if (!object || object->pp_instance() != instance) |
| 517 return; | 539 return; |
| 518 | 540 |
| 519 std::string serialized_block_info; | 541 std::string serialized_block_info; |
| 520 if (!SerializeBlockInfo(*frame_info, &serialized_block_info)) | 542 if (!SerializeBlockInfo(*frame_info, &serialized_block_info)) |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 const std::string& serialized_block_info) { | 943 const std::string& serialized_block_info) { |
| 922 PP_DecryptedBlockInfo block_info; | 944 PP_DecryptedBlockInfo block_info; |
| 923 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) | 945 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
| 924 return; | 946 return; |
| 925 | 947 |
| 926 EnterInstanceNoLock enter(instance); | 948 EnterInstanceNoLock enter(instance); |
| 927 if (enter.succeeded()) | 949 if (enter.succeeded()) |
| 928 enter.functions()->DeliverBlock(instance, decrypted_block, &block_info); | 950 enter.functions()->DeliverBlock(instance, decrypted_block, &block_info); |
| 929 } | 951 } |
| 930 | 952 |
| 953 void PPB_Instance_Proxy::OnHostMsgDecoderReset(PP_Instance instance, |
| 954 uint32_t request_id) { |
| 955 EnterInstanceNoLock enter(instance); |
| 956 if (enter.succeeded()) |
| 957 enter.functions()->DecoderReset(instance, request_id); |
| 958 } |
| 959 |
| 960 void PPB_Instance_Proxy::OnHostMsgDecoderStopped(PP_Instance instance, |
| 961 uint32_t request_id) { |
| 962 EnterInstanceNoLock enter(instance); |
| 963 if (enter.succeeded()) |
| 964 enter.functions()->DecoderStopped(instance, request_id); |
| 965 } |
| 966 |
| 931 void PPB_Instance_Proxy::OnHostMsgDeliverFrame( | 967 void PPB_Instance_Proxy::OnHostMsgDeliverFrame( |
| 932 PP_Instance instance, | 968 PP_Instance instance, |
| 933 PP_Resource decrypted_frame, | 969 PP_Resource decrypted_frame, |
| 934 const std::string& serialized_frame_info) { | 970 const std::string& serialized_frame_info) { |
| 935 PP_DecryptedFrameInfo frame_info; | 971 PP_DecryptedFrameInfo frame_info; |
| 936 if (!DeserializeBlockInfo(serialized_frame_info, &frame_info)) | 972 if (!DeserializeBlockInfo(serialized_frame_info, &frame_info)) |
| 937 return; | 973 return; |
| 938 | 974 |
| 939 EnterInstanceNoLock enter(instance); | 975 EnterInstanceNoLock enter(instance); |
| 940 if (enter.succeeded()) | 976 if (enter.succeeded()) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 PP_Instance instance) { | 1063 PP_Instance instance) { |
| 1028 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 1064 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
| 1029 GetInstanceData(instance); | 1065 GetInstanceData(instance); |
| 1030 if (!data) | 1066 if (!data) |
| 1031 return; // Instance was probably deleted. | 1067 return; // Instance was probably deleted. |
| 1032 data->should_do_request_surrounding_text = false; | 1068 data->should_do_request_surrounding_text = false; |
| 1033 } | 1069 } |
| 1034 | 1070 |
| 1035 } // namespace proxy | 1071 } // namespace proxy |
| 1036 } // namespace ppapi | 1072 } // namespace ppapi |
| OLD | NEW |