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

Unified Diff: chrome/browser/renderer_host/render_widget_host_unittest.cc

Issue 21485: Bitmap transport (Closed)
Patch Set: Fix some mac crashes Created 11 years, 10 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: chrome/browser/renderer_host/render_widget_host_unittest.cc
diff --git a/chrome/browser/renderer_host/render_widget_host_unittest.cc b/chrome/browser/renderer_host/render_widget_host_unittest.cc
index 4f0bfb65dc1b168bb7b393592d81d3f66eef9b21..8a31ec9168a15e1a025df14bb753195903f75703 100644
--- a/chrome/browser/renderer_host/render_widget_host_unittest.cc
+++ b/chrome/browser/renderer_host/render_widget_host_unittest.cc
@@ -10,10 +10,6 @@
#include "chrome/common/render_messages.h"
#include "testing/gtest/include/gtest/gtest.h"
-#if defined(OS_POSIX)
-#include "skia/ext/platform_canvas.h"
-#endif
-
namespace {
// RenderWidgetHostProcess -----------------------------------------------------
@@ -22,9 +18,7 @@ class RenderWidgetHostProcess : public MockRenderProcessHost {
public:
explicit RenderWidgetHostProcess(Profile* profile)
: MockRenderProcessHost(profile),
-#if defined(OS_WIN)
current_paint_buf_(NULL),
-#endif
paint_msg_should_reply_(false),
paint_msg_reply_flags_(0) {
// DANGER! This is a hack. The RenderWidgetHost checks the channel to see
@@ -54,11 +48,7 @@ class RenderWidgetHostProcess : public MockRenderProcessHost {
const base::TimeDelta& max_delay,
IPC::Message* msg);
-#if defined(OS_WIN)
- scoped_ptr<base::SharedMemory> current_paint_buf_;
-#elif defined(OS_POSIX)
- skia::PlatformCanvas canvas;
-#endif
+ TransportDIB* current_paint_buf_;
// Set to true when WaitForPaintMsg should return a successful paint messaage
// reply. False implies timeout.
@@ -75,20 +65,10 @@ void RenderWidgetHostProcess::InitPaintRectParams(
ViewHostMsg_PaintRect_Params* params) {
// Create the shared backing store.
const int w = 100, h = 100;
+ const size_t pixel_size = w * h * 4;
-#if defined(OS_WIN)
- int pixel_size = w * h * 4;
-
- current_paint_buf_.reset(new base::SharedMemory());
- ASSERT_TRUE(current_paint_buf_->Create(std::wstring(), false, true,
- pixel_size));
-
- params->bitmap = current_paint_buf_->handle();
-#elif defined(OS_POSIX)
- ASSERT_TRUE(canvas.initialize(w, h, true));
- params->bitmap = canvas.getDevice()->accessBitmap(false);
-#endif
-
+ current_paint_buf_ = TransportDIB::Create(pixel_size, 0);
+ params->bitmap = current_paint_buf_->id();
params->bitmap_rect = gfx::Rect(0, 0, w, h);
params->view_size = gfx::Size(w, h);
params->flags = paint_msg_reply_flags_;

Powered by Google App Engine
This is Rietveld 408576698