summaryrefslogtreecommitdiffstats
path: root/content/renderer/gpu/compositor_software_output_device.cc
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-09 04:29:56 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-09 04:29:56 +0000
commitf1970084eb384bcc34e34a363d48582aa4151ed8 (patch)
tree19721446a0b878a1a94be8917c32b26c8e19f45e /content/renderer/gpu/compositor_software_output_device.cc
parent713f38789baaa60f453b2bf56782a5077744101b (diff)
downloadchromium_src-f1970084eb384bcc34e34a363d48582aa4151ed8.zip
chromium_src-f1970084eb384bcc34e34a363d48582aa4151ed8.tar.gz
chromium_src-f1970084eb384bcc34e34a363d48582aa4151ed8.tar.bz2
Use SharedBitmapManager to allocate software frames.
This reduces the number of ways to allocate cross-process bitmaps. BUG= Review URL: https://codereview.chromium.org/227703009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262620 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/gpu/compositor_software_output_device.cc')
-rw-r--r--content/renderer/gpu/compositor_software_output_device.cc30
1 files changed, 12 insertions, 18 deletions
diff --git a/content/renderer/gpu/compositor_software_output_device.cc b/content/renderer/gpu/compositor_software_output_device.cc
index d1e0293..a8c893b 100644
--- a/content/renderer/gpu/compositor_software_output_device.cc
+++ b/content/renderer/gpu/compositor_software_output_device.cc
@@ -6,7 +6,9 @@
#include "base/logging.h"
#include "cc/output/software_frame_data.h"
+#include "content/child/child_shared_bitmap_manager.h"
#include "content/renderer/render_process.h"
+#include "content/renderer/render_thread_impl.h"
#include "third_party/skia/include/core/SkBitmapDevice.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPixelRef.h"
@@ -16,12 +18,9 @@
namespace content {
CompositorSoftwareOutputDevice::Buffer::Buffer(
- unsigned id, scoped_ptr<base::SharedMemory> mem)
- : id_(id),
- mem_(mem.Pass()),
- free_(true),
- parent_(NULL) {
-}
+ unsigned id,
+ scoped_ptr<cc::SharedBitmap> bitmap)
+ : id_(id), shared_bitmap_(bitmap.Pass()), free_(true), parent_(NULL) {}
CompositorSoftwareOutputDevice::Buffer::~Buffer() {
}
@@ -59,7 +58,8 @@ bool CompositorSoftwareOutputDevice::Buffer::FindDamageDifferenceFrom(
CompositorSoftwareOutputDevice::CompositorSoftwareOutputDevice()
: current_index_(-1),
next_buffer_id_(1),
- render_thread_(RenderThread::Get()) {
+ shared_bitmap_manager_(
+ RenderThreadImpl::current()->shared_bitmap_manager()) {
DetachFromThread();
}
@@ -77,13 +77,10 @@ unsigned CompositorSoftwareOutputDevice::GetNextId() {
CompositorSoftwareOutputDevice::Buffer*
CompositorSoftwareOutputDevice::CreateBuffer() {
- const size_t size = 4 * viewport_size_.GetArea();
- scoped_ptr<base::SharedMemory> mem =
- render_thread_->HostAllocateSharedMemoryBuffer(size).Pass();
- CHECK(mem);
- bool success = mem->Map(size);
- CHECK(success);
- return new Buffer(GetNextId(), mem.Pass());
+ scoped_ptr<cc::SharedBitmap> shared_bitmap =
+ shared_bitmap_manager_->AllocateSharedBitmap(viewport_size_);
+ CHECK(shared_bitmap);
+ return new Buffer(GetNextId(), shared_bitmap.Pass());
}
size_t CompositorSoftwareOutputDevice::FindFreeBuffer(size_t hint) {
@@ -200,10 +197,7 @@ void CompositorSoftwareOutputDevice::EndPaint(
frame_data->id = buffer->id();
frame_data->size = viewport_size_;
frame_data->damage_rect = damage_rect_;
- frame_data->handle = buffer->handle();
-
- CHECK_LE(static_cast<size_t>(frame_data->size.GetArea()) * 4,
- buffer->shared_memory()->mapped_size());
+ frame_data->bitmap_id = buffer->shared_bitmap_id();
}
void CompositorSoftwareOutputDevice::ReclaimSoftwareFrame(unsigned id) {