OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/glue/plugins/pepper_buffer.h" | 5 #include "webkit/glue/plugins/pepper_buffer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 Buffer::~Buffer() { | 76 Buffer::~Buffer() { |
77 } | 77 } |
78 | 78 |
79 // static | 79 // static |
80 const PPB_Buffer_Dev* Buffer::GetInterface() { | 80 const PPB_Buffer_Dev* Buffer::GetInterface() { |
81 return &ppb_buffer; | 81 return &ppb_buffer; |
82 } | 82 } |
83 | 83 |
| 84 Buffer* Buffer::AsBuffer() { return this; } |
| 85 |
84 bool Buffer::Init(uint32_t size) { | 86 bool Buffer::Init(uint32_t size) { |
85 if (size == 0) | 87 if (size == 0) |
86 return false; | 88 return false; |
87 Unmap(); | 89 Unmap(); |
88 size_ = size; | 90 size_ = size; |
89 return true; | 91 return true; |
90 } | 92 } |
91 | 93 |
92 void Buffer::Describe(uint32_t* size_in_bytes) const { | 94 void Buffer::Describe(uint32_t* size_in_bytes) const { |
93 *size_in_bytes = size_; | 95 *size_in_bytes = size_; |
(...skipping 14 matching lines...) Expand all Loading... |
108 mem_buffer_.reset(); | 110 mem_buffer_.reset(); |
109 } | 111 } |
110 | 112 |
111 void Buffer::Swap(Buffer* other) { | 113 void Buffer::Swap(Buffer* other) { |
112 swap(other->mem_buffer_, mem_buffer_); | 114 swap(other->mem_buffer_, mem_buffer_); |
113 std::swap(other->size_, size_); | 115 std::swap(other->size_, size_); |
114 } | 116 } |
115 | 117 |
116 } // namespace pepper | 118 } // namespace pepper |
117 | 119 |
OLD | NEW |