summaryrefslogtreecommitdiffstats
path: root/cc/blink
diff options
context:
space:
mode:
authorjbauman <jbauman@chromium.org>2014-12-10 16:49:37 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-11 00:50:57 +0000
commit9015c8b4419268a35a5c1a0f2afb7a2a2aaff699 (patch)
treef4ded328bf40fd016058f68be4b4b457bd1eb328 /cc/blink
parentbcb3fdd69b3a04edf3f48e333ea42a8ec6f0177b (diff)
downloadchromium_src-9015c8b4419268a35a5c1a0f2afb7a2a2aaff699.zip
chromium_src-9015c8b4419268a35a5c1a0f2afb7a2a2aaff699.tar.gz
chromium_src-9015c8b4419268a35a5c1a0f2afb7a2a2aaff699.tar.bz2
Convert TextureMailbox to use SharedBitmap instead of SharedMemory.
This reduces the amount of conversions between cc::SharedBitmap and base::SharedMemory in the code. Review URL: https://codereview.chromium.org/791483002 Cr-Commit-Position: refs/heads/master@{#307811}
Diffstat (limited to 'cc/blink')
-rw-r--r--cc/blink/web_external_bitmap_impl.cc15
-rw-r--r--cc/blink/web_external_bitmap_impl.h15
-rw-r--r--cc/blink/web_external_texture_layer_impl.cc2
3 files changed, 15 insertions, 17 deletions
diff --git a/cc/blink/web_external_bitmap_impl.cc b/cc/blink/web_external_bitmap_impl.cc
index a101079..e2c67e4 100644
--- a/cc/blink/web_external_bitmap_impl.cc
+++ b/cc/blink/web_external_bitmap_impl.cc
@@ -4,18 +4,18 @@
#include "cc/blink/web_external_bitmap_impl.h"
-#include "base/memory/shared_memory.h"
+#include "cc/resources/shared_bitmap.h"
namespace cc_blink {
namespace {
-SharedMemoryAllocationFunction g_memory_allocator;
+SharedBitmapAllocationFunction g_memory_allocator;
} // namespace
-void SetSharedMemoryAllocationFunction(
- SharedMemoryAllocationFunction allocator) {
+void SetSharedBitmapAllocationFunction(
+ SharedBitmapAllocationFunction allocator) {
g_memory_allocator = allocator;
}
@@ -27,10 +27,7 @@ WebExternalBitmapImpl::~WebExternalBitmapImpl() {
void WebExternalBitmapImpl::setSize(blink::WebSize size) {
if (size != size_) {
- size_t byte_size = size.width * size.height * 4;
- shared_memory_ = g_memory_allocator(byte_size);
- if (shared_memory_)
- shared_memory_->Map(byte_size);
+ shared_bitmap_ = g_memory_allocator(gfx::Size(size));
size_ = size;
}
}
@@ -40,7 +37,7 @@ blink::WebSize WebExternalBitmapImpl::size() {
}
uint8* WebExternalBitmapImpl::pixels() {
- return static_cast<uint8*>(shared_memory_->memory());
+ return shared_bitmap_->pixels();
}
} // namespace cc_blink
diff --git a/cc/blink/web_external_bitmap_impl.h b/cc/blink/web_external_bitmap_impl.h
index 2d2d8ce..6cada7d 100644
--- a/cc/blink/web_external_bitmap_impl.h
+++ b/cc/blink/web_external_bitmap_impl.h
@@ -10,17 +10,18 @@
#include "cc/blink/cc_blink_export.h"
#include "third_party/WebKit/public/platform/WebExternalBitmap.h"
-namespace base {
-class SharedMemory;
+namespace cc {
+class SharedBitmap;
}
namespace cc_blink {
-typedef scoped_ptr<base::SharedMemory>(*SharedMemoryAllocationFunction)(size_t);
+typedef scoped_ptr<cc::SharedBitmap>(*SharedBitmapAllocationFunction)(
+ const gfx::Size& size);
// Sets the function that this will use to allocate shared memory.
-CC_BLINK_EXPORT void SetSharedMemoryAllocationFunction(
- SharedMemoryAllocationFunction);
+CC_BLINK_EXPORT void SetSharedBitmapAllocationFunction(
+ SharedBitmapAllocationFunction);
class WebExternalBitmapImpl : public blink::WebExternalBitmap {
public:
@@ -32,10 +33,10 @@ class WebExternalBitmapImpl : public blink::WebExternalBitmap {
void setSize(blink::WebSize size) override;
uint8* pixels() override;
- base::SharedMemory* shared_memory() { return shared_memory_.get(); }
+ cc::SharedBitmap* shared_bitmap() { return shared_bitmap_.get(); }
private:
- scoped_ptr<base::SharedMemory> shared_memory_;
+ scoped_ptr<cc::SharedBitmap> shared_bitmap_;
blink::WebSize size_;
DISALLOW_COPY_AND_ASSIGN(WebExternalBitmapImpl);
diff --git a/cc/blink/web_external_texture_layer_impl.cc b/cc/blink/web_external_texture_layer_impl.cc
index 30e0ce6..8d29aa1 100644
--- a/cc/blink/web_external_texture_layer_impl.cc
+++ b/cc/blink/web_external_texture_layer_impl.cc
@@ -84,7 +84,7 @@ bool WebExternalTextureLayerImpl::PrepareTextureMailbox(
gpu::Mailbox name;
name.SetName(client_mailbox.name);
if (bitmap) {
- *mailbox = cc::TextureMailbox(bitmap->shared_memory(), bitmap->size());
+ *mailbox = cc::TextureMailbox(bitmap->shared_bitmap(), bitmap->size());
} else {
*mailbox =
cc::TextureMailbox(name, GL_TEXTURE_2D, client_mailbox.syncPoint);