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

Side by Side Diff: webkit/plugins/ppapi/ppb_buffer_impl.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 | « webkit/plugins/ppapi/ppb_buffer_impl.h ('k') | no next file » | 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 "webkit/plugins/ppapi/ppb_buffer_impl.h" 5 #include "webkit/plugins/ppapi/ppb_buffer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "ppapi/c/dev/ppb_buffer_dev.h" 11 #include "ppapi/c/dev/ppb_buffer_dev.h"
12 #include "ppapi/c/pp_instance.h" 12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_resource.h" 13 #include "ppapi/c/pp_resource.h"
14 #include "webkit/plugins/ppapi/common.h" 14 #include "webkit/plugins/ppapi/common.h"
15 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 15 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
16 #include "webkit/plugins/ppapi/resource_helper.h" 16 #include "webkit/plugins/ppapi/resource_helper.h"
17 17
18 using ::ppapi::thunk::PPB_Buffer_API; 18 using ::ppapi::thunk::PPB_Buffer_API;
19 using ::ppapi::thunk::PPB_BufferTrusted_API;
20 19
21 namespace webkit { 20 namespace webkit {
22 namespace ppapi { 21 namespace ppapi {
23 22
24 PPB_Buffer_Impl::PPB_Buffer_Impl(PP_Instance instance) 23 PPB_Buffer_Impl::PPB_Buffer_Impl(PP_Instance instance)
25 : Resource(::ppapi::OBJECT_IS_IMPL, instance), 24 : Resource(::ppapi::OBJECT_IS_IMPL, instance),
26 size_(0), 25 size_(0),
27 map_count_(0) { 26 map_count_(0) {
28 } 27 }
29 28
(...skipping 19 matching lines...) Expand all
49 } 48 }
50 49
51 PPB_Buffer_Impl* PPB_Buffer_Impl::AsPPB_Buffer_Impl() { 50 PPB_Buffer_Impl* PPB_Buffer_Impl::AsPPB_Buffer_Impl() {
52 return this; 51 return this;
53 } 52 }
54 53
55 PPB_Buffer_API* PPB_Buffer_Impl::AsPPB_Buffer_API() { 54 PPB_Buffer_API* PPB_Buffer_Impl::AsPPB_Buffer_API() {
56 return this; 55 return this;
57 } 56 }
58 57
59 PPB_BufferTrusted_API* PPB_Buffer_Impl::AsPPB_BufferTrusted_API() {
60 return this;
61 }
62
63 bool PPB_Buffer_Impl::Init(uint32_t size) { 58 bool PPB_Buffer_Impl::Init(uint32_t size) {
64 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); 59 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
65 if (size == 0 || !plugin_delegate) 60 if (size == 0 || !plugin_delegate)
66 return false; 61 return false;
67 size_ = size; 62 size_ = size;
68 shared_memory_.reset(plugin_delegate->CreateAnonymousSharedMemory(size)); 63 shared_memory_.reset(plugin_delegate->CreateAnonymousSharedMemory(size));
69 return shared_memory_.get() != NULL; 64 return shared_memory_.get() != NULL;
70 } 65 }
71 66
72 PP_Bool PPB_Buffer_Impl::Describe(uint32_t* size_in_bytes) { 67 PP_Bool PPB_Buffer_Impl::Describe(uint32_t* size_in_bytes) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 api->Describe(&size_); 104 api->Describe(&size_);
110 } 105 }
111 106
112 BufferAutoMapper::~BufferAutoMapper() { 107 BufferAutoMapper::~BufferAutoMapper() {
113 if (needs_unmap_) 108 if (needs_unmap_)
114 api_->Unmap(); 109 api_->Unmap();
115 } 110 }
116 111
117 } // namespace ppapi 112 } // namespace ppapi
118 } // namespace webkit 113 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_buffer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698