diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-20 05:23:36 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-20 05:23:36 +0000 |
commit | 514e711ea07b6a1aef47ebf20250a37bd632402c (patch) | |
tree | 632f5e8902cc4231e9c14d0ad28035d63a0c964d /chrome/renderer/render_process.h | |
parent | 4acbad918766b81f1da3f10e2ae8aa2b10bb0593 (diff) | |
download | chromium_src-514e711ea07b6a1aef47ebf20250a37bd632402c.zip chromium_src-514e711ea07b6a1aef47ebf20250a37bd632402c.tar.gz chromium_src-514e711ea07b6a1aef47ebf20250a37bd632402c.tar.bz2 |
Refactor code from RenderThread and PluginThread and move it to ChildThread. ChildProcess now owns the ChildThread, which removes duplicate code and simplifies things.
Clean up ChildProcess, there really was no need for all the templates and statics in it and its subclasses.
Review URL: http://codereview.chromium.org/21502
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10080 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_process.h')
-rw-r--r-- | chrome/renderer/render_process.h | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/chrome/renderer/render_process.h b/chrome/renderer/render_process.h index 9c4cabe..a4bc0ff5 100644 --- a/chrome/renderer/render_process.h +++ b/chrome/renderer/render_process.h @@ -21,11 +21,12 @@ class TransportDIB; // each renderer. class RenderProcess : public ChildProcess { public: - static bool GlobalInit(const std::wstring& channel_name); - static void GlobalCleanup(); + // This constructor grabs the channel name from the command line arguments. + RenderProcess(); + // This constructor uses the given channel name. + RenderProcess(const std::wstring& channel_name); - // Returns true if plugins should be loaded in-process. - static bool ShouldLoadPluginsInProcess(); + ~RenderProcess(); // Get a canvas suitable for drawing and transporting to the browser // memory: (output) the transport DIB memory @@ -34,25 +35,31 @@ class RenderProcess : public ChildProcess { // // When no longer needed, you should pass the TransportDIB to // ReleaseTransportDIB so that it can be recycled. - static skia::PlatformCanvas* GetDrawingCanvas( + skia::PlatformCanvas* GetDrawingCanvas( TransportDIB** memory, const gfx::Rect& rect); // Frees shared memory allocated by AllocSharedMemory. You should only use // this function to free the SharedMemory object. - static void ReleaseTransportDIB(TransportDIB* memory); + void ReleaseTransportDIB(TransportDIB* memory); - private: - friend class ChildProcessFactory<RenderProcess>; - explicit RenderProcess(const std::wstring& channel_name); - ~RenderProcess(); + // Returns true if plugins should be loaded in-process. + bool in_process_plugins() const { return in_process_plugins_; } - // Returns a pointer to the RenderProcess singleton instance. This is - // guaranteed to be non-NULL between calls to GlobalInit and GlobalCleanup. - static RenderProcess* self() { - return static_cast<RenderProcess*>(child_process_); + // Returns true if Gears should be loaded in-process. + bool in_process_gears() const { return in_process_gears_; } + + // Returns a pointer to the RenderProcess singleton instance. + static RenderProcess* current() { + return static_cast<RenderProcess*>(ChildProcess::current()); } - static ChildProcess* ClassFactory(const std::wstring& channel_name); + protected: + friend class RenderThread; + // Just like in_process_plugins(), but called before RenderProcess is created. + static bool InProcessPlugins(); + + private: + void Init(); // Look in the shared memory cache for a suitable object to reuse. // result: (output) the memory found @@ -77,12 +84,6 @@ class RenderProcess : public ChildProcess { TransportDIB* CreateTransportDIB(size_t size); void FreeTransportDIB(TransportDIB*); - // ChildProcess implementation - virtual void Cleanup(); - - // The one render thread (to be replaced with a set of render threads). - RenderThread render_thread_; - // A very simplistic and small cache. If an entry in this array is non-null, // then it points to a SharedMemory object that is available for reuse. TransportDIB* shared_mem_cache_[2]; @@ -93,7 +94,8 @@ class RenderProcess : public ChildProcess { // TransportDIB sequence number uint32 sequence_number_; - static bool load_plugins_in_process_; + bool in_process_plugins_; + bool in_process_gears_; DISALLOW_COPY_AND_ASSIGN(RenderProcess); }; |