OLD | NEW |
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 "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; | 19 using ::ppapi::thunk::PPB_BufferTrusted_API; |
20 | 20 |
21 namespace webkit { | 21 namespace webkit { |
22 namespace ppapi { | 22 namespace ppapi { |
23 | 23 |
24 PPB_Buffer_Impl::PPB_Buffer_Impl(PP_Instance instance) | 24 PPB_Buffer_Impl::PPB_Buffer_Impl(PP_Instance instance) |
25 : Resource(instance), | 25 : Resource(::ppapi::OBJECT_IS_IMPL, instance), |
26 size_(0), | 26 size_(0), |
27 map_count_(0) { | 27 map_count_(0) { |
28 } | 28 } |
29 | 29 |
30 PPB_Buffer_Impl::~PPB_Buffer_Impl() { | 30 PPB_Buffer_Impl::~PPB_Buffer_Impl() { |
31 } | 31 } |
32 | 32 |
33 // static | 33 // static |
34 PP_Resource PPB_Buffer_Impl::Create(PP_Instance instance, uint32_t size) { | 34 PP_Resource PPB_Buffer_Impl::Create(PP_Instance instance, uint32_t size) { |
35 scoped_refptr<PPB_Buffer_Impl> buffer(new PPB_Buffer_Impl(instance)); | 35 scoped_refptr<PPB_Buffer_Impl> buffer(new PPB_Buffer_Impl(instance)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 api->Describe(&size_); | 99 api->Describe(&size_); |
100 } | 100 } |
101 | 101 |
102 BufferAutoMapper::~BufferAutoMapper() { | 102 BufferAutoMapper::~BufferAutoMapper() { |
103 if (needs_unmap_) | 103 if (needs_unmap_) |
104 api_->Unmap(); | 104 api_->Unmap(); |
105 } | 105 } |
106 | 106 |
107 } // namespace ppapi | 107 } // namespace ppapi |
108 } // namespace webkit | 108 } // namespace webkit |
OLD | NEW |