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_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_PROCESS_IMPL_H_ |
6 #define CONTENT_RENDERER_RENDER_PROCESS_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_PROCESS_IMPL_H_ |
7 | 7 |
8 #include "base/timer.h" | 8 #include "base/timer.h" |
9 #include "content/renderer/render_process.h" | 9 #include "content/renderer/render_process.h" |
10 | 10 |
11 namespace skia { | 11 namespace skia { |
12 class PlatformCanvas; | 12 class PlatformCanvas; |
13 } | 13 } |
14 | 14 |
15 // Implementation of the RenderProcess interface for the regular browser. | 15 // Implementation of the RenderProcess interface for the regular browser. |
16 // See also MockRenderProcess which implements the active "RenderProcess" when | 16 // See also MockRenderProcess which implements the active "RenderProcess" when |
17 // running under certain unit tests. | 17 // running under certain unit tests. |
18 class RenderProcessImpl : public RenderProcess { | 18 class RenderProcessImpl : public RenderProcess { |
19 public: | 19 public: |
20 RenderProcessImpl(); | 20 RenderProcessImpl(); |
21 virtual ~RenderProcessImpl(); | 21 virtual ~RenderProcessImpl(); |
22 | 22 |
| 23 // Create a new transport DIB of, at least, the given size. Return NULL on |
| 24 // error. |
| 25 TransportDIB* CreateTransportDIB(size_t size); |
| 26 void FreeTransportDIB(TransportDIB*); |
| 27 |
23 // RenderProcess implementation. | 28 // RenderProcess implementation. |
24 virtual skia::PlatformCanvas* GetDrawingCanvas( | 29 virtual skia::PlatformCanvas* GetDrawingCanvas( |
25 TransportDIB** memory, | 30 TransportDIB** memory, |
26 const gfx::Rect& rect) OVERRIDE; | 31 const gfx::Rect& rect) OVERRIDE; |
27 virtual void ReleaseTransportDIB(TransportDIB* memory) OVERRIDE; | 32 virtual void ReleaseTransportDIB(TransportDIB* memory) OVERRIDE; |
28 virtual bool UseInProcessPlugins() const OVERRIDE; | 33 virtual bool UseInProcessPlugins() const OVERRIDE; |
29 virtual void AddBindings(int bindings) OVERRIDE; | 34 virtual void AddBindings(int bindings) OVERRIDE; |
30 virtual int GetEnabledBindings() const OVERRIDE; | 35 virtual int GetEnabledBindings() const OVERRIDE; |
31 | 36 |
32 // Like UseInProcessPlugins(), but called before RenderProcess is created | 37 // Like UseInProcessPlugins(), but called before RenderProcess is created |
(...skipping 13 matching lines...) Expand all Loading... |
46 // is returned. | 51 // is returned. |
47 bool PutSharedMemInCache(TransportDIB* memory); | 52 bool PutSharedMemInCache(TransportDIB* memory); |
48 | 53 |
49 void ClearTransportDIBCache(); | 54 void ClearTransportDIBCache(); |
50 | 55 |
51 // Return the index of a free cache slot in which to install a transport DIB | 56 // Return the index of a free cache slot in which to install a transport DIB |
52 // of the given size. If all entries in the cache are larger than the given | 57 // of the given size. If all entries in the cache are larger than the given |
53 // size, this doesn't free any slots and returns -1. | 58 // size, this doesn't free any slots and returns -1. |
54 int FindFreeCacheSlot(size_t size); | 59 int FindFreeCacheSlot(size_t size); |
55 | 60 |
56 // Create a new transport DIB of, at least, the given size. Return NULL on | |
57 // error. | |
58 TransportDIB* CreateTransportDIB(size_t size); | |
59 void FreeTransportDIB(TransportDIB*); | |
60 | |
61 // A very simplistic and small cache. If an entry in this array is non-null, | 61 // A very simplistic and small cache. If an entry in this array is non-null, |
62 // then it points to a SharedMemory object that is available for reuse. | 62 // then it points to a SharedMemory object that is available for reuse. |
63 TransportDIB* shared_mem_cache_[2]; | 63 TransportDIB* shared_mem_cache_[2]; |
64 | 64 |
65 // This DelayTimer cleans up our cache 5 seconds after the last use. | 65 // This DelayTimer cleans up our cache 5 seconds after the last use. |
66 base::DelayTimer<RenderProcessImpl> shared_mem_cache_cleaner_; | 66 base::DelayTimer<RenderProcessImpl> shared_mem_cache_cleaner_; |
67 | 67 |
68 // TransportDIB sequence number | 68 // TransportDIB sequence number |
69 uint32 transport_dib_next_sequence_number_; | 69 uint32 transport_dib_next_sequence_number_; |
70 | 70 |
71 bool in_process_plugins_; | 71 bool in_process_plugins_; |
72 | 72 |
73 // Bitwise-ORed set of extra bindings that have been enabled anywhere in this | 73 // Bitwise-ORed set of extra bindings that have been enabled anywhere in this |
74 // process. See BindingsPolicy for details. | 74 // process. See BindingsPolicy for details. |
75 int enabled_bindings_; | 75 int enabled_bindings_; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(RenderProcessImpl); | 77 DISALLOW_COPY_AND_ASSIGN(RenderProcessImpl); |
78 }; | 78 }; |
79 | 79 |
80 #endif // CONTENT_RENDERER_RENDER_PROCESS_IMPL_H_ | 80 #endif // CONTENT_RENDERER_RENDER_PROCESS_IMPL_H_ |
OLD | NEW |