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

Unified Diff: content/child/child_shared_bitmap_manager.cc

Issue 802433003: Remove cc::SharedBitmap::memory() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nogetbitmapfor
Patch Set: Created 6 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 | « content/child/child_shared_bitmap_manager.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: content/child/child_shared_bitmap_manager.cc
diff --git a/content/child/child_shared_bitmap_manager.cc b/content/child/child_shared_bitmap_manager.cc
index a62fd41473a2f053ba566f7dcc7f59c57fc5e847..9dc86bd679b50880c1c0cee97278f0b3d8e59c90 100644
--- a/content/child/child_shared_bitmap_manager.cc
+++ b/content/child/child_shared_bitmap_manager.cc
@@ -12,14 +12,15 @@ namespace content {
namespace {
-class ChildSharedBitmap : public cc::SharedBitmap {
+class ChildSharedBitmap : public SharedMemoryBitmap {
public:
ChildSharedBitmap(scoped_refptr<ThreadSafeSender> sender,
base::SharedMemory* shared_memory,
const cc::SharedBitmapId& id)
- : SharedBitmap(static_cast<uint8*>(shared_memory->memory()), id),
- sender_(sender),
- shared_memory_(shared_memory) {}
+ : SharedMemoryBitmap(static_cast<uint8*>(shared_memory->memory()),
+ id,
+ shared_memory),
+ sender_(sender) {}
ChildSharedBitmap(scoped_refptr<ThreadSafeSender> sender,
scoped_ptr<base::SharedMemory> shared_memory_holder,
@@ -32,16 +33,19 @@ class ChildSharedBitmap : public cc::SharedBitmap {
sender_->Send(new ChildProcessHostMsg_DeletedSharedBitmap(id()));
}
- base::SharedMemory* memory() override { return shared_memory_; }
-
private:
scoped_refptr<ThreadSafeSender> sender_;
- base::SharedMemory* shared_memory_;
scoped_ptr<base::SharedMemory> shared_memory_holder_;
};
} // namespace
+SharedMemoryBitmap::SharedMemoryBitmap(uint8* pixels,
+ const cc::SharedBitmapId& id,
+ base::SharedMemory* shared_memory)
+ : SharedBitmap(pixels, id), shared_memory_(shared_memory) {
+}
+
ChildSharedBitmapManager::ChildSharedBitmapManager(
scoped_refptr<ThreadSafeSender> sender)
: sender_(sender) {
@@ -51,15 +55,17 @@ ChildSharedBitmapManager::~ChildSharedBitmapManager() {}
scoped_ptr<cc::SharedBitmap> ChildSharedBitmapManager::AllocateSharedBitmap(
const gfx::Size& size) {
+ return AllocateSharedMemoryBitmap(size);
+}
+
+scoped_ptr<SharedMemoryBitmap>
+ChildSharedBitmapManager::AllocateSharedMemoryBitmap(const gfx::Size& size) {
TRACE_EVENT2("renderer",
- "ChildSharedBitmapManager::AllocateSharedMemory",
- "width",
- size.width(),
- "height",
- size.height());
+ "ChildSharedBitmapManager::AllocateSharedMemoryBitmap", "width",
+ size.width(), "height", size.height());
size_t memory_size;
if (!cc::SharedBitmap::SizeInBytes(size, &memory_size))
- return scoped_ptr<cc::SharedBitmap>();
+ return scoped_ptr<SharedMemoryBitmap>();
cc::SharedBitmapId id = cc::SharedBitmap::GenerateId();
scoped_ptr<base::SharedMemory> memory;
#if defined(OS_POSIX)
« no previous file with comments | « content/child/child_shared_bitmap_manager.h ('k') | content/common/host_shared_bitmap_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698