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 "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 "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/c/pp_time.h" | 10 #include "ppapi/c/pp_time.h" |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 dispatcher()->Send( | 668 dispatcher()->Send( |
669 new PpapiHostMsg_PPBInstance_DeliverFrame(API_ID_PPB_INSTANCE, | 669 new PpapiHostMsg_PPBInstance_DeliverFrame(API_ID_PPB_INSTANCE, |
670 instance, | 670 instance, |
671 host_resource, | 671 host_resource, |
672 serialized_frame_info)); | 672 serialized_frame_info)); |
673 } | 673 } |
674 | 674 |
675 void PPB_Instance_Proxy::DeliverSamples( | 675 void PPB_Instance_Proxy::DeliverSamples( |
676 PP_Instance instance, | 676 PP_Instance instance, |
677 PP_Resource decrypted_samples, | 677 PP_Resource decrypted_samples, |
678 const PP_DecryptedBlockInfo* block_info) { | 678 const PP_DecryptedSampleInfo* sample_info) { |
679 PP_Resource host_resource = 0; | 679 PP_Resource host_resource = 0; |
680 if (decrypted_samples != 0) { | 680 if (decrypted_samples != 0) { |
681 ResourceTracker* tracker = PpapiGlobals::Get()->GetResourceTracker(); | 681 ResourceTracker* tracker = PpapiGlobals::Get()->GetResourceTracker(); |
682 Resource* object = tracker->GetResource(decrypted_samples); | 682 Resource* object = tracker->GetResource(decrypted_samples); |
683 | 683 |
684 if (!object || object->pp_instance() != instance) { | 684 if (!object || object->pp_instance() != instance) { |
685 NOTREACHED(); | 685 NOTREACHED(); |
686 return; | 686 return; |
687 } | 687 } |
688 | 688 |
689 host_resource = object->host_resource().host_resource(); | 689 host_resource = object->host_resource().host_resource(); |
690 } | 690 } |
691 | 691 |
692 std::string serialized_block_info; | 692 std::string serialized_sample_info; |
693 if (!SerializeBlockInfo(*block_info, &serialized_block_info)) { | 693 if (!SerializeBlockInfo(*sample_info, &serialized_sample_info)) { |
694 NOTREACHED(); | 694 NOTREACHED(); |
695 return; | 695 return; |
696 } | 696 } |
697 | 697 |
698 dispatcher()->Send( | 698 dispatcher()->Send( |
699 new PpapiHostMsg_PPBInstance_DeliverSamples(API_ID_PPB_INSTANCE, | 699 new PpapiHostMsg_PPBInstance_DeliverSamples(API_ID_PPB_INSTANCE, |
700 instance, | 700 instance, |
701 host_resource, | 701 host_resource, |
702 serialized_block_info)); | 702 serialized_sample_info)); |
703 } | 703 } |
704 #endif // !defined(OS_NACL) | 704 #endif // !defined(OS_NACL) |
705 | 705 |
706 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, | 706 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, |
707 PP_Var message) { | 707 PP_Var message) { |
708 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( | 708 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( |
709 API_ID_PPB_INSTANCE, | 709 API_ID_PPB_INSTANCE, |
710 instance, SerializedVarSendInputShmem(dispatcher(), message, | 710 instance, SerializedVarSendInputShmem(dispatcher(), message, |
711 instance))); | 711 instance))); |
712 } | 712 } |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 return; | 1158 return; |
1159 | 1159 |
1160 EnterInstanceNoLock enter(instance); | 1160 EnterInstanceNoLock enter(instance); |
1161 if (enter.succeeded()) | 1161 if (enter.succeeded()) |
1162 enter.functions()->DeliverFrame(instance, decrypted_frame, &frame_info); | 1162 enter.functions()->DeliverFrame(instance, decrypted_frame, &frame_info); |
1163 } | 1163 } |
1164 | 1164 |
1165 void PPB_Instance_Proxy::OnHostMsgDeliverSamples( | 1165 void PPB_Instance_Proxy::OnHostMsgDeliverSamples( |
1166 PP_Instance instance, | 1166 PP_Instance instance, |
1167 PP_Resource audio_frames, | 1167 PP_Resource audio_frames, |
1168 const std::string& serialized_block_info) { | 1168 const std::string& serialized_sample_info) { |
1169 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | 1169 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
1170 return; | 1170 return; |
1171 PP_DecryptedBlockInfo block_info; | 1171 PP_DecryptedSampleInfo sample_info; |
1172 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) | 1172 if (!DeserializeBlockInfo(serialized_sample_info, &sample_info)) |
1173 return; | 1173 return; |
1174 | 1174 |
1175 EnterInstanceNoLock enter(instance); | 1175 EnterInstanceNoLock enter(instance); |
1176 if (enter.succeeded()) | 1176 if (enter.succeeded()) |
1177 enter.functions()->DeliverSamples(instance, audio_frames, &block_info); | 1177 enter.functions()->DeliverSamples(instance, audio_frames, &sample_info); |
1178 } | 1178 } |
1179 | 1179 |
1180 void PPB_Instance_Proxy::OnHostMsgSetCursor( | 1180 void PPB_Instance_Proxy::OnHostMsgSetCursor( |
1181 PP_Instance instance, | 1181 PP_Instance instance, |
1182 int32_t type, | 1182 int32_t type, |
1183 const ppapi::HostResource& custom_image, | 1183 const ppapi::HostResource& custom_image, |
1184 const PP_Point& hot_spot) { | 1184 const PP_Point& hot_spot) { |
1185 // This API serves PPB_CursorControl_Dev and PPB_MouseCursor, so is public. | 1185 // This API serves PPB_CursorControl_Dev and PPB_MouseCursor, so is public. |
1186 EnterInstanceNoLock enter(instance); | 1186 EnterInstanceNoLock enter(instance); |
1187 if (enter.succeeded()) { | 1187 if (enter.succeeded()) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 PP_Instance instance) { | 1263 PP_Instance instance) { |
1264 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 1264 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
1265 GetInstanceData(instance); | 1265 GetInstanceData(instance); |
1266 if (!data) | 1266 if (!data) |
1267 return; // Instance was probably deleted. | 1267 return; // Instance was probably deleted. |
1268 data->should_do_request_surrounding_text = false; | 1268 data->should_do_request_surrounding_text = false; |
1269 } | 1269 } |
1270 | 1270 |
1271 } // namespace proxy | 1271 } // namespace proxy |
1272 } // namespace ppapi | 1272 } // namespace ppapi |
OLD | NEW |