Index: chrome/browser/extensions/api/declarative/rules_registry_service.cc |
diff --git a/chrome/browser/extensions/api/declarative/rules_registry_service.cc b/chrome/browser/extensions/api/declarative/rules_registry_service.cc |
index 614712c2edfa1ee2c83822766f00ae024bf492dc..0824561792b401c19d4c66983ed33fa2b5df0302 100644 |
--- a/chrome/browser/extensions/api/declarative/rules_registry_service.cc |
+++ b/chrome/browser/extensions/api/declarative/rules_registry_service.cc |
@@ -64,6 +64,13 @@ void RulesRegistryService::RegisterDefaultRulesRegistries() { |
} |
void RulesRegistryService::Shutdown() { |
+ // Release the references to all registries. This would happen soon during |
+ // destruction of |*this|, but we need the ExtensionWebRequestEventRouter to |
+ // be the last to reference the WebRequestRulesRegistry objects, so that |
+ // the posted task below causes their destruction on the IO thread, not on UI |
+ // where the destruction of |*this| takes place. |
+ // TODO(vabr): Remove once http://crbug.com/218451#c6 gets addressed. |
+ rule_registries_.clear(); |
content::BrowserThread::PostTask( |
content::BrowserThread::IO, FROM_HERE, |
base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO, |