Index: chrome/browser/prerender/prerender_manager.h |
=================================================================== |
--- chrome/browser/prerender/prerender_manager.h (revision 269781) |
+++ chrome/browser/prerender/prerender_manager.h (working copy) |
@@ -31,6 +31,7 @@ |
#include "components/keyed_service/core/keyed_service.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
+#include "content/public/browser/render_process_host_observer.h" |
#include "content/public/browser/session_storage_namespace.h" |
#include "content/public/browser/web_contents_observer.h" |
#include "net/cookies/canonical_cookie.h" |
@@ -74,6 +75,7 @@ |
class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, |
public base::NonThreadSafe, |
public content::NotificationObserver, |
+ public content::RenderProcessHostObserver, |
public KeyedService, |
public MediaCaptureDevicesDispatcher::Observer { |
public: |
@@ -295,6 +297,8 @@ |
PrerenderTracker* prerender_tracker() { return prerender_tracker_; } |
+ bool cookie_store_loaded() { return cookie_store_loaded_; } |
+ |
// Adds a condition. This is owned by the PrerenderManager. |
void AddCondition(const PrerenderCondition* condition); |
@@ -360,6 +364,25 @@ |
// profile if prerendering is currently enabled. |
void AddProfileNetworkBytesIfEnabled(int64 bytes); |
+ // Registers a new ProcessHost performing a prerender. Called by |
+ // PrerenderContents. |
+ void AddPrerenderProcessHost(content::RenderProcessHost* process_host); |
+ |
+ bool IsProcessPrerendering(content::RenderProcessHost* process_host); |
+ |
+ // content::RenderProcessHostObserver implementation. |
+ virtual void RenderProcessHostDestroyed( |
+ content::RenderProcessHost* host) OVERRIDE; |
+ |
+ // To be called once the cookie store for this profile has been loaded. |
+ void OnCookieStoreLoaded(); |
+ |
+ // For testing purposes. Issues a callback once the cookie store has been |
+ // loaded. |
+ void set_on_cookie_store_loaded_cb_for_testing(base::Closure cb) { |
+ on_cookie_store_loaded_cb_for_testing_ = cb; |
+ } |
+ |
protected: |
class PendingSwap; |
class PrerenderData : public base::SupportsWeakPtr<PrerenderData> { |
@@ -510,6 +533,11 @@ |
// shorten the TTL of the prerendered page. |
void SourceNavigatedAway(PrerenderData* prerender_data); |
+ // Gets the request context for the profile. |
+ // For unit tests, this will be overriden to return NULL, since it is not |
+ // needed. |
+ virtual net::URLRequestContextGetter* GetURLRequestContext(); |
+ |
private: |
friend class ::InstantSearchPrerendererTest; |
friend class PrerenderBrowserTest; |
@@ -719,6 +747,15 @@ |
// The value of profile_network_bytes_ that was last recorded. |
int64 last_recorded_profile_network_bytes_; |
+ // Set of process hosts being prerendered. |
+ typedef std::set<content::RenderProcessHost*> PrerenderProcessSet; |
+ PrerenderProcessSet prerender_process_hosts_; |
+ |
+ // Indicates whether the cookie store for this profile has fully loaded yet. |
+ bool cookie_store_loaded_; |
+ |
+ base::Closure on_cookie_store_loaded_cb_for_testing_; |
+ |
DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
}; |