IndexedDBFactory now ForceCloses databases.
[chromium-blink-merge.git] / content / renderer / render_process.h
blob11fab7b918a4bcd2a888cd0d29cf31f3b4c955db
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_RENDER_PROCESS_H_
6 #define CONTENT_RENDERER_RENDER_PROCESS_H_
8 #include "content/child/child_process.h"
9 #include "skia/ext/platform_canvas.h"
11 class TransportDIB;
13 namespace gfx {
14 class Rect;
17 namespace content {
19 // A abstract interface representing the renderer end of the browser<->renderer
20 // connection. The opposite end is the RenderProcessHost. This is a singleton
21 // object for each renderer.
23 // RenderProcessImpl implements this interface for the regular browser.
24 // MockRenderProcess implements this interface for certain tests, especially
25 // ones derived from RenderViewTest.
26 class RenderProcess : public ChildProcess {
27 public:
28 RenderProcess() {}
29 virtual ~RenderProcess() {}
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
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;
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;
45 // Keep track of the cumulative set of enabled bindings for this process,
46 // across any view.
47 virtual void AddBindings(int bindings) = 0;
49 // The cumulative set of enabled bindings for this process.
50 virtual int GetEnabledBindings() const = 0;
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;
57 // Returns a pointer to the RenderProcess singleton instance. Assuming that
58 // we're actually a renderer or a renderer test, this static cast will
59 // be correct.
60 static RenderProcess* current() {
61 return static_cast<RenderProcess*>(ChildProcess::current());
64 private:
65 DISALLOW_COPY_AND_ASSIGN(RenderProcess);
68 } // namespace content
70 #endif // CONTENT_RENDERER_RENDER_PROCESS_H_