summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-29 21:47:55 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-29 21:47:55 +0000
commitd6430957205dde98d511fb3ab08d433680ad6bca (patch)
tree4f683bcb6e43942e04b721df485c896b1df0a80b
parent3aa4282dfef3a943d6aa79024a3ca95470c40449 (diff)
downloadchromium_src-d6430957205dde98d511fb3ab08d433680ad6bca.zip
chromium_src-d6430957205dde98d511fb3ab08d433680ad6bca.tar.gz
chromium_src-d6430957205dde98d511fb3ab08d433680ad6bca.tar.bz2
Merge 111762 - Correct the order of destruction of ProfileImplIOData and ExtensionProcessManager. This was causing obscure shutdown crashes. See bug for description of crashes.
Also add a DCHECK to help enforce that all RenderProcessHost instances must have been shutdown before ProfileImplIOData->ShutdownOnUIThread() is called. BUG=91398 TEST=Chrome does not crash when extensions with background pages make resource requests during shutdown. Review URL: http://codereview.chromium.org/8591024 TBR=robertshield@chromium.org Review URL: http://codereview.chromium.org/8676044 git-svn-id: svn://svn.chromium.org/chrome/branches/912/src@112039 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.h8
-rw-r--r--chrome/browser/profiles/profile_impl.cc2
-rw-r--r--chrome/browser/profiles/profile_impl.h16
3 files changed, 20 insertions, 6 deletions
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h
index 790ce8b..cc8d201 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.h
+++ b/chrome/browser/profiles/off_the_record_profile_impl.h
@@ -145,10 +145,13 @@ class OffTheRecordProfileImpl : public Profile,
// Weak pointer owned by |profile_|.
PrefService* prefs_;
- scoped_ptr<ExtensionProcessManager> extension_process_manager_;
-
OffTheRecordProfileIOData::Handle io_data_;
+ // Must be freed before |io_data_|. While |extension_process_manager_| still
+ // lives, we handle incoming resource requests from extension processes and
+ // those require access to the ResourceContext owned by |io_data_|.
+ scoped_ptr<ExtensionProcessManager> extension_process_manager_;
+
// We use a non-persistent content settings map for OTR.
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
@@ -162,7 +165,6 @@ class OffTheRecordProfileImpl : public Profile,
// profile because then the main profile would learn some of the host names
// the user visited while OTR.
scoped_ptr<SSLHostState> ssl_host_state_;
-
// Use a separate FindBarState so search terms do not leak back to the main
// profile.
scoped_ptr<FindBarState> find_bar_state_;
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index ebdf583..2ca74da 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -270,8 +270,8 @@ ProfileImpl::ProfileImpl(const FilePath& path,
: path_(path),
ALLOW_THIS_IN_INITIALIZER_LIST(visited_link_event_listener_(
new VisitedLinkEventListener(this))),
- extension_devtools_manager_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)),
+ extension_devtools_manager_(NULL),
host_content_settings_map_(NULL),
host_zoom_map_(NULL),
history_service_created_(false),
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h
index e2ce477..dc57aa8 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -190,6 +190,13 @@ class ProfileImpl : public Profile,
FilePath path_;
FilePath base_cache_path_;
+
+ // !!! BIG HONKING WARNING !!!
+ // The order of the members below is important. Do not change it unless
+ // you know what you're doing. Also, if adding a new member here make sure
+ // that the declaration occurs AFTER things it depends on as destruction
+ // happens in reverse order of declaration.
+
scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_;
// Keep |prefs_| on top for destruction order because |extension_prefs_|,
// |net_pref_observer_|, |web_resource_service_|, and |io_data_| store
@@ -203,9 +210,16 @@ class ProfileImpl : public Profile,
scoped_ptr<ExtensionPrefs> extension_prefs_;
scoped_ptr<ExtensionService> extension_service_;
scoped_refptr<UserScriptMaster> user_script_master_;
+
+ ProfileImplIOData::Handle io_data_;
+
scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_;
// extension_info_map_ needs to outlive extension_process_manager_.
scoped_refptr<ExtensionInfoMap> extension_info_map_;
+ // |extension_process_manager_| must be destroyed before |io_data_|.
+ // While |extension_process_manager_| still lives, we handle incoming
+ // resource requests from extension processes and those require access
+ // to the ResourceContext owned by |io_data_|.
scoped_ptr<ExtensionProcessManager> extension_process_manager_;
scoped_refptr<ExtensionMessageService> extension_message_service_;
scoped_ptr<ExtensionEventRouter> extension_event_router_;
@@ -223,8 +237,6 @@ class ProfileImpl : public Profile,
scoped_ptr<ProfileSyncFactory> profile_sync_factory_;
scoped_ptr<ProfileSyncService> sync_service_;
- ProfileImplIOData::Handle io_data_;
-
scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_;
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;