OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CHROME_RENDERER_RENDER_PROCESS_H_ | |
6 #define CHROME_RENDERER_RENDER_PROCESS_H_ | |
7 #pragma once | |
8 | |
9 #include "content/common/child_process.h" | |
10 #include "skia/ext/platform_canvas.h" | |
11 | |
12 class TransportDIB; | |
13 | |
14 namespace gfx { | |
15 class Rect; | |
16 } | |
17 | |
18 namespace skia { | |
19 class PlatformCanvas; | |
20 } | |
21 | |
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. | |
29 class RenderProcess : public ChildProcess { | |
30 public: | |
31 RenderProcess() {} | |
32 virtual ~RenderProcess() {} | |
33 | |
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. | |
41 virtual skia::PlatformCanvas* GetDrawingCanvas(TransportDIB** memory, | |
42 const gfx::Rect& rect) = 0; | |
43 | |
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; | |
47 | |
48 // Returns true if plugisn should be loaded in-process. | |
49 virtual bool UseInProcessPlugins() const = 0; | |
50 | |
51 virtual bool HasInitializedMediaLibrary() const = 0; | |
52 | |
53 // Returns a pointer to the RenderProcess singleton instance. Assuming that | |
54 // we're actually a renderer or a renderer test, this static cast will | |
55 // be correct. | |
56 static RenderProcess* current() { | |
57 return static_cast<RenderProcess*>(ChildProcess::current()); | |
58 } | |
59 | |
60 private: | |
61 DISALLOW_COPY_AND_ASSIGN(RenderProcess); | |
62 }; | |
63 | |
64 #endif // CHROME_RENDERER_RENDER_PROCESS_H_ | |
OLD | NEW |