| 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" |
| 11 #include "ppapi/c/ppb_instance.h" | 11 #include "ppapi/c/ppb_instance.h" |
| 12 #include "ppapi/c/ppb_messaging.h" | 12 #include "ppapi/c/ppb_messaging.h" |
| 13 #include "ppapi/c/ppb_mouse_lock.h" | 13 #include "ppapi/c/ppb_mouse_lock.h" |
| 14 #include "ppapi/c/private/pp_content_decryptor.h" |
| 15 #include "ppapi/proxy/content_decryptor_private_serializer-inl.h" |
| 14 #include "ppapi/proxy/enter_proxy.h" | 16 #include "ppapi/proxy/enter_proxy.h" |
| 15 #include "ppapi/proxy/host_dispatcher.h" | 17 #include "ppapi/proxy/host_dispatcher.h" |
| 16 #include "ppapi/proxy/plugin_dispatcher.h" | 18 #include "ppapi/proxy/plugin_dispatcher.h" |
| 17 #include "ppapi/proxy/plugin_proxy_delegate.h" | 19 #include "ppapi/proxy/plugin_proxy_delegate.h" |
| 18 #include "ppapi/proxy/ppapi_messages.h" | 20 #include "ppapi/proxy/ppapi_messages.h" |
| 19 #include "ppapi/proxy/ppb_flash_proxy.h" | 21 #include "ppapi/proxy/ppb_flash_proxy.h" |
| 20 #include "ppapi/proxy/serialized_var.h" | 22 #include "ppapi/proxy/serialized_var.h" |
| 21 #include "ppapi/shared_impl/ppapi_globals.h" | 23 #include "ppapi/shared_impl/ppapi_globals.h" |
| 22 #include "ppapi/shared_impl/ppb_url_util_shared.h" | 24 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
| 23 #include "ppapi/shared_impl/ppb_view_shared.h" | 25 #include "ppapi/shared_impl/ppb_view_shared.h" |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 API_ID_PPB_INSTANCE, | 468 API_ID_PPB_INSTANCE, |
| 467 instance, | 469 instance, |
| 468 SerializedVarSendInput(dispatcher(), key_system), | 470 SerializedVarSendInput(dispatcher(), key_system), |
| 469 SerializedVarSendInput(dispatcher(), session_id), | 471 SerializedVarSendInput(dispatcher(), session_id), |
| 470 media_error, | 472 media_error, |
| 471 system_code)); | 473 system_code)); |
| 472 } | 474 } |
| 473 | 475 |
| 474 void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance, | 476 void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance, |
| 475 PP_Resource decrypted_block, | 477 PP_Resource decrypted_block, |
| 476 int32_t request_id) { | 478 const PP_DecryptedBlockInfo* block_info) { |
| 477 Resource* object = | 479 Resource* object = |
| 478 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_block); | 480 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_block); |
| 479 if (!object || object->pp_instance() != instance) | 481 if (!object || object->pp_instance() != instance) |
| 480 return; | 482 return; |
| 483 |
| 484 std::string serialized_block_info; |
| 485 if (!SerializeBlockInfo(block_info, &serialized_block_info)) |
| 486 return; |
| 487 |
| 481 dispatcher()->Send( | 488 dispatcher()->Send( |
| 482 new PpapiHostMsg_PPBInstance_DeliverBlock(API_ID_PPB_INSTANCE, | 489 new PpapiHostMsg_PPBInstance_DeliverBlock(API_ID_PPB_INSTANCE, |
| 483 instance, | 490 instance, |
| 484 object->host_resource().host_resource(), | 491 object->host_resource().host_resource(), |
| 485 request_id)); | 492 serialized_block_info)); |
| 486 } | 493 } |
| 487 | 494 |
| 488 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, | 495 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, |
| 489 PP_Resource decrypted_frame, | 496 PP_Resource decrypted_frame, |
| 490 int32_t request_id) { | 497 const PP_DecryptedBlockInfo* block_info) { |
| 491 Resource* object = | 498 Resource* object = |
| 492 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_frame); | 499 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_frame); |
| 493 if (!object || object->pp_instance() != instance) | 500 if (!object || object->pp_instance() != instance) |
| 494 return; | 501 return; |
| 502 |
| 503 std::string serialized_block_info; |
| 504 if (!SerializeBlockInfo(block_info, &serialized_block_info)) |
| 505 return; |
| 506 |
| 495 dispatcher()->Send(new PpapiHostMsg_PPBInstance_DeliverFrame( | 507 dispatcher()->Send(new PpapiHostMsg_PPBInstance_DeliverFrame( |
| 496 API_ID_PPB_INSTANCE, | 508 API_ID_PPB_INSTANCE, |
| 497 instance, | 509 instance, |
| 498 object->host_resource().host_resource(), | 510 object->host_resource().host_resource(), |
| 499 request_id)); | 511 serialized_block_info)); |
| 500 } | 512 } |
| 501 | 513 |
| 502 void PPB_Instance_Proxy::DeliverSamples(PP_Instance instance, | 514 void PPB_Instance_Proxy::DeliverSamples( |
| 503 PP_Resource decrypted_samples, | 515 PP_Instance instance, |
| 504 int32_t request_id) { | 516 PP_Resource decrypted_samples, |
| 517 const PP_DecryptedBlockInfo* block_info) { |
| 505 Resource* object = | 518 Resource* object = |
| 506 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_samples); | 519 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_samples); |
| 507 if (!object || object->pp_instance() != instance) | 520 if (!object || object->pp_instance() != instance) |
| 508 return; | 521 return; |
| 522 |
| 523 std::string serialized_block_info; |
| 524 if (!SerializeBlockInfo(block_info, &serialized_block_info)) |
| 525 return; |
| 526 |
| 509 dispatcher()->Send( | 527 dispatcher()->Send( |
| 510 new PpapiHostMsg_PPBInstance_DeliverSamples( | 528 new PpapiHostMsg_PPBInstance_DeliverSamples( |
| 511 API_ID_PPB_INSTANCE, | 529 API_ID_PPB_INSTANCE, |
| 512 instance, | 530 instance, |
| 513 object->host_resource().host_resource(), | 531 object->host_resource().host_resource(), |
| 514 request_id)); | 532 serialized_block_info)); |
| 515 } | 533 } |
| 516 | 534 |
| 517 #endif // !defined(OS_NACL) | 535 #endif // !defined(OS_NACL) |
| 518 | 536 |
| 519 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, | 537 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, |
| 520 PP_Var message) { | 538 PP_Var message) { |
| 521 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( | 539 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( |
| 522 API_ID_PPB_INSTANCE, | 540 API_ID_PPB_INSTANCE, |
| 523 instance, SerializedVarSendInput(dispatcher(), message))); | 541 instance, SerializedVarSendInput(dispatcher(), message))); |
| 524 } | 542 } |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 EnterInstanceNoLock enter(instance); | 916 EnterInstanceNoLock enter(instance); |
| 899 if (enter.succeeded()) { | 917 if (enter.succeeded()) { |
| 900 enter.functions()->KeyError(instance, | 918 enter.functions()->KeyError(instance, |
| 901 key_system.Get(dispatcher()), | 919 key_system.Get(dispatcher()), |
| 902 session_id.Get(dispatcher()), | 920 session_id.Get(dispatcher()), |
| 903 media_error, | 921 media_error, |
| 904 system_error); | 922 system_error); |
| 905 } | 923 } |
| 906 } | 924 } |
| 907 | 925 |
| 908 void PPB_Instance_Proxy::OnHostMsgDeliverBlock(PP_Instance instance, | 926 void PPB_Instance_Proxy::OnHostMsgDeliverBlock( |
| 909 PP_Resource decrypted_block, | 927 PP_Instance instance, |
| 910 int32_t request_id) { | 928 PP_Resource decrypted_block, |
| 929 const std::string& serialized_block_info) { |
| 930 PP_DecryptedBlockInfo block_info; |
| 931 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
| 932 return; |
| 933 |
| 911 EnterInstanceNoLock enter(instance); | 934 EnterInstanceNoLock enter(instance); |
| 912 if (enter.succeeded()) | 935 if (enter.succeeded()) |
| 913 enter.functions()->DeliverBlock(instance, decrypted_block, request_id); | 936 enter.functions()->DeliverBlock(instance, decrypted_block, &block_info); |
| 914 } | 937 } |
| 915 | 938 |
| 916 void PPB_Instance_Proxy::OnHostMsgDeliverFrame(PP_Instance instance, | 939 void PPB_Instance_Proxy::OnHostMsgDeliverFrame( |
| 917 PP_Resource decrypted_frame, | 940 PP_Instance instance, |
| 918 int32_t request_id) { | 941 PP_Resource decrypted_frame, |
| 942 const std::string& serialized_block_info) { |
| 943 PP_DecryptedBlockInfo block_info; |
| 944 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
| 945 return; |
| 946 |
| 919 EnterInstanceNoLock enter(instance); | 947 EnterInstanceNoLock enter(instance); |
| 920 if (enter.succeeded()) | 948 if (enter.succeeded()) |
| 921 enter.functions()->DeliverFrame(instance, decrypted_frame, request_id); | 949 enter.functions()->DeliverFrame(instance, decrypted_frame, &block_info); |
| 922 } | 950 } |
| 923 | 951 |
| 924 void PPB_Instance_Proxy::OnHostMsgDeliverSamples(PP_Instance instance, | 952 void PPB_Instance_Proxy::OnHostMsgDeliverSamples( |
| 925 PP_Resource decrypted_samples, | 953 PP_Instance instance, |
| 926 int32_t request_id) { | 954 PP_Resource decrypted_samples, |
| 955 const std::string& serialized_block_info) { |
| 956 PP_DecryptedBlockInfo block_info; |
| 957 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
| 958 return; |
| 959 |
| 927 EnterInstanceNoLock enter(instance); | 960 EnterInstanceNoLock enter(instance); |
| 928 if (enter.succeeded()) | 961 if (enter.succeeded()) |
| 929 enter.functions()->DeliverSamples(instance, decrypted_samples, request_id); | 962 enter.functions()->DeliverSamples(instance, decrypted_samples, &block_info); |
| 930 } | 963 } |
| 931 | 964 |
| 932 #endif // !defined(OS_NACL) | 965 #endif // !defined(OS_NACL) |
| 933 | 966 |
| 934 void PPB_Instance_Proxy::OnHostMsgSetCursor( | 967 void PPB_Instance_Proxy::OnHostMsgSetCursor( |
| 935 PP_Instance instance, | 968 PP_Instance instance, |
| 936 int32_t type, | 969 int32_t type, |
| 937 const ppapi::HostResource& custom_image, | 970 const ppapi::HostResource& custom_image, |
| 938 const PP_Point& hot_spot) { | 971 const PP_Point& hot_spot) { |
| 939 EnterInstanceNoLock enter(instance); | 972 EnterInstanceNoLock enter(instance); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 } | 1026 } |
| 994 | 1027 |
| 995 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, | 1028 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, |
| 996 PP_Instance instance) { | 1029 PP_Instance instance) { |
| 997 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( | 1030 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( |
| 998 API_ID_PPB_INSTANCE, instance, result)); | 1031 API_ID_PPB_INSTANCE, instance, result)); |
| 999 } | 1032 } |
| 1000 | 1033 |
| 1001 } // namespace proxy | 1034 } // namespace proxy |
| 1002 } // namespace ppapi | 1035 } // namespace ppapi |
| OLD | NEW |