OLD | NEW |
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" |
(...skipping 14 matching lines...) Expand all Loading... |
25 size_(0), | 25 size_(0), |
26 map_count_(0) { | 26 map_count_(0) { |
27 } | 27 } |
28 | 28 |
29 PPB_Buffer_Impl::~PPB_Buffer_Impl() { | 29 PPB_Buffer_Impl::~PPB_Buffer_Impl() { |
30 } | 30 } |
31 | 31 |
32 // static | 32 // static |
33 PP_Resource PPB_Buffer_Impl::Create(PP_Instance instance, uint32_t size) { | 33 PP_Resource PPB_Buffer_Impl::Create(PP_Instance instance, uint32_t size) { |
34 scoped_refptr<PPB_Buffer_Impl> new_resource(CreateResource(instance, size)); | 34 scoped_refptr<PPB_Buffer_Impl> new_resource(CreateResource(instance, size)); |
35 if (new_resource) | 35 if (new_resource.get()) |
36 return new_resource->GetReference(); | 36 return new_resource->GetReference(); |
37 return 0; | 37 return 0; |
38 } | 38 } |
39 | 39 |
40 // static | 40 // static |
41 scoped_refptr<PPB_Buffer_Impl> PPB_Buffer_Impl::CreateResource( | 41 scoped_refptr<PPB_Buffer_Impl> PPB_Buffer_Impl::CreateResource( |
42 PP_Instance instance, | 42 PP_Instance instance, |
43 uint32_t size) { | 43 uint32_t size) { |
44 scoped_refptr<PPB_Buffer_Impl> buffer(new PPB_Buffer_Impl(instance)); | 44 scoped_refptr<PPB_Buffer_Impl> buffer(new PPB_Buffer_Impl(instance)); |
45 if (!buffer->Init(size)) | 45 if (!buffer->Init(size)) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 api->Describe(&size_); | 104 api->Describe(&size_); |
105 } | 105 } |
106 | 106 |
107 BufferAutoMapper::~BufferAutoMapper() { | 107 BufferAutoMapper::~BufferAutoMapper() { |
108 if (needs_unmap_) | 108 if (needs_unmap_) |
109 api_->Unmap(); | 109 api_->Unmap(); |
110 } | 110 } |
111 | 111 |
112 } // namespace ppapi | 112 } // namespace ppapi |
113 } // namespace webkit | 113 } // namespace webkit |
OLD | NEW |