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

Unified Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 1015443002: Defer setting "internalinstanceid" so that pending (and destroyed) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up a bit Created 5 years, 9 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 | « content/renderer/browser_plugin/browser_plugin.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/browser_plugin/browser_plugin.cc
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index 078422229c75ac2edbabc088de9d66ed9f1cd53b..38d4bff33ebfc23b5bfb916e833d42ab16750b66 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -300,14 +300,12 @@ bool BrowserPlugin::initialize(WebPluginContainer* container) {
BrowserPluginManager::Get()->AddBrowserPlugin(
browser_plugin_instance_id_, this);
- // This is a way to notify observers of our attributes that this plugin is
- // available in render tree.
- // TODO(lazyboy): This should be done through the delegate instead. Perhaps
- // by firing an event from there.
- UpdateDOMAttribute(
- "internalinstanceid",
- base::UTF8ToUTF16(base::IntToString(browser_plugin_instance_id_)));
-
+ // Defer attach call so that if there's any pending browser plugin
+ // destruction, then it can progress first.
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&BrowserPlugin::UpdateInternalInstanceId,
+ weak_ptr_factory_.GetWeakPtr()));
return true;
}
@@ -333,6 +331,16 @@ void BrowserPlugin::EnableCompositing(bool enable) {
}
}
+void BrowserPlugin::UpdateInternalInstanceId() {
+ // This is a way to notify observers of our attributes that this plugin is
+ // available in render tree.
+ // TODO(lazyboy): This should be done through the delegate instead. Perhaps
+ // by firing an event from there.
+ UpdateDOMAttribute(
+ "internalinstanceid",
+ base::UTF8ToUTF16(base::IntToString(browser_plugin_instance_id_)));
+}
+
void BrowserPlugin::destroy() {
if (container_) {
// The BrowserPlugin's WebPluginContainer is deleted immediately after this
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698