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

Unified Diff: chrome/browser/extensions/extension_webnavigation_api.cc

Issue 7562003: Speculative fix for crash. Crashes seem to indicate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: erase(i++) 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
« no previous file with comments | « chrome/browser/extensions/extension_webnavigation_api.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_webnavigation_api.cc
diff --git a/chrome/browser/extensions/extension_webnavigation_api.cc b/chrome/browser/extensions/extension_webnavigation_api.cc
index 1736110a38e89df94646960413d950c6c0b12a88..3733ac9cdcb6871935020f853ef02961ff7c9999 100644
--- a/chrome/browser/extensions/extension_webnavigation_api.cc
+++ b/chrome/browser/extensions/extension_webnavigation_api.cc
@@ -344,6 +344,9 @@ void ExtensionWebNavigationEventRouter::Init() {
registrar_.Add(this,
content::NOTIFICATION_TAB_ADDED,
NotificationService::AllSources());
+ registrar_.Add(this,
+ content::NOTIFICATION_TAB_CONTENTS_DESTROYED,
+ NotificationService::AllSources());
}
}
@@ -360,6 +363,10 @@ void ExtensionWebNavigationEventRouter::Observe(
TabAdded(Details<TabContents>(details).ptr());
break;
+ case content::NOTIFICATION_TAB_CONTENTS_DESTROYED:
+ TabDestroyed(Source<TabContents>(source).ptr());
+ break;
+
default:
NOTREACHED();
}
@@ -419,6 +426,17 @@ void ExtensionWebNavigationEventRouter::TabAdded(TabContents* tab_contents) {
pending_tab_contents_.erase(iter);
}
+void ExtensionWebNavigationEventRouter::TabDestroyed(
+ TabContents* tab_contents) {
+ pending_tab_contents_.erase(tab_contents);
+ for (std::map<TabContents*, PendingTabContents>::iterator i =
+ pending_tab_contents_.begin(); i != pending_tab_contents_.end(); ) {
+ if (i->second.source_tab_contents == tab_contents)
+ pending_tab_contents_.erase(i++);
+ else
+ ++i;
+ }
+}
// ExtensionWebNavigationTabObserver ------------------------------------------
« no previous file with comments | « chrome/browser/extensions/extension_webnavigation_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698