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

Unified Diff: chrome/renderer/extensions/automation_internal_custom_bindings.cc

Issue 1413033012: Fix crashes in AutomationInternalCustomBindings due to no v8 context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call inherited method from AutomationInternalCustomBindings::Invalidate Created 5 years, 1 month 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/renderer/extensions/automation_internal_custom_bindings.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/automation_internal_custom_bindings.cc
diff --git a/chrome/renderer/extensions/automation_internal_custom_bindings.cc b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
index b4d937471d60d8f4c6d87fad5e6f70fae5479db5..0ecab81397b8b05c932a459ba20d7a77358b9463 100644
--- a/chrome/renderer/extensions/automation_internal_custom_bindings.cc
+++ b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
@@ -473,11 +473,22 @@ AutomationInternalCustomBindings::AutomationInternalCustomBindings(
});
}
-AutomationInternalCustomBindings::~AutomationInternalCustomBindings() {
+AutomationInternalCustomBindings::~AutomationInternalCustomBindings() {}
+
+void AutomationInternalCustomBindings::Invalidate() {
+ ObjectBackedNativeHandler::Invalidate();
+
if (message_filter_)
message_filter_->Detach();
- STLDeleteContainerPairSecondPointers(tree_id_to_tree_cache_map_.begin(),
- tree_id_to_tree_cache_map_.end());
+
+ // Delete the TreeCaches quickly by first clearing their delegates so
+ // we don't get a callback for every node being deleted.
+ for (auto iter : tree_id_to_tree_cache_map_) {
+ TreeCache* cache = iter.second;
+ cache->tree.SetDelegate(nullptr);
+ delete cache;
+ }
+ tree_id_to_tree_cache_map_.clear();
}
void AutomationInternalCustomBindings::OnMessageReceived(
« no previous file with comments | « chrome/renderer/extensions/automation_internal_custom_bindings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698