[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | 8704f89b | 2011-04-15 00:30:05 | [diff] [blame] | 5 | #ifndef CONTENT_RENDERER_RENDER_PROCESS_H_ |
6 | #define CONTENT_RENDERER_RENDER_PROCESS_H_ | ||||
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame] | 7 | #pragma once |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 8 | |
[email protected] | 7ef40ffe1 | 2011-03-08 05:05:28 | [diff] [blame] | 9 | #include "content/common/child_process.h" |
[email protected] | e68e62fa | 2009-02-20 02:00:04 | [diff] [blame] | 10 | #include "skia/ext/platform_canvas.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 11 | |
[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 12 | class TransportDIB; |
13 | |||||
[email protected] | e68e62fa | 2009-02-20 02:00:04 | [diff] [blame] | 14 | namespace gfx { |
15 | class Rect; | ||||
[email protected] | 39008c0 | 2009-02-11 23:59:25 | [diff] [blame] | 16 | } |
17 | |||||
[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 18 | namespace skia { |
19 | class PlatformCanvas; | ||||
20 | } | ||||
[email protected] | e68e62fa | 2009-02-20 02:00:04 | [diff] [blame] | 21 | |
[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 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. | ||||
25 | // | ||||
26 | // RenderProcessImpl implements this interface for the regular browser. | ||||
27 | // MockRenderProcess implements this interface for certain tests, especially | ||||
28 | // ones derived from RenderViewTest. | ||||
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 29 | class RenderProcess : public ChildProcess { |
30 | public: | ||||
[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 31 | RenderProcess() {} |
32 | virtual ~RenderProcess() {} | ||||
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 33 | |
[email protected] | e68e62fa | 2009-02-20 02:00:04 | [diff] [blame] | 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 | ||||
38 | // | ||||
39 | // When no longer needed, you should pass the TransportDIB to | ||||
40 | // ReleaseTransportDIB so that it can be recycled. | ||||
[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 41 | virtual skia::PlatformCanvas* GetDrawingCanvas(TransportDIB** memory, |
42 | const gfx::Rect& rect) = 0; | ||||
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 43 | |
44 | // Frees shared memory allocated by AllocSharedMemory. You should only use | ||||
45 | // this function to free the SharedMemory object. | ||||
[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 46 | virtual void ReleaseTransportDIB(TransportDIB* memory) = 0; |
[email protected] | 514e711 | 2009-02-20 05:23:36 | [diff] [blame] | 47 | |
[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 48 | // Returns true if plugisn should be loaded in-process. |
49 | virtual bool UseInProcessPlugins() const = 0; | ||||
[email protected] | ea51de3 | 2009-02-20 07:15:17 | [diff] [blame] | 50 | |
[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 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 | ||||
53 | // be correct. | ||||
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 54 | static RenderProcess* current() { |
55 | return static_cast<RenderProcess*>(ChildProcess::current()); | ||||
[email protected] | ea51de3 | 2009-02-20 07:15:17 | [diff] [blame] | 56 | } |
57 | |||||
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 58 | private: |
[email protected] | 1bc8306 | 2009-02-06 00:16:37 | [diff] [blame] | 59 | DISALLOW_COPY_AND_ASSIGN(RenderProcess); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 60 | }; |
61 | |||||
[email protected] | 8704f89b | 2011-04-15 00:30:05 | [diff] [blame] | 62 | #endif // CONTENT_RENDERER_RENDER_PROCESS_H_ |