Index: chrome/browser/extensions/extension_host.cc |
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc |
index 2714b0b4a83b340ed79fd039777aa0b9239b61ad..a2eae23b00acd049d7624f12b93b85a169f950f5 100644 |
--- a/chrome/browser/extensions/extension_host.cc |
+++ b/chrome/browser/extensions/extension_host.cc |
@@ -340,10 +340,6 @@ void ExtensionHost::DidStopLoading() { |
#endif |
} |
if (notify) { |
- content::NotificationService::current()->Notify( |
- chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, |
- content::Source<Profile>(profile_), |
- content::Details<ExtensionHost>(this)); |
if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { |
UMA_HISTOGRAM_TIMES("Extensions.BackgroundPageLoadTime", |
since_created_.Elapsed()); |
@@ -359,6 +355,13 @@ void ExtensionHost::DidStopLoading() { |
} else if (extension_host_type_ == chrome::VIEW_TYPE_APP_SHELL) { |
UMA_HISTOGRAM_TIMES("Extensions.ShellLoadTime", since_created_.Elapsed()); |
} |
+ |
+ // Send the notification last, because it might result in this being |
+ // deleted. |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, |
+ content::Source<Profile>(profile_), |
+ content::Details<ExtensionHost>(this)); |
} |
} |