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

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

Issue 7623018: Move host resource from the proxy to the shared_impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed 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
« no previous file with comments | « ppapi/proxy/ppb_buffer_proxy.h ('k') | ppapi/proxy/ppb_context_3d_proxy.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) 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/ppapi_messages.h" 17 #include "ppapi/proxy/ppapi_messages.h"
18 #include "ppapi/thunk/enter.h" 18 #include "ppapi/thunk/enter.h"
19 #include "ppapi/thunk/ppb_buffer_trusted_api.h" 19 #include "ppapi/thunk/ppb_buffer_trusted_api.h"
20 #include "ppapi/thunk/thunk.h" 20 #include "ppapi/thunk/thunk.h"
21 21
22 using ppapi::HostResource;
23
22 namespace pp { 24 namespace pp {
23 namespace proxy { 25 namespace proxy {
24 26
25 namespace { 27 namespace {
26 28
27 InterfaceProxy* CreateBufferProxy(Dispatcher* dispatcher, 29 InterfaceProxy* CreateBufferProxy(Dispatcher* dispatcher,
28 const void* target_interface) { 30 const void* target_interface) {
29 return new PPB_Buffer_Proxy(dispatcher, target_interface); 31 return new PPB_Buffer_Proxy(dispatcher, target_interface);
30 } 32 }
31 33
32 } // namespace 34 } // namespace
33 35
34 Buffer::Buffer(const HostResource& resource, 36 Buffer::Buffer(const HostResource& resource,
35 const base::SharedMemoryHandle& shm_handle, 37 const base::SharedMemoryHandle& shm_handle,
36 uint32_t size) 38 uint32_t size)
37 : PluginResource(resource), 39 : PluginResource(resource),
38 shm_(shm_handle, false), 40 shm_(shm_handle, false),
39 size_(size), 41 size_(size),
40 mapped_data_(NULL), 42 mapped_data_(NULL),
41 map_count_(0) { 43 map_count_(0) {
42 } 44 }
43 45
44 Buffer::~Buffer() { 46 Buffer::~Buffer() {
45 Unmap(); 47 Unmap();
46 } 48 }
47 49
48 Buffer* Buffer::AsBuffer() {
49 return this;
50 }
51
52 ppapi::thunk::PPB_Buffer_API* Buffer::AsPPB_Buffer_API() { 50 ppapi::thunk::PPB_Buffer_API* Buffer::AsPPB_Buffer_API() {
53 return this; 51 return this;
54 } 52 }
55 53
56 PP_Bool Buffer::Describe(uint32_t* size_in_bytes) { 54 PP_Bool Buffer::Describe(uint32_t* size_in_bytes) {
57 *size_in_bytes = size_; 55 *size_in_bytes = size_;
58 return PP_TRUE; 56 return PP_TRUE;
59 } 57 }
60 58
61 PP_Bool Buffer::IsMapped() { 59 PP_Bool Buffer::IsMapped() {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 #elif defined(OS_POSIX) 160 #elif defined(OS_POSIX)
163 local_fd; 161 local_fd;
164 #else 162 #else
165 #error Not implemented. 163 #error Not implemented.
166 #endif 164 #endif
167 *result_shm_handle = dispatcher->ShareHandleWithRemote(platform_file, false); 165 *result_shm_handle = dispatcher->ShareHandleWithRemote(platform_file, false);
168 } 166 }
169 167
170 } // namespace proxy 168 } // namespace proxy
171 } // namespace pp 169 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_buffer_proxy.h ('k') | ppapi/proxy/ppb_context_3d_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698