summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/net_pref_observer.h
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-22 18:04:09 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-22 18:04:09 +0000
commita4fa83b987f37cc28f5af761655fe6c6e69c4359 (patch)
treec9f1db17cea17c756ec56b42af1810f51413d9c6 /chrome/browser/net/net_pref_observer.h
parent5f7a75d708b6c4d6257a1e4f88ec8abaf7b39242 (diff)
downloadchromium_src-a4fa83b987f37cc28f5af761655fe6c6e69c4359.zip
chromium_src-a4fa83b987f37cc28f5af761655fe6c6e69c4359.tar.gz
chromium_src-a4fa83b987f37cc28f5af761655fe6c6e69c4359.tar.bz2
PrerenderManager is no longer refcounted.
The PrerenderManager should be destroyed on the UI thread, along with the PrerenderContents that it owns. I originally did this by using the DeleteOnUIThread trait, but this leaked PrerenderManager's during browser shutdown, since the last reference was held by an object on the IO thread, and the DeleteTask was never processed. Now, the Profile owns the PrerenderManager's lifetime. All other references to the PrerenderManager are weak references. With the current thread-safety restrictions of WeakPtr's, this means that the presence of a PrererenderManager can not be checked on the IO thread, so all LOAD_PREFETCH requests will have a PrerenderResourceHandler constructed, regardless of whether the current profile supports prerendering. BUG=77930 TEST=Existing unit tests and browser tests. Review URL: http://codereview.chromium.org/6877085 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82669 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/net_pref_observer.h')
-rw-r--r--chrome/browser/net/net_pref_observer.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/chrome/browser/net/net_pref_observer.h b/chrome/browser/net/net_pref_observer.h
index a03129e..d023572 100644
--- a/chrome/browser/net/net_pref_observer.h
+++ b/chrome/browser/net/net_pref_observer.h
@@ -23,8 +23,9 @@ class PrerenderManager;
// Must be used only on the UI thread.
class NetPrefObserver : public NotificationObserver {
public:
- // |prefs| must outlive this NetPrefObserver. A reference is
- // held to |prerender_manager| if it is non-NULL.
+ // |prefs| must be non-NULL and |*prefs| must outlive this.
+ // |prerender_manager| may be NULL. If not, |*prerender_manager| must
+ // outlive this.
NetPrefObserver(PrefService* prefs,
prerender::PrerenderManager* prerender_manager);
~NetPrefObserver();
@@ -43,7 +44,7 @@ class NetPrefObserver : public NotificationObserver {
BooleanPrefMember network_prediction_enabled_;
BooleanPrefMember spdy_disabled_;
BooleanPrefMember http_throttling_enabled_;
- scoped_refptr<prerender::PrerenderManager> prerender_manager_;
+ prerender::PrerenderManager* prerender_manager_;
DISALLOW_COPY_AND_ASSIGN(NetPrefObserver);
};