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