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

Unified Diff: cc/resources/shared_bitmap.cc

Issue 307973004: Allow creating SharedBitmaps backed by new[] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « cc/resources/shared_bitmap.h ('k') | content/common/host_shared_bitmap_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/shared_bitmap.cc
diff --git a/cc/resources/shared_bitmap.cc b/cc/resources/shared_bitmap.cc
index 6d2ff0af5d5e41049e852f8bd1f7725f5a5b055f..31cf245151c7cdab6a3a77092b11863d3a666d60 100644
--- a/cc/resources/shared_bitmap.cc
+++ b/cc/resources/shared_bitmap.cc
@@ -14,7 +14,18 @@ SharedBitmap::SharedBitmap(
base::SharedMemory* memory,
const SharedBitmapId& id,
const base::Callback<void(SharedBitmap* bitmap)>& free_callback)
- : memory_(memory), id_(id), free_callback_(free_callback) {}
+ : memory_(memory),
+ pixels_(static_cast<uint8*>(memory_->memory())),
+ id_(id),
+ free_callback_(free_callback) {
+}
+
+SharedBitmap::SharedBitmap(
+ uint8* pixels,
+ const SharedBitmapId& id,
+ const base::Callback<void(SharedBitmap* bitmap)>& free_callback)
+ : memory_(NULL), pixels_(pixels), id_(id), free_callback_(free_callback) {
+}
SharedBitmap::~SharedBitmap() { free_callback_.Run(this); }
« no previous file with comments | « cc/resources/shared_bitmap.h ('k') | content/common/host_shared_bitmap_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698