| 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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/c/pp_time.h" | 9 #include "ppapi/c/pp_time.h" |
| 10 #include "ppapi/c/pp_var.h" | 10 #include "ppapi/c/pp_var.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_NeedKey, | 160 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_NeedKey, |
| 161 OnHostMsgNeedKey) | 161 OnHostMsgNeedKey) |
| 162 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyAdded, | 162 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyAdded, |
| 163 OnHostMsgKeyAdded) | 163 OnHostMsgKeyAdded) |
| 164 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyMessage, | 164 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyMessage, |
| 165 OnHostMsgKeyMessage) | 165 OnHostMsgKeyMessage) |
| 166 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyError, | 166 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyError, |
| 167 OnHostMsgKeyError) | 167 OnHostMsgKeyError) |
| 168 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock, | 168 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock, |
| 169 OnHostMsgDeliverBlock) | 169 OnHostMsgDeliverBlock) |
| 170 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DecoderInitialized, |
| 171 OnHostMsgDecoderInitialized) |
| 170 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverFrame, | 172 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverFrame, |
| 171 OnHostMsgDeliverFrame) | 173 OnHostMsgDeliverFrame) |
| 172 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverSamples, | 174 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverSamples, |
| 173 OnHostMsgDeliverSamples) | 175 OnHostMsgDeliverSamples) |
| 174 #endif // !defined(OS_NACL) | 176 #endif // !defined(OS_NACL) |
| 175 | 177 |
| 176 // Host -> Plugin messages. | 178 // Host -> Plugin messages. |
| 177 IPC_MESSAGE_HANDLER(PpapiMsg_PPBInstance_MouseLockComplete, | 179 IPC_MESSAGE_HANDLER(PpapiMsg_PPBInstance_MouseLockComplete, |
| 178 OnPluginMsgMouseLockComplete) | 180 OnPluginMsgMouseLockComplete) |
| 179 | 181 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 if (!SerializeBlockInfo(*block_info, &serialized_block_info)) | 527 if (!SerializeBlockInfo(*block_info, &serialized_block_info)) |
| 526 return; | 528 return; |
| 527 | 529 |
| 528 dispatcher()->Send( | 530 dispatcher()->Send( |
| 529 new PpapiHostMsg_PPBInstance_DeliverBlock(API_ID_PPB_INSTANCE, | 531 new PpapiHostMsg_PPBInstance_DeliverBlock(API_ID_PPB_INSTANCE, |
| 530 instance, | 532 instance, |
| 531 object->host_resource().host_resource(), | 533 object->host_resource().host_resource(), |
| 532 serialized_block_info)); | 534 serialized_block_info)); |
| 533 } | 535 } |
| 534 | 536 |
| 537 void PPB_Instance_Proxy::DecoderInitialized(PP_Instance instance, |
| 538 PP_Bool success, |
| 539 uint32_t request_id) { |
| 540 dispatcher()->Send( |
| 541 new PpapiHostMsg_PPBInstance_DecoderInitialized( |
| 542 API_ID_PPB_INSTANCE, |
| 543 instance, |
| 544 success, |
| 545 request_id)); |
| 546 } |
| 547 |
| 535 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, | 548 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, |
| 536 PP_Resource decrypted_frame, | 549 PP_Resource decrypted_frame, |
| 537 const PP_DecryptedFrameInfo* frame_info) { | 550 const PP_DecryptedFrameInfo* frame_info) { |
| 538 Resource* object = | 551 Resource* object = |
| 539 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_frame); | 552 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_frame); |
| 540 if (!object || object->pp_instance() != instance) | 553 if (!object || object->pp_instance() != instance) |
| 541 return; | 554 return; |
| 542 | 555 |
| 543 std::string serialized_block_info; | 556 std::string serialized_block_info; |
| 544 if (!SerializeBlockInfo(*frame_info, &serialized_block_info)) | 557 if (!SerializeBlockInfo(*frame_info, &serialized_block_info)) |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 const std::string& serialized_block_info) { | 958 const std::string& serialized_block_info) { |
| 946 PP_DecryptedBlockInfo block_info; | 959 PP_DecryptedBlockInfo block_info; |
| 947 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) | 960 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
| 948 return; | 961 return; |
| 949 | 962 |
| 950 EnterInstanceNoLock enter(instance); | 963 EnterInstanceNoLock enter(instance); |
| 951 if (enter.succeeded()) | 964 if (enter.succeeded()) |
| 952 enter.functions()->DeliverBlock(instance, decrypted_block, &block_info); | 965 enter.functions()->DeliverBlock(instance, decrypted_block, &block_info); |
| 953 } | 966 } |
| 954 | 967 |
| 968 void PPB_Instance_Proxy::OnHostMsgDecoderInitialized( |
| 969 PP_Instance instance, |
| 970 PP_Bool success, |
| 971 uint32_t request_id) { |
| 972 EnterInstanceNoLock enter(instance); |
| 973 if (enter.succeeded()) |
| 974 enter.functions()->DecoderInitialized(instance, success, request_id); |
| 975 } |
| 976 |
| 955 void PPB_Instance_Proxy::OnHostMsgDeliverFrame( | 977 void PPB_Instance_Proxy::OnHostMsgDeliverFrame( |
| 956 PP_Instance instance, | 978 PP_Instance instance, |
| 957 PP_Resource decrypted_frame, | 979 PP_Resource decrypted_frame, |
| 958 const std::string& serialized_frame_info) { | 980 const std::string& serialized_frame_info) { |
| 959 PP_DecryptedFrameInfo frame_info; | 981 PP_DecryptedFrameInfo frame_info; |
| 960 if (!DeserializeBlockInfo(serialized_frame_info, &frame_info)) | 982 if (!DeserializeBlockInfo(serialized_frame_info, &frame_info)) |
| 961 return; | 983 return; |
| 962 | 984 |
| 963 EnterInstanceNoLock enter(instance); | 985 EnterInstanceNoLock enter(instance); |
| 964 if (enter.succeeded()) | 986 if (enter.succeeded()) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 PP_Instance instance) { | 1073 PP_Instance instance) { |
| 1052 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 1074 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
| 1053 GetInstanceData(instance); | 1075 GetInstanceData(instance); |
| 1054 if (!data) | 1076 if (!data) |
| 1055 return; // Instance was probably deleted. | 1077 return; // Instance was probably deleted. |
| 1056 data->should_do_request_surrounding_text = false; | 1078 data->should_do_request_surrounding_text = false; |
| 1057 } | 1079 } |
| 1058 | 1080 |
| 1059 } // namespace proxy | 1081 } // namespace proxy |
| 1060 } // namespace ppapi | 1082 } // namespace ppapi |
| OLD | NEW |