diff options
author | gavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-23 16:25:59 +0000 |
---|---|---|
committer | gavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-23 16:25:59 +0000 |
commit | 473bc7b098738b4614b8aa8adbe0ded16fb71296 (patch) | |
tree | 47f28cbbdbd051025eb6842c66c9ddd0067e52bc /chrome | |
parent | de500dad7f1f18fb1f78117d2b6ce1b1427cc226 (diff) | |
download | chromium_src-473bc7b098738b4614b8aa8adbe0ded16fb71296.zip chromium_src-473bc7b098738b4614b8aa8adbe0ded16fb71296.tar.gz chromium_src-473bc7b098738b4614b8aa8adbe0ded16fb71296.tar.bz2 |
Fix memory leak in PrerenderDispatcher.
Make the PrerenderingInterface into a scoped pointer.
BUG=127953
Review URL: https://chromiumcodereview.appspot.com/10391134
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138494 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/renderer/prerender/prerender_dispatcher.cc | 7 | ||||
-rw-r--r-- | chrome/renderer/prerender/prerender_dispatcher.h | 11 |
2 files changed, 15 insertions, 3 deletions
diff --git a/chrome/renderer/prerender/prerender_dispatcher.cc b/chrome/renderer/prerender/prerender_dispatcher.cc index 84173fd..c5af1cd 100644 --- a/chrome/renderer/prerender/prerender_dispatcher.cc +++ b/chrome/renderer/prerender/prerender_dispatcher.cc @@ -12,11 +12,14 @@ namespace prerender { -PrerenderDispatcher::PrerenderDispatcher() { - WebKit::WebPrerenderingSupport::initialize(new PrerenderingSupport()); +PrerenderDispatcher::PrerenderDispatcher() + : prerendering_support_(new PrerenderingSupport()) { + WebKit::WebPrerenderingSupport::initialize(prerendering_support_.get()); } PrerenderDispatcher::~PrerenderDispatcher() { + if (prerendering_support_.get()) + WebKit::WebPrerenderingSupport::shutdown(); } bool PrerenderDispatcher::IsPrerenderURL(const GURL& url) const { diff --git a/chrome/renderer/prerender/prerender_dispatcher.h b/chrome/renderer/prerender/prerender_dispatcher.h index 5537401..3ee2b7f 100644 --- a/chrome/renderer/prerender/prerender_dispatcher.h +++ b/chrome/renderer/prerender/prerender_dispatcher.h @@ -9,15 +9,20 @@ #include <map> #include "base/compiler_specific.h" +#include "base/memory/scoped_ptr.h" #include "content/public/renderer/render_process_observer.h" class GURL; namespace prerender { +class PrerenderingSupport; + // PrerenderDispatcher keeps track of which URLs are being prerendered. There // is only one PrerenderDispatcher per render process, and it will only be -// aware of prerenders that are triggered by this render process. +// aware of prerenders that are triggered by this render process. As well, +// it holds on to other objects that must exist once per-renderer process, +// such as the PrerenderingSupport. class PrerenderDispatcher : public content::RenderProcessObserver { public: PrerenderDispatcher(); @@ -34,6 +39,10 @@ class PrerenderDispatcher : public content::RenderProcessObserver { typedef std::map<GURL, int> PrerenderMap; PrerenderMap prerender_urls_; + + // There is one PrerenderingSupport object per renderer, and it provides + // the interface to prerendering to the WebKit platform. + scoped_ptr<PrerenderingSupport> prerendering_support_; }; } // namespace prerender |