OLD | NEW |
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 #ifndef CONTENT_RENDERER_RENDER_PROCESS_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_PROCESS_H_ |
6 #define CONTENT_RENDERER_RENDER_PROCESS_H_ | 6 #define CONTENT_RENDERER_RENDER_PROCESS_H_ |
7 | 7 |
8 #include "content/child/child_process.h" | 8 #include "content/child/child_process.h" |
9 #include "skia/ext/platform_canvas.h" | 9 #include "skia/ext/platform_canvas.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 // object for each renderer. | 21 // object for each renderer. |
22 // | 22 // |
23 // RenderProcessImpl implements this interface for the regular browser. | 23 // RenderProcessImpl implements this interface for the regular browser. |
24 // MockRenderProcess implements this interface for certain tests, especially | 24 // MockRenderProcess implements this interface for certain tests, especially |
25 // ones derived from RenderViewTest. | 25 // ones derived from RenderViewTest. |
26 class RenderProcess : public ChildProcess { | 26 class RenderProcess : public ChildProcess { |
27 public: | 27 public: |
28 RenderProcess() {} | 28 RenderProcess() {} |
29 virtual ~RenderProcess() {} | 29 virtual ~RenderProcess() {} |
30 | 30 |
31 // Get a canvas suitable for drawing and transporting to the browser | |
32 // memory: (output) the transport DIB memory | |
33 // rect: the rectangle which will be painted, use for sizing the canvas | |
34 // returns: NULL on error | |
35 // | |
36 // When no longer needed, you should pass the TransportDIB to | |
37 // ReleaseTransportDIB so that it can be recycled. | |
38 virtual SkCanvas* GetDrawingCanvas(TransportDIB** memory, | |
39 const gfx::Rect& rect) = 0; | |
40 | |
41 // Frees shared memory allocated by AllocSharedMemory. You should only use | |
42 // this function to free the SharedMemory object. | |
43 virtual void ReleaseTransportDIB(TransportDIB* memory) = 0; | |
44 | |
45 // Keep track of the cumulative set of enabled bindings for this process, | 31 // Keep track of the cumulative set of enabled bindings for this process, |
46 // across any view. | 32 // across any view. |
47 virtual void AddBindings(int bindings) = 0; | 33 virtual void AddBindings(int bindings) = 0; |
48 | 34 |
49 // The cumulative set of enabled bindings for this process. | 35 // The cumulative set of enabled bindings for this process. |
50 virtual int GetEnabledBindings() const = 0; | 36 virtual int GetEnabledBindings() const = 0; |
51 | 37 |
52 // Create a new transport DIB of, at least, the given size. Return NULL on | |
53 // error. | |
54 virtual TransportDIB* CreateTransportDIB(size_t size) = 0; | |
55 virtual void FreeTransportDIB(TransportDIB*) = 0; | |
56 | |
57 // Returns a pointer to the RenderProcess singleton instance. Assuming that | 38 // Returns a pointer to the RenderProcess singleton instance. Assuming that |
58 // we're actually a renderer or a renderer test, this static cast will | 39 // we're actually a renderer or a renderer test, this static cast will |
59 // be correct. | 40 // be correct. |
60 static RenderProcess* current() { | 41 static RenderProcess* current() { |
61 return static_cast<RenderProcess*>(ChildProcess::current()); | 42 return static_cast<RenderProcess*>(ChildProcess::current()); |
62 } | 43 } |
63 | 44 |
64 private: | 45 private: |
65 DISALLOW_COPY_AND_ASSIGN(RenderProcess); | 46 DISALLOW_COPY_AND_ASSIGN(RenderProcess); |
66 }; | 47 }; |
67 | 48 |
68 } // namespace content | 49 } // namespace content |
69 | 50 |
70 #endif // CONTENT_RENDERER_RENDER_PROCESS_H_ | 51 #endif // CONTENT_RENDERER_RENDER_PROCESS_H_ |
OLD | NEW |