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

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

Issue 7545014: Implement PPAPI VideoDecode out-of-process support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_buffer_proxy.h" 5 #include "ppapi/proxy/ppb_buffer_proxy.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "ppapi/c/pp_completion_callback.h" 11 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_errors.h" 12 #include "ppapi/c/pp_errors.h"
13 #include "ppapi/c/pp_resource.h" 13 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/c/dev/ppb_buffer_dev.h" 14 #include "ppapi/c/dev/ppb_buffer_dev.h"
15 #include "ppapi/proxy/host_dispatcher.h" 15 #include "ppapi/proxy/host_dispatcher.h"
16 #include "ppapi/proxy/plugin_dispatcher.h" 16 #include "ppapi/proxy/plugin_dispatcher.h"
17 #include "ppapi/proxy/plugin_resource.h"
18 #include "ppapi/proxy/ppapi_messages.h" 17 #include "ppapi/proxy/ppapi_messages.h"
19 #include "ppapi/thunk/enter.h" 18 #include "ppapi/thunk/enter.h"
20 #include "ppapi/thunk/ppb_buffer_api.h"
21 #include "ppapi/thunk/ppb_buffer_trusted_api.h" 19 #include "ppapi/thunk/ppb_buffer_trusted_api.h"
22 #include "ppapi/thunk/thunk.h" 20 #include "ppapi/thunk/thunk.h"
23 21
24 namespace pp { 22 namespace pp {
25 namespace proxy { 23 namespace proxy {
26 24
27 namespace { 25 namespace {
28 26
29 InterfaceProxy* CreateBufferProxy(Dispatcher* dispatcher, 27 InterfaceProxy* CreateBufferProxy(Dispatcher* dispatcher,
30 const void* target_interface) { 28 const void* target_interface) {
31 return new PPB_Buffer_Proxy(dispatcher, target_interface); 29 return new PPB_Buffer_Proxy(dispatcher, target_interface);
32 } 30 }
33 31
34 } // namespace 32 } // namespace
35 33
36 class Buffer : public ppapi::thunk::PPB_Buffer_API,
37 public PluginResource {
38 public:
39 Buffer(const HostResource& resource,
40 const base::SharedMemoryHandle& shm_handle,
41 uint32_t size);
42 virtual ~Buffer();
43
44 // Resource overrides.
45 virtual Buffer* AsBuffer() OVERRIDE;
46
47 // ResourceObjectBase overrides.
48 virtual ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() OVERRIDE;
49
50 // PPB_Buffer_API implementation.
51 virtual PP_Bool Describe(uint32_t* size_in_bytes) OVERRIDE;
52 virtual PP_Bool IsMapped() OVERRIDE;
53 virtual void* Map() OVERRIDE;
54 virtual void Unmap() OVERRIDE;
55
56 private:
57 base::SharedMemory shm_;
58 uint32_t size_;
59 void* mapped_data_;
60 int map_count_;
61
62 DISALLOW_COPY_AND_ASSIGN(Buffer);
63 };
64
65 Buffer::Buffer(const HostResource& resource, 34 Buffer::Buffer(const HostResource& resource,
66 const base::SharedMemoryHandle& shm_handle, 35 const base::SharedMemoryHandle& shm_handle,
67 uint32_t size) 36 uint32_t size)
68 : PluginResource(resource), 37 : PluginResource(resource),
69 shm_(shm_handle, false), 38 shm_(shm_handle, false),
70 size_(size), 39 size_(size),
71 mapped_data_(NULL), 40 mapped_data_(NULL),
72 map_count_(0) { 41 map_count_(0) {
73 } 42 }
74 43
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 #elif defined(OS_POSIX) 154 #elif defined(OS_POSIX)
186 local_fd; 155 local_fd;
187 #else 156 #else
188 #error Not implemented. 157 #error Not implemented.
189 #endif 158 #endif
190 *result_shm_handle = dispatcher->ShareHandleWithRemote(platform_file, false); 159 *result_shm_handle = dispatcher->ShareHandleWithRemote(platform_file, false);
191 } 160 }
192 161
193 } // namespace proxy 162 } // namespace proxy
194 } // namespace pp 163 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698