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

Side by Side Diff: content/test/mock_render_process.cc

Issue 11138024: Simplify platform_canvas.h by recognizing that PlatformCanvas does not actually extend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/shell/webkit_test_runner.cc ('k') | ppapi/proxy/ppb_image_data_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/test/mock_render_process.h" 5 #include "content/test/mock_render_process.h"
6 6
7 #include "ui/gfx/rect.h" 7 #include "ui/gfx/rect.h"
8 #include "ui/surface/transport_dib.h" 8 #include "ui/surface/transport_dib.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 MockRenderProcess::MockRenderProcess() 12 MockRenderProcess::MockRenderProcess()
13 : transport_dib_next_sequence_number_(0), 13 : transport_dib_next_sequence_number_(0),
14 enabled_bindings_(0) { 14 enabled_bindings_(0) {
15 } 15 }
16 16
17 MockRenderProcess::~MockRenderProcess() { 17 MockRenderProcess::~MockRenderProcess() {
18 } 18 }
19 19
20 skia::PlatformCanvas* MockRenderProcess::GetDrawingCanvas( 20 skia::PlatformCanvas* MockRenderProcess::GetDrawingCanvas(
21 TransportDIB** memory, 21 TransportDIB** memory,
22 const gfx::Rect& rect) { 22 const gfx::Rect& rect) {
23 size_t stride = skia::PlatformCanvas::StrideForWidth(rect.width()); 23 size_t stride = skia::PlatformCanvasStrideForWidth(rect.width());
24 size_t size = stride * rect.height(); 24 size_t size = stride * rect.height();
25 25
26 // Unlike RenderProcessImpl, when we're a test, we can just create transport 26 // Unlike RenderProcessImpl, when we're a test, we can just create transport
27 // DIBs in the current process, since there is no sandbox protecting us (and 27 // DIBs in the current process, since there is no sandbox protecting us (and
28 // no browser process to ask for one in any case). 28 // no browser process to ask for one in any case).
29 *memory = TransportDIB::Create(size, transport_dib_next_sequence_number_++); 29 *memory = TransportDIB::Create(size, transport_dib_next_sequence_number_++);
30 if (!*memory) 30 if (!*memory)
31 return NULL; 31 return NULL;
32 return (*memory)->GetPlatformCanvas(rect.width(), rect.height()); 32 return (*memory)->GetPlatformCanvas(rect.width(), rect.height());
33 } 33 }
(...skipping 16 matching lines...) Expand all
50 50
51 TransportDIB* MockRenderProcess::CreateTransportDIB(size_t size) { 51 TransportDIB* MockRenderProcess::CreateTransportDIB(size_t size) {
52 return TransportDIB::Create(size, transport_dib_next_sequence_number_++); 52 return TransportDIB::Create(size, transport_dib_next_sequence_number_++);
53 } 53 }
54 54
55 void MockRenderProcess::FreeTransportDIB(TransportDIB* dib) { 55 void MockRenderProcess::FreeTransportDIB(TransportDIB* dib) {
56 delete dib; 56 delete dib;
57 } 57 }
58 58
59 } // namespace content 59 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/webkit_test_runner.cc ('k') | ppapi/proxy/ppb_image_data_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698