diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 04:32:31 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 04:32:31 +0000 |
commit | abc77243c735ff8b44deac96a5fc81fd9788b2c9 (patch) | |
tree | 108d9a16f4c49161bafe4758db3359aebdd832f6 /chrome/browser/plugin_prefs.cc | |
parent | 85059c375bfd167ba24b51f59fe0b5ed70a53d9b (diff) | |
download | chromium_src-abc77243c735ff8b44deac96a5fc81fd9788b2c9.zip chromium_src-abc77243c735ff8b44deac96a5fc81fd9788b2c9.tar.gz chromium_src-abc77243c735ff8b44deac96a5fc81fd9788b2c9.tar.bz2 |
Profiles: Really fix refcounted services.
Previous attempts to share code between ProfileKeyedServiceFactory and RefcountedProfileKeyedServiceFactory were ill advised. The core logic code must maintain refcounted data in a scoped_refptr<> for the entire lifecycle, across interface and implementation, preventing any real abstraction here.
This removes the common ProfileKeyedBase and splits the two worlds entirely in two. This has quite a bit of exact code with different types now.
Fallout from this is far reaching:
- Since there isn't one common heiarchy, now the testing methods either return ProfileKeyedServices or scoped_refptr<RefcountedProfileKeyedService>s. This is a lot of change.
- Many consumers handled the refcounted ptrs as raw pointers, which probably isn't a good idea.
- There is now a bunch of code duplication.
BUG=118196,77155
R=mirandac,tim
TBR=jhawkins,sky,scottbyer
Review URL: http://codereview.chromium.org/9703038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127104 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_prefs.cc')
-rw-r--r-- | chrome/browser/plugin_prefs.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/chrome/browser/plugin_prefs.cc b/chrome/browser/plugin_prefs.cc index 4796b89..6b1264b 100644 --- a/chrome/browser/plugin_prefs.cc +++ b/chrome/browser/plugin_prefs.cc @@ -52,16 +52,16 @@ base::LazyInstance<std::map<FilePath, bool> > g_default_plugin_state = #define kPluginUpdateDelayMs (60 * 1000) // static -PluginPrefs* PluginPrefs::GetForProfile(Profile* profile) { - return PluginPrefsFactory::GetInstance()->GetPrefsForProfile(profile); +scoped_refptr<PluginPrefs> PluginPrefs::GetForProfile(Profile* profile) { + return PluginPrefsFactory::GetPrefsForProfile(profile); } // static -PluginPrefs* PluginPrefs::GetForTestingProfile(Profile* profile) { - ProfileKeyedBase* prefs = +scoped_refptr<PluginPrefs> PluginPrefs::GetForTestingProfile( + Profile* profile) { + return static_cast<PluginPrefs*>( PluginPrefsFactory::GetInstance()->SetTestingFactoryAndUse( - profile, &PluginPrefsFactory::CreatePrefsForProfile); - return static_cast<PluginPrefs*>(prefs); + profile, &PluginPrefsFactory::CreateForTestingProfile).get()); } void PluginPrefs::SetPluginListForTesting( |