Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: ppapi/proxy/ppp_content_decryptor_private_proxy.cc

Issue 12702011: Pepper: Unify Buffer and BufferTrusted APIs. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove proxy implementation of GetSharedMemory. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ppapi/proxy/ppb_buffer_proxy.cc ('k') | ppapi/shared_impl/resource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/platform_file.h" 7 #include "base/platform_file.h"
8 #include "ppapi/c/pp_bool.h" 8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/ppb_core.h" 9 #include "ppapi/c/ppb_core.h"
10 #include "ppapi/proxy/content_decryptor_private_serializer.h" 10 #include "ppapi/proxy/content_decryptor_private_serializer.h"
11 #include "ppapi/proxy/host_dispatcher.h" 11 #include "ppapi/proxy/host_dispatcher.h"
12 #include "ppapi/proxy/plugin_globals.h" 12 #include "ppapi/proxy/plugin_globals.h"
13 #include "ppapi/proxy/plugin_resource_tracker.h" 13 #include "ppapi/proxy/plugin_resource_tracker.h"
14 #include "ppapi/proxy/ppapi_messages.h" 14 #include "ppapi/proxy/ppapi_messages.h"
15 #include "ppapi/proxy/ppb_buffer_proxy.h" 15 #include "ppapi/proxy/ppb_buffer_proxy.h"
16 #include "ppapi/proxy/serialized_var.h" 16 #include "ppapi/proxy/serialized_var.h"
17 #include "ppapi/shared_impl/scoped_pp_resource.h" 17 #include "ppapi/shared_impl/scoped_pp_resource.h"
18 #include "ppapi/shared_impl/var_tracker.h" 18 #include "ppapi/shared_impl/var_tracker.h"
19 #include "ppapi/thunk/enter.h" 19 #include "ppapi/thunk/enter.h"
20 #include "ppapi/thunk/ppb_buffer_api.h" 20 #include "ppapi/thunk/ppb_buffer_api.h"
21 #include "ppapi/thunk/ppb_buffer_trusted_api.h"
22 #include "ppapi/thunk/ppb_instance_api.h" 21 #include "ppapi/thunk/ppb_instance_api.h"
23 #include "ppapi/thunk/thunk.h" 22 #include "ppapi/thunk/thunk.h"
24 23
25 using ppapi::thunk::EnterResourceNoLock; 24 using ppapi::thunk::EnterResourceNoLock;
26 using ppapi::thunk::PPB_Buffer_API; 25 using ppapi::thunk::PPB_Buffer_API;
27 using ppapi::thunk::PPB_BufferTrusted_API;
28 using ppapi::thunk::PPB_Instance_API; 26 using ppapi::thunk::PPB_Instance_API;
29 27
30 namespace ppapi { 28 namespace ppapi {
31 namespace proxy { 29 namespace proxy {
32 30
33 namespace { 31 namespace {
34 32
35 PP_Bool DescribeHostBufferResource(PP_Resource resource, uint32_t* size) { 33 PP_Bool DescribeHostBufferResource(PP_Resource resource, uint32_t* size) {
36 EnterResourceNoLock<PPB_Buffer_API> enter(resource, true); 34 EnterResourceNoLock<PPB_Buffer_API> enter(resource, true);
37 if (enter.failed()) 35 if (enter.failed())
38 return PP_FALSE; 36 return PP_FALSE;
39 return enter.object()->Describe(size); 37 return enter.object()->Describe(size);
40 } 38 }
41 39
42 // TODO(dmichael): Refactor so this handle sharing code is in one place. 40 // TODO(dmichael): Refactor so this handle sharing code is in one place.
43 PP_Bool ShareHostBufferResourceToPlugin( 41 PP_Bool ShareHostBufferResourceToPlugin(
44 HostDispatcher* dispatcher, 42 HostDispatcher* dispatcher,
45 PP_Resource resource, 43 PP_Resource resource,
46 base::SharedMemoryHandle* shared_mem_handle) { 44 base::SharedMemoryHandle* shared_mem_handle) {
47 if (!dispatcher || resource == 0 || !shared_mem_handle) 45 if (!dispatcher || resource == 0 || !shared_mem_handle)
48 return PP_FALSE; 46 return PP_FALSE;
49 EnterResourceNoLock<PPB_BufferTrusted_API> enter(resource, true); 47 EnterResourceNoLock<PPB_Buffer_API> enter(resource, true);
50 if (enter.failed()) 48 if (enter.failed())
51 return PP_FALSE; 49 return PP_FALSE;
52 int handle; 50 int handle;
53 int32_t result = enter.object()->GetSharedMemory(&handle); 51 int32_t result = enter.object()->GetSharedMemory(&handle);
54 if (result != PP_OK) 52 if (result != PP_OK)
55 return PP_FALSE; 53 return PP_FALSE;
56 base::PlatformFile platform_file = 54 base::PlatformFile platform_file =
57 #if defined(OS_WIN) 55 #if defined(OS_WIN)
58 reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle)); 56 reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle));
59 #elif defined(OS_POSIX) 57 #elif defined(OS_POSIX)
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 ppp_decryptor_impl_->DecryptAndDecode, 572 ppp_decryptor_impl_->DecryptAndDecode,
575 instance, 573 instance,
576 decoder_type, 574 decoder_type,
577 plugin_resource.get(), 575 plugin_resource.get(),
578 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); 576 const_cast<const PP_EncryptedBlockInfo*>(&block_info));
579 } 577 }
580 } 578 }
581 579
582 } // namespace proxy 580 } // namespace proxy
583 } // namespace ppapi 581 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_buffer_proxy.cc ('k') | ppapi/shared_impl/resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698