diff options
author | gavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-15 21:45:18 +0000 |
---|---|---|
committer | gavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-15 21:45:18 +0000 |
commit | 2610170d745f256d0316a936d0907e02b279d8bd (patch) | |
tree | ad2be6594e2ae6ad54e6cb0b451716565d9f40cd /chrome/browser/prerender/prerender_link_manager.h | |
parent | aeb5ccec77fbc0691e766ee80b7c4f4efb79bd9d (diff) | |
download | chromium_src-2610170d745f256d0316a936d0907e02b279d8bd.zip chromium_src-2610170d745f256d0316a936d0907e02b279d8bd.tar.gz chromium_src-2610170d745f256d0316a936d0907e02b279d8bd.tar.bz2 |
Make PrerenderHandle an observer of PrerenderContents.
The big implication of this is that PrerenderLinkManager is an observer of PrerenderHandle, and so messaging to/from the browser process about prerenders ends up mostly in the same place.
Interestingly, we basically can toss out the pending_prerenders_ list in the PrerenderManager; the only thing it bought us was tracking cancelation, which is now done with a bool in PrerenderHandle, just as easily.
The earlier work on the lifetime of PrerenderContents and PrerenderHandle was building up to this. This CL depends on https://codereview.chromium.org/11348357/ , and can't land until after it.
R=mmenke@chromium.org
BUG=None
Review URL: https://chromiumcodereview.appspot.com/11316311
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173322 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prerender/prerender_link_manager.h')
-rw-r--r-- | chrome/browser/prerender/prerender_link_manager.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/prerender/prerender_link_manager.h b/chrome/browser/prerender/prerender_link_manager.h index d9e9c00..8795f0a 100644 --- a/chrome/browser/prerender/prerender_link_manager.h +++ b/chrome/browser/prerender/prerender_link_manager.h @@ -9,6 +9,7 @@ #include <utility> #include "base/basictypes.h" +#include "chrome/browser/prerender/prerender_handle.h" #include "chrome/browser/profiles/profile_keyed_service.h" #include "googleurl/src/gurl.h" @@ -31,7 +32,8 @@ class PrerenderManager; // being rendered in this chrome instance. It receives messages from the // renderer indicating addition, cancelation and abandonment of link elements, // and controls the PrerenderManager accordingly. -class PrerenderLinkManager : public ProfileKeyedService { +class PrerenderLinkManager : public ProfileKeyedService, + public PrerenderHandle::Observer { public: explicit PrerenderLinkManager(PrerenderManager* manager); virtual ~PrerenderLinkManager(); @@ -77,6 +79,15 @@ class PrerenderLinkManager : public ProfileKeyedService { bool IsEmpty() const; + IdPairToPrerenderHandleMap::iterator FindPrerenderHandle( + PrerenderHandle* prerender_handle); + + // From PrerenderHandle::Observer: + virtual void OnPrerenderStart(PrerenderHandle* prerender_handle) OVERRIDE; + virtual void OnPrerenderStop(PrerenderHandle* prerender_handle) OVERRIDE; + virtual void OnPrerenderAddAlias(PrerenderHandle* prerender_handle, + const GURL& alias_url) OVERRIDE; + PrerenderManager* manager_; // A map from child process id and prerender id to PrerenderHandles. We map |