Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(774)

Side by Side Diff: content/renderer/render_process_impl.h

Issue 10830072: Browser Plugin: New Implementation (Renderer Side) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added lots more comments to messages and public members of BrowserPlugin Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
(...skipping 10 matching lines...) Expand all
21 virtual ~RenderProcessImpl(); 21 virtual ~RenderProcessImpl();
22 22
23 // RenderProcess implementation. 23 // RenderProcess implementation.
24 virtual skia::PlatformCanvas* GetDrawingCanvas( 24 virtual skia::PlatformCanvas* GetDrawingCanvas(
25 TransportDIB** memory, 25 TransportDIB** memory,
26 const gfx::Rect& rect) OVERRIDE; 26 const gfx::Rect& rect) OVERRIDE;
27 virtual void ReleaseTransportDIB(TransportDIB* memory) OVERRIDE; 27 virtual void ReleaseTransportDIB(TransportDIB* memory) OVERRIDE;
28 virtual bool UseInProcessPlugins() const OVERRIDE; 28 virtual bool UseInProcessPlugins() const OVERRIDE;
29 virtual void AddBindings(int bindings) OVERRIDE; 29 virtual void AddBindings(int bindings) OVERRIDE;
30 virtual int GetEnabledBindings() const OVERRIDE; 30 virtual int GetEnabledBindings() const OVERRIDE;
31 virtual TransportDIB* CreateTransportDIB(size_t size) OVERRIDE;
32 virtual void FreeTransportDIB(TransportDIB*) OVERRIDE;
31 33
32 // Like UseInProcessPlugins(), but called before RenderProcess is created 34 // Like UseInProcessPlugins(), but called before RenderProcess is created
33 // and does not allow overriding by tests. This just checks the command line 35 // and does not allow overriding by tests. This just checks the command line
34 // each time. 36 // each time.
35 static bool InProcessPlugins(); 37 static bool InProcessPlugins();
36 38
37 private: 39 private:
38 // Look in the shared memory cache for a suitable object to reuse. 40 // Look in the shared memory cache for a suitable object to reuse.
39 // result: (output) the memory found 41 // result: (output) the memory found
40 // size: the resulting memory will be >= this size, in bytes 42 // size: the resulting memory will be >= this size, in bytes
41 // returns: false if a suitable DIB memory could not be found 43 // returns: false if a suitable DIB memory could not be found
42 bool GetTransportDIBFromCache(TransportDIB** result, size_t size); 44 bool GetTransportDIBFromCache(TransportDIB** result, size_t size);
43 45
44 // Maybe put the given shared memory into the shared memory cache. Returns 46 // Maybe put the given shared memory into the shared memory cache. Returns
45 // true if the SharedMemory object was stored in the cache; otherwise, false 47 // true if the SharedMemory object was stored in the cache; otherwise, false
46 // is returned. 48 // is returned.
47 bool PutSharedMemInCache(TransportDIB* memory); 49 bool PutSharedMemInCache(TransportDIB* memory);
48 50
49 void ClearTransportDIBCache(); 51 void ClearTransportDIBCache();
50 52
51 // Return the index of a free cache slot in which to install a transport DIB 53 // 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 54 // 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. 55 // size, this doesn't free any slots and returns -1.
54 int FindFreeCacheSlot(size_t size); 56 int FindFreeCacheSlot(size_t size);
55 57
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, 58 // 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. 59 // then it points to a SharedMemory object that is available for reuse.
63 TransportDIB* shared_mem_cache_[2]; 60 TransportDIB* shared_mem_cache_[2];
64 61
65 // This DelayTimer cleans up our cache 5 seconds after the last use. 62 // This DelayTimer cleans up our cache 5 seconds after the last use.
66 base::DelayTimer<RenderProcessImpl> shared_mem_cache_cleaner_; 63 base::DelayTimer<RenderProcessImpl> shared_mem_cache_cleaner_;
67 64
68 // TransportDIB sequence number 65 // TransportDIB sequence number
69 uint32 transport_dib_next_sequence_number_; 66 uint32 transport_dib_next_sequence_number_;
70 67
71 bool in_process_plugins_; 68 bool in_process_plugins_;
72 69
73 // Bitwise-ORed set of extra bindings that have been enabled anywhere in this 70 // Bitwise-ORed set of extra bindings that have been enabled anywhere in this
74 // process. See BindingsPolicy for details. 71 // process. See BindingsPolicy for details.
75 int enabled_bindings_; 72 int enabled_bindings_;
76 73
77 DISALLOW_COPY_AND_ASSIGN(RenderProcessImpl); 74 DISALLOW_COPY_AND_ASSIGN(RenderProcessImpl);
78 }; 75 };
79 76
80 #endif // CONTENT_RENDERER_RENDER_PROCESS_IMPL_H_ 77 #endif // CONTENT_RENDERER_RENDER_PROCESS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698