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

Unified Diff: extensions/renderer/resources/guest_view/guest_view_container.js

Issue 1162053003: Move BrowserPluginDelegate's lifetime mgmt out of content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync @tott Created 5 years, 6 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 | « extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/resources/guest_view/guest_view_container.js
diff --git a/extensions/renderer/resources/guest_view/guest_view_container.js b/extensions/renderer/resources/guest_view/guest_view_container.js
index ebcc3136b5e56a3b0bb67996f3da111ab60ebb61..60b133267e291c851cb68ba2295b829c5bdb9b9f 100644
--- a/extensions/renderer/resources/guest_view/guest_view_container.js
+++ b/extensions/renderer/resources/guest_view/guest_view_container.js
@@ -9,6 +9,7 @@ var DocumentNatives = requireNative('document_natives');
var GuestView = require('guestView').GuestView;
var GuestViewInternalNatives = requireNative('guest_view_internal');
var IdGenerator = requireNative('id_generator');
+var MessagingNatives = requireNative('messaging_natives');
function GuestViewContainer(element, viewType) {
privates(element).internal = this;
@@ -122,12 +123,20 @@ GuestViewContainer.prototype.attachWindow = function() {
return true;
};
+GuestViewContainer.prototype.makeGCOwnContainer = function(internalInstanceId) {
+ MessagingNatives.BindToGC(this, function() {
+ GuestViewInternalNatives.DestroyContainer(internalInstanceId);
+ }, -1);
+};
+
GuestViewContainer.prototype.handleBrowserPluginAttributeMutation =
function(name, oldValue, newValue) {
if (name == 'internalinstanceid' && !oldValue && !!newValue) {
privates(this).browserPluginElement.removeAttribute('internalinstanceid');
this.internalInstanceId = parseInt(newValue);
+ this.makeGCOwnContainer(this.internalInstanceId);
+
// Track when the element resizes using the element resize callback.
GuestViewInternalNatives.RegisterElementResizeCallback(
this.internalInstanceId, this.weakWrapper(this.onElementResize));
« no previous file with comments | « extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698