diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 22:33:32 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 22:33:32 +0000 |
commit | 587168c836d94221d789b6aa1ea265b3e753df3d (patch) | |
tree | 2669720c42215bbca3833f40a8513c4a02c3b022 /chrome | |
parent | 1783b41dcb79e92d83c28e327bad0b366c59af7f (diff) | |
download | chromium_src-587168c836d94221d789b6aa1ea265b3e753df3d.zip chromium_src-587168c836d94221d789b6aa1ea265b3e753df3d.tar.gz chromium_src-587168c836d94221d789b6aa1ea265b3e753df3d.tar.bz2 |
Instead of destruction RendererMainThread objects via a singelton, which may make them get destructed after browser shutdown, make them a member variable of BrowserRenderProcessHost.
Review URL: http://codereview.chromium.org/39218
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11048 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.cc | 16 | ||||
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.h | 4 |
2 files changed, 6 insertions, 14 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 2610dba..ad8997e 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -67,10 +67,6 @@ #include "skia/include/SkBitmap.h" -namespace { - -// ---------------------------------------------------------------------------- - // This class creates the IO thread for the renderer when running in // single-process mode. It's not used in multi-process mode. class RendererMainThread : public base::Thread { @@ -121,10 +117,6 @@ bool GetRendererPath(std::wstring* cmd_line) { const wchar_t* const kDesktopName = L"ChromeRendererDesktop"; -} // namespace - -//------------------------------------------------------------------------------ - // static void BrowserRenderProcessHost::RegisterPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kStartRenderersManually, false); @@ -346,15 +338,11 @@ bool BrowserRenderProcessHost::Init() { // communicating IO. This can lead to deadlocks where the RenderThread is // waiting for the IO to complete, while the browsermain is trying to pass // an event to the RenderThread. - RendererMainThread* render_thread = new RendererMainThread(channel_id); - - // This singleton keeps track of our pointers to avoid a leak. - Singleton<std::vector<linked_ptr<RendererMainThread> > >::get()->push_back( - linked_ptr<RendererMainThread>(render_thread)); + in_process_renderer_.reset(new RendererMainThread(channel_id)); base::Thread::Options options; options.message_loop_type = MessageLoop::TYPE_IO; - render_thread->StartWithOptions(options); + in_process_renderer_->StartWithOptions(options); } else { if (g_browser_process->local_state() && g_browser_process->local_state()->GetBoolean( diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h index 03dfc43..62a7dc6 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.h +++ b/chrome/browser/renderer_host/browser_render_process_host.h @@ -24,6 +24,7 @@ class CommandLine; class GURL; class PrefService; +class RendererMainThread; class RenderWidgetHelper; class WebContents; @@ -159,6 +160,9 @@ class BrowserRenderProcessHost : public RenderProcessHost, // This is used to clear our cache five seconds after the last use. base::DelayTimer<BrowserRenderProcessHost> cached_dibs_cleaner_; + // Used in single-process mode. + scoped_ptr<RendererMainThread> in_process_renderer_; + DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost); }; |