Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Unified Diff: chrome/browser/content_settings/content_settings_pref_provider.h

Issue 7218073: Explicitly ShutdownOnUIThread the HostContentSettingsMap when destroying the Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/content_settings/content_settings_pref_provider.h
diff --git a/chrome/browser/content_settings/content_settings_pref_provider.h b/chrome/browser/content_settings/content_settings_pref_provider.h
index c847923daf4b4828f8e8cd66b7fd64f5548992ff..b3af1a0a13f513f74da0c4d38f0b1a973eeebbc1 100644
--- a/chrome/browser/content_settings/content_settings_pref_provider.h
+++ b/chrome/browser/content_settings/content_settings_pref_provider.h
@@ -23,8 +23,8 @@
class ContentSettingsDetails;
class DictionaryValue;
+class HostContentSettingsMap;
class PrefService;
-class Profile;
namespace content_settings {
@@ -33,7 +33,9 @@ namespace content_settings {
class PrefDefaultProvider : public DefaultProviderInterface,
public NotificationObserver {
public:
- explicit PrefDefaultProvider(Profile* profile);
+ PrefDefaultProvider(HostContentSettingsMap* map,
+ PrefService* prefs,
+ bool incognito);
virtual ~PrefDefaultProvider();
// DefaultContentSettingsProvider implementation.
@@ -43,6 +45,8 @@ class PrefDefaultProvider : public DefaultProviderInterface,
ContentSetting setting);
virtual bool DefaultSettingIsManaged(ContentSettingsType content_type) const;
+ void ShutdownOnUIThread();
+
static void RegisterUserPrefs(PrefService* prefs);
// NotificationObserver implementation.
@@ -57,8 +61,6 @@ class PrefDefaultProvider : public DefaultProviderInterface,
// mutex deadlock.
void NotifyObservers(const ContentSettingsDetails& details);
- void UnregisterObservers();
-
// Sets the fields of |settings| based on the values in |dictionary|.
void GetSettingsFromDictionary(const DictionaryValue* dictionary,
ContentSettings* settings);
@@ -71,12 +73,13 @@ class PrefDefaultProvider : public DefaultProviderInterface,
// true and the preference is missing, the local copy will be cleared as well.
void ReadDefaultSettings(bool overwrite);
- void MigrateObsoleteNotificationPref(PrefService* prefs);
+ void MigrateObsoleteNotificationPref();
// Copies of the pref data, so that we can read it on the IO thread.
ContentSettings default_content_settings_;
- Profile* profile_;
+ HostContentSettingsMap* host_content_settings_map_;
+ PrefService* prefs_;
// Whether this settings map is for an Incognito session.
bool is_incognito_;
@@ -86,14 +89,11 @@ class PrefDefaultProvider : public DefaultProviderInterface,
mutable base::Lock lock_;
PrefChangeRegistrar pref_change_registrar_;
- NotificationRegistrar notification_registrar_;
// Whether we are currently updating preferences, this is used to ignore
// notifications from the preferences service that we triggered ourself.
bool updating_preferences_;
- bool initializing_;
-
DISALLOW_COPY_AND_ASSIGN(PrefDefaultProvider);
};
@@ -104,7 +104,9 @@ class PrefProvider : public ProviderInterface,
public:
static void RegisterUserPrefs(PrefService* prefs);
- explicit PrefProvider(Profile* profile);
+ PrefProvider(HostContentSettingsMap* map,
+ PrefService* prefs,
+ bool incognito);
virtual ~PrefProvider();
// ProviderInterface implementations.
@@ -129,6 +131,8 @@ class PrefProvider : public ProviderInterface,
virtual void ClearAllContentSettingsRules(
ContentSettingsType content_type);
+ virtual void ShutdownOnUIThread();
+
// NotificationObserver implementation.
virtual void Observe(NotificationType type,
const NotificationSource& source,
@@ -172,37 +176,35 @@ class PrefProvider : public ProviderInterface,
// Various migration methods (old cookie, popup and per-host data gets
// migrated to the new format).
- void MigrateObsoletePerhostPref(PrefService* prefs);
- void MigrateObsoletePopupsPref(PrefService* prefs);
- void MigrateObsoleteContentSettingsPatternPref(PrefService* prefs);
+ void MigrateObsoletePerhostPref();
+ void MigrateObsoletePopupsPref();
+ void MigrateObsoleteContentSettingsPatternPref();
// Copies the value of the preference that stores the content settings
// exceptions to the obsolete preference for content settings exceptions. This
// is necessary to allow content settings exceptions beeing synced to older
// versions of chrome that only use the obsolete.
- void SyncObsoletePref(PrefService* pref);
+ void SyncObsoletePref();
- void CanonicalizeContentSettingsExceptions(
+ static void CanonicalizeContentSettingsExceptions(
DictionaryValue* all_settings_dictionary);
void NotifyObservers(const ContentSettingsDetails& details);
- void UnregisterObservers();
+ // Weak; owned by the Profile and reset in ShutdownOnUIThread.
+ PrefService* prefs_;
- Profile* profile_;
+ // Weak; owns us
+ HostContentSettingsMap* host_content_settings_map_;
bool is_incognito_;
PrefChangeRegistrar pref_change_registrar_;
- NotificationRegistrar notification_registrar_;
// Whether we are currently updating preferences, this is used to ignore
// notifications from the preferences service that we triggered ourself.
bool updating_preferences_;
- // Do not fire any Notifications as long as we are in the constructor.
- bool initializing_;
-
OriginIdentifierValueMap value_map_;
OriginIdentifierValueMap incognito_value_map_;

Powered by Google App Engine
This is Rietveld 408576698