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

Unified Diff: webkit/plugins/ppapi/ppb_buffer_impl.cc

Issue 5828003: Move the Pepper implementation from webkit/glue/plugins/pepper_* to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/ppapi/ppb_buffer_impl.h ('k') | webkit/plugins/ppapi/ppb_char_set_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_buffer_impl.cc
===================================================================
--- webkit/plugins/ppapi/ppb_buffer_impl.cc (revision 0)
+++ webkit/plugins/ppapi/ppb_buffer_impl.cc (working copy)
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/glue/plugins/pepper_buffer.h"
+#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
#include <algorithm>
@@ -12,11 +12,12 @@
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_resource.h"
-#include "webkit/glue/plugins/pepper_common.h"
-#include "webkit/glue/plugins/pepper_plugin_instance.h"
-#include "webkit/glue/plugins/pepper_plugin_module.h"
+#include "webkit/plugins/ppapi/common.h"
+#include "webkit/plugins/ppapi/plugin_instance.h"
+#include "webkit/plugins/ppapi/plugin_module.h"
-namespace pepper {
+namespace webkit {
+namespace ppapi {
namespace {
@@ -25,19 +26,20 @@
if (!module)
return 0;
- scoped_refptr<Buffer> buffer(new Buffer(module));
+ scoped_refptr<PPB_Buffer_Impl> buffer(new PPB_Buffer_Impl(module));
if (!buffer->Init(size))
return 0;
return buffer->GetReference();
}
-PP_Bool IsBuffer(PP_Resource resource) {
- return BoolToPPBool(!!Resource::GetAs<Buffer>(resource));
+PP_Bool IsPPB_Buffer_Impl(PP_Resource resource) {
+ return BoolToPPBool(!!Resource::GetAs<PPB_Buffer_Impl>(resource));
}
PP_Bool Describe(PP_Resource resource, uint32_t* size_in_bytes) {
- scoped_refptr<Buffer> buffer(Resource::GetAs<Buffer>(resource));
+ scoped_refptr<PPB_Buffer_Impl> buffer(
+ Resource::GetAs<PPB_Buffer_Impl>(resource));
if (!buffer)
return PP_FALSE;
buffer->Describe(size_in_bytes);
@@ -45,14 +47,16 @@
}
void* Map(PP_Resource resource) {
- scoped_refptr<Buffer> buffer(Resource::GetAs<Buffer>(resource));
+ scoped_refptr<PPB_Buffer_Impl> buffer(
+ Resource::GetAs<PPB_Buffer_Impl>(resource));
if (!buffer)
return NULL;
return buffer->Map();
}
void Unmap(PP_Resource resource) {
- scoped_refptr<Buffer> buffer(Resource::GetAs<Buffer>(resource));
+ scoped_refptr<PPB_Buffer_Impl> buffer(
+ Resource::GetAs<PPB_Buffer_Impl>(resource));
if (!buffer)
return;
return buffer->Unmap();
@@ -60,7 +64,7 @@
const PPB_Buffer_Dev ppb_buffer = {
&Create,
- &IsBuffer,
+ &IsPPB_Buffer_Impl,
&Describe,
&Map,
&Unmap,
@@ -68,22 +72,24 @@
} // namespace
-Buffer::Buffer(PluginModule* module)
+PPB_Buffer_Impl::PPB_Buffer_Impl(PluginModule* module)
: Resource(module),
size_(0) {
}
-Buffer::~Buffer() {
+PPB_Buffer_Impl::~PPB_Buffer_Impl() {
}
// static
-const PPB_Buffer_Dev* Buffer::GetInterface() {
+const PPB_Buffer_Dev* PPB_Buffer_Impl::GetInterface() {
return &ppb_buffer;
}
-Buffer* Buffer::AsBuffer() { return this; }
+PPB_Buffer_Impl* PPB_Buffer_Impl::AsPPB_Buffer_Impl() {
+ return this;
+}
-bool Buffer::Init(uint32_t size) {
+bool PPB_Buffer_Impl::Init(uint32_t size) {
if (size == 0)
return false;
Unmap();
@@ -91,11 +97,11 @@
return true;
}
-void Buffer::Describe(uint32_t* size_in_bytes) const {
+void PPB_Buffer_Impl::Describe(uint32_t* size_in_bytes) const {
*size_in_bytes = size_;
}
-void* Buffer::Map() {
+void* PPB_Buffer_Impl::Map() {
if (size_ == 0)
return NULL;
@@ -106,14 +112,10 @@
return mem_buffer_.get();
}
-void Buffer::Unmap() {
+void PPB_Buffer_Impl::Unmap() {
mem_buffer_.reset();
}
-void Buffer::Swap(Buffer* other) {
- swap(other->mem_buffer_, mem_buffer_);
- std::swap(other->size_, size_);
-}
+} // namespace ppapi
+} // namespace webkit
-} // namespace pepper
-
« no previous file with comments | « webkit/plugins/ppapi/ppb_buffer_impl.h ('k') | webkit/plugins/ppapi/ppb_char_set_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698