1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_RENDER_PROCESS_H_
6 #define CONTENT_RENDERER_RENDER_PROCESS_H_
9 #include "content/common/child_process.h"
10 #include "skia/ext/platform_canvas.h"
22 // A abstract interface representing the renderer end of the browser<->renderer
23 // connection. The opposite end is the RenderProcessHost. This is a singleton
24 // object for each renderer.
26 // RenderProcessImpl implements this interface for the regular browser.
27 // MockRenderProcess implements this interface for certain tests, especially
28 // ones derived from RenderViewTest.
29 class RenderProcess
: public ChildProcess
{
32 virtual ~RenderProcess() {}
34 // Get a canvas suitable for drawing and transporting to the browser
35 // memory: (output) the transport DIB memory
36 // rect: the rectangle which will be painted, use for sizing the canvas
37 // returns: NULL on error
39 // When no longer needed, you should pass the TransportDIB to
40 // ReleaseTransportDIB so that it can be recycled.
41 virtual skia::PlatformCanvas
* GetDrawingCanvas(TransportDIB
** memory
,
42 const gfx::Rect
& rect
) = 0;
44 // Frees shared memory allocated by AllocSharedMemory. You should only use
45 // this function to free the SharedMemory object.
46 virtual void ReleaseTransportDIB(TransportDIB
* memory
) = 0;
48 // Returns true if plugisn should be loaded in-process.
49 virtual bool UseInProcessPlugins() const = 0;
51 // Returns a pointer to the RenderProcess singleton instance. Assuming that
52 // we're actually a renderer or a renderer test, this static cast will
54 static RenderProcess
* current() {
55 return static_cast<RenderProcess
*>(ChildProcess::current());
59 DISALLOW_COPY_AND_ASSIGN(RenderProcess
);
62 #endif // CONTENT_RENDERER_RENDER_PROCESS_H_