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

Unified Diff: apps/app_shim/extension_app_shim_handler_mac.cc

Issue 18341026: Don't look up profiles when closing shims. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/app_shim/extension_app_shim_handler_mac.cc
diff --git a/apps/app_shim/extension_app_shim_handler_mac.cc b/apps/app_shim/extension_app_shim_handler_mac.cc
index 4756fcaac85eb2fc6a4319714751ca8a64a0219e..63aee0eecaa4a5c245fcba82590e3652ee5c158a 100644
--- a/apps/app_shim/extension_app_shim_handler_mac.cc
+++ b/apps/app_shim/extension_app_shim_handler_mac.cc
@@ -62,11 +62,9 @@ Profile* ExtensionAppShimHandler::Delegate::ProfileForPath(
ProfileManager* profile_manager = g_browser_process->profile_manager();
base::FilePath full_path = profile_manager->user_data_dir().Append(path);
Profile* profile = profile_manager->GetProfileByPath(full_path);
- if (!profile)
- return NULL;
// Use IsValidProfile to check if the profile has been created.
- return profile_manager->IsValidProfile(profile) ? profile : NULL;
+ return profile && profile_manager->IsValidProfile(profile) ? profile : NULL;
}
void ExtensionAppShimHandler::Delegate::LoadProfileAsync(
@@ -210,14 +208,13 @@ void ExtensionAppShimHandler::OnProfileLoaded(Host* host,
}
void ExtensionAppShimHandler::OnShimClose(Host* host) {
- DCHECK(delegate_->ProfileExistsForPath(host->GetProfilePath()));
- Profile* profile = delegate_->ProfileForPath(host->GetProfilePath());
-
- HostMap::iterator it = hosts_.find(make_pair(profile, host->GetAppId()));
- // Any hosts other than the main host will still call OnShimClose, so ignore
- // them.
- if (it != hosts_.end() && it->second == host)
- hosts_.erase(it);
+ // This might be called when shutting down. Don't try to look up the profile
+ // since profile_manager might not be around.
+ for (HostMap::iterator it = hosts_.begin(); it != hosts_.end(); ) {
+ HostMap::iterator current = it++;
+ if (current->second == host)
+ hosts_.erase(current);
+ }
}
void ExtensionAppShimHandler::OnShimFocus(Host* host,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698