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/ppp_content_decryptor_private_proxy.h" | 5 #include "ppapi/proxy/ppp_content_decryptor_private_proxy.h" |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "media/base/limits.h" | 8 #include "media/base/limits.h" |
9 #include "ppapi/c/pp_bool.h" | 9 #include "ppapi/c/pp_bool.h" |
10 #include "ppapi/c/ppb_core.h" | 10 #include "ppapi/c/ppb_core.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // TODO(dmichael): Refactor so this handle sharing code is in one place. | 42 // TODO(dmichael): Refactor so this handle sharing code is in one place. |
43 PP_Bool ShareHostBufferResourceToPlugin( | 43 PP_Bool ShareHostBufferResourceToPlugin( |
44 HostDispatcher* dispatcher, | 44 HostDispatcher* dispatcher, |
45 PP_Resource resource, | 45 PP_Resource resource, |
46 base::SharedMemoryHandle* shared_mem_handle) { | 46 base::SharedMemoryHandle* shared_mem_handle) { |
47 if (!dispatcher || resource == 0 || !shared_mem_handle) | 47 if (!dispatcher || resource == 0 || !shared_mem_handle) |
48 return PP_FALSE; | 48 return PP_FALSE; |
49 EnterResourceNoLock<PPB_Buffer_API> enter(resource, true); | 49 EnterResourceNoLock<PPB_Buffer_API> enter(resource, true); |
50 if (enter.failed()) | 50 if (enter.failed()) |
51 return PP_FALSE; | 51 return PP_FALSE; |
52 int handle; | 52 base::SharedMemory* shm; |
53 int32_t result = enter.object()->GetSharedMemory(&handle); | 53 int32_t result = enter.object()->GetSharedMemory(&shm); |
54 if (result != PP_OK) | 54 if (result != PP_OK) |
55 return PP_FALSE; | 55 return PP_FALSE; |
56 base::PlatformFile platform_file = | |
57 #if defined(OS_WIN) | |
58 reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle)); | |
59 #elif defined(OS_POSIX) | |
60 handle; | |
61 #else | |
62 #error Not implemented. | |
63 #endif | |
64 | 56 |
65 *shared_mem_handle = dispatcher->ShareHandleWithRemote(platform_file, false); | 57 *shared_mem_handle = |
| 58 dispatcher->ShareSharedMemoryHandleWithRemote(shm->handle()); |
66 return PP_TRUE; | 59 return PP_TRUE; |
67 } | 60 } |
68 | 61 |
69 // SerializedVarReceiveInput will decrement the reference count, but we want | 62 // SerializedVarReceiveInput will decrement the reference count, but we want |
70 // to give the recipient a reference. This utility function takes care of that | 63 // to give the recipient a reference. This utility function takes care of that |
71 // work for the message handlers defined below. | 64 // work for the message handlers defined below. |
72 PP_Var ExtractReceivedVarAndAddRef(Dispatcher* dispatcher, | 65 PP_Var ExtractReceivedVarAndAddRef(Dispatcher* dispatcher, |
73 SerializedVarReceiveInput* serialized_var) { | 66 SerializedVarReceiveInput* serialized_var) { |
74 PP_Var var = serialized_var->Get(dispatcher); | 67 PP_Var var = serialized_var->Get(dispatcher); |
75 PpapiGlobals::Get()->GetVarTracker()->AddRefVar(var); | 68 PpapiGlobals::Get()->GetVarTracker()->AddRefVar(var); |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 ppp_decryptor_impl_->DecryptAndDecode, | 732 ppp_decryptor_impl_->DecryptAndDecode, |
740 instance, | 733 instance, |
741 decoder_type, | 734 decoder_type, |
742 plugin_resource.get(), | 735 plugin_resource.get(), |
743 &block_info); | 736 &block_info); |
744 } | 737 } |
745 } | 738 } |
746 | 739 |
747 } // namespace proxy | 740 } // namespace proxy |
748 } // namespace ppapi | 741 } // namespace ppapi |
OLD | NEW |