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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 API_ID_PPB_INSTANCE, | 578 API_ID_PPB_INSTANCE, |
579 instance, | 579 instance, |
580 decoder_type, | 580 decoder_type, |
581 request_id)); | 581 request_id)); |
582 } | 582 } |
583 | 583 |
584 // TODO(tomfinegan): Handle null decrypted_frame after landing other patches. | 584 // TODO(tomfinegan): Handle null decrypted_frame after landing other patches. |
585 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, | 585 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, |
586 PP_Resource decrypted_frame, | 586 PP_Resource decrypted_frame, |
587 const PP_DecryptedFrameInfo* frame_info) { | 587 const PP_DecryptedFrameInfo* frame_info) { |
588 Resource* object = | 588 PP_Resource host_resource = 0; |
589 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_frame); | 589 if (decrypted_frame != 0) { |
590 if (!object || object->pp_instance() != instance) | 590 ResourceTracker* tracker = PpapiGlobals::Get()->GetResourceTracker(); |
591 return; | 591 Resource* object = tracker->GetResource(decrypted_frame); |
| 592 |
| 593 if (!object || object->pp_instance() != instance) |
| 594 return; |
| 595 |
| 596 host_resource = object->host_resource().host_resource(); |
| 597 } |
592 | 598 |
593 std::string serialized_block_info; | 599 std::string serialized_block_info; |
594 if (!SerializeBlockInfo(*frame_info, &serialized_block_info)) | 600 if (!SerializeBlockInfo(*frame_info, &serialized_block_info)) |
595 return; | 601 return; |
596 | 602 |
597 dispatcher()->Send(new PpapiHostMsg_PPBInstance_DeliverFrame( | 603 dispatcher()->Send(new PpapiHostMsg_PPBInstance_DeliverFrame( |
598 API_ID_PPB_INSTANCE, | 604 API_ID_PPB_INSTANCE, |
599 instance, | 605 instance, |
600 object->host_resource().host_resource(), | 606 host_resource, |
601 serialized_block_info)); | 607 serialized_block_info)); |
602 } | 608 } |
603 | 609 |
604 // TODO(tomfinegan): Handle null audio_frames after landing other patches. | 610 // TODO(tomfinegan): Handle null audio_frames after landing other patches. |
605 void PPB_Instance_Proxy::DeliverSamples( | 611 void PPB_Instance_Proxy::DeliverSamples( |
606 PP_Instance instance, | 612 PP_Instance instance, |
607 PP_Resource audio_frames, | 613 PP_Resource decrypted_samples, |
608 const PP_DecryptedBlockInfo* block_info) { | 614 const PP_DecryptedBlockInfo* block_info) { |
609 Resource* object = | 615 PP_Resource host_resource = 0; |
610 PpapiGlobals::Get()->GetResourceTracker()->GetResource(audio_frames); | 616 if (decrypted_samples != 0) { |
611 if (!object || object->pp_instance() != instance) | 617 ResourceTracker* tracker = PpapiGlobals::Get()->GetResourceTracker(); |
612 return; | 618 Resource* object = tracker->GetResource(decrypted_samples); |
| 619 |
| 620 if (!object || object->pp_instance() != instance) |
| 621 return; |
| 622 |
| 623 host_resource = object->host_resource().host_resource(); |
| 624 } |
613 | 625 |
614 std::string serialized_block_info; | 626 std::string serialized_block_info; |
615 if (!SerializeBlockInfo(*block_info, &serialized_block_info)) | 627 if (!SerializeBlockInfo(*block_info, &serialized_block_info)) |
616 return; | 628 return; |
617 | 629 |
618 dispatcher()->Send( | 630 dispatcher()->Send( |
619 new PpapiHostMsg_PPBInstance_DeliverSamples( | 631 new PpapiHostMsg_PPBInstance_DeliverSamples( |
620 API_ID_PPB_INSTANCE, | 632 API_ID_PPB_INSTANCE, |
621 instance, | 633 instance, |
622 object->host_resource().host_resource(), | 634 host_resource, |
623 serialized_block_info)); | 635 serialized_block_info)); |
624 } | 636 } |
625 #endif // !defined(OS_NACL) | 637 #endif // !defined(OS_NACL) |
626 | 638 |
627 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, | 639 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, |
628 PP_Var message) { | 640 PP_Var message) { |
629 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( | 641 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( |
630 API_ID_PPB_INSTANCE, | 642 API_ID_PPB_INSTANCE, |
631 instance, SerializedVarSendInput(dispatcher(), message))); | 643 instance, SerializedVarSendInput(dispatcher(), message))); |
632 } | 644 } |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 PP_Instance instance) { | 1148 PP_Instance instance) { |
1137 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 1149 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
1138 GetInstanceData(instance); | 1150 GetInstanceData(instance); |
1139 if (!data) | 1151 if (!data) |
1140 return; // Instance was probably deleted. | 1152 return; // Instance was probably deleted. |
1141 data->should_do_request_surrounding_text = false; | 1153 data->should_do_request_surrounding_text = false; |
1142 } | 1154 } |
1143 | 1155 |
1144 } // namespace proxy | 1156 } // namespace proxy |
1145 } // namespace ppapi | 1157 } // namespace ppapi |
OLD | NEW |