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

Unified Diff: webkit/renderer/compositor_bindings/web_external_bitmap_impl.cc

Issue 17859002: Allow WebExternalTextureLayers to receive a bitmap along with a mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months 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
Index: webkit/renderer/compositor_bindings/web_external_bitmap_impl.cc
diff --git a/webkit/renderer/compositor_bindings/web_external_bitmap_impl.cc b/webkit/renderer/compositor_bindings/web_external_bitmap_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e450dc8fabef11a78dc45f4decd8c53c1e6880ad
--- /dev/null
+++ b/webkit/renderer/compositor_bindings/web_external_bitmap_impl.cc
@@ -0,0 +1,41 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h"
+
+#include "base/memory/shared_memory.h"
+
+namespace webkit {
+
+namespace {
+
+SharedMemoryAllocationFunction g_memory_allocator;
+
+} // namespace
+
+void SetSharedMemoryAllocationFunction(
+ SharedMemoryAllocationFunction allocator) {
+ g_memory_allocator = allocator;
+}
+
+WebExternalBitmapImpl::WebExternalBitmapImpl() {}
+
+WebExternalBitmapImpl::~WebExternalBitmapImpl() {}
+
+void WebExternalBitmapImpl::setSize(WebKit::WebSize size) {
+ if (size != size_) {
+ shared_memory_ = g_memory_allocator(size.width * size.height * 4);
+ size_ = size;
+ }
+}
+
+WebKit::WebSize WebExternalBitmapImpl::size() {
+ return size_;
+}
+
+uint8* WebExternalBitmapImpl::pixels() {
+ return static_cast<uint8*>(shared_memory_->memory());
+}
+
+} // namespace webkit

Powered by Google App Engine
This is Rietveld 408576698