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

Unified Diff: content/shell/renderer/test_runner/test_plugin.cc

Issue 783573003: Make TestPlugin allocate its bitmap with SharedBitmapManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/shell/renderer/test_runner/test_plugin.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/test_plugin.cc
diff --git a/content/shell/renderer/test_runner/test_plugin.cc b/content/shell/renderer/test_runner/test_plugin.cc
index 13e962ca3673ac1b0a95a993e1581d9b85a0f69e..88825c790c2b4dc6a545a9fa9e77d0cd501f0356 100644
--- a/content/shell/renderer/test_runner/test_plugin.cc
+++ b/content/shell/renderer/test_runner/test_plugin.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/memory/shared_memory.h"
#include "base/strings/stringprintf.h"
+#include "cc/resources/shared_bitmap_manager.h"
#include "content/public/renderer/render_thread.h"
#include "content/shell/renderer/test_runner/web_test_delegate.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -290,15 +291,16 @@ void TestPlugin::updateGeometry(
uint32 sync_point = context_->insertSyncPoint();
texture_mailbox_ = cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point);
} else {
- size_t bytes = 4 * rect_.width * rect_.height;
- scoped_ptr<base::SharedMemory> bitmap =
- RenderThread::Get()->HostAllocateSharedMemoryBuffer(bytes);
- if (!bitmap->Map(bytes)) {
+ scoped_ptr<cc::SharedBitmap> bitmap =
+ RenderThread::Get()->GetSharedBitmapManager()->AllocateSharedBitmap(
+ gfx::Rect(rect_).size());
+ if (!bitmap) {
texture_mailbox_ = cc::TextureMailbox();
} else {
- DrawSceneSoftware(bitmap->memory(), bytes);
+ DrawSceneSoftware(bitmap->pixels());
+ DCHECK(bitmap->memory());
texture_mailbox_ = cc::TextureMailbox(
- bitmap.get(), gfx::Size(rect_.width, rect_.height));
+ bitmap->memory(), gfx::Size(rect_.width, rect_.height));
shared_bitmap_ = bitmap.Pass();
}
}
@@ -318,7 +320,7 @@ bool TestPlugin::isPlaceholder() {
static void IgnoreReleaseCallback(uint32 sync_point, bool lost) {
}
-static void ReleaseSharedMemory(scoped_ptr<base::SharedMemory> bitmap,
+static void ReleaseSharedMemory(scoped_ptr<cc::SharedBitmap> bitmap,
uint32 sync_point,
bool lost) {
}
@@ -414,9 +416,7 @@ void TestPlugin::DrawSceneGL() {
DrawPrimitive();
}
-void TestPlugin::DrawSceneSoftware(void* memory, size_t bytes) {
- DCHECK_EQ(bytes, rect_.width * rect_.height * 4u);
-
+void TestPlugin::DrawSceneSoftware(void* memory) {
SkColor background_color =
SkColorSetARGB(static_cast<uint8>(scene_.opacity * 255),
scene_.background_color[0],
« no previous file with comments | « content/shell/renderer/test_runner/test_plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698