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

Side by Side Diff: extensions/renderer/resources/guest_view/guest_view_container.js

Issue 1143333008: Getting rid of more webview memory leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. 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 unified diff | Download patch
« no previous file with comments | « extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This module implements the shared functionality for different guestview 5 // This module implements the shared functionality for different guestview
6 // containers, such as web_view, app_view, etc. 6 // containers, such as web_view, app_view, etc.
7 7
8 var DocumentNatives = requireNative('document_natives'); 8 var DocumentNatives = requireNative('document_natives');
9 var GuestView = require('guestView').GuestView; 9 var GuestView = require('guestView').GuestView;
10 var GuestViewInternalNatives = requireNative('guest_view_internal'); 10 var GuestViewInternalNatives = requireNative('guest_view_internal');
11 var IdGenerator = requireNative('id_generator'); 11 var IdGenerator = requireNative('id_generator');
12 12
13 function GuestViewContainer(element, viewType) { 13 function GuestViewContainer(element, viewType) {
14 privates(element).internal = this; 14 privates(element).internal = this;
15 this.attributes = {}; 15 this.attributes = {};
16 this.element = element; 16 this.element = element;
17 this.elementAttached = false; 17 this.elementAttached = false;
18 this.viewInstanceId = IdGenerator.GetNextId(); 18 this.viewInstanceId = IdGenerator.GetNextId();
19 this.viewType = viewType; 19 this.viewType = viewType;
20 20
21 this.setupGuestProperty(); 21 this.setupGuestProperty();
22 this.guest = new GuestView(viewType); 22 this.guest = new GuestView(viewType);
23 this.setupAttributes(); 23 this.setupAttributes();
24 24
25 privates(this).browserPluginElement = this.createBrowserPluginElement(); 25 privates(this).browserPluginElement = this.createBrowserPluginElement();
26 this.setupFocusPropagation(); 26 this.setupFocusPropagation();
27 var shadowRoot = this.element.createShadowRoot(); 27 var shadowRoot = this.element.createShadowRoot();
28 shadowRoot.appendChild(privates(this).browserPluginElement); 28 shadowRoot.appendChild(privates(this).browserPluginElement);
29 29
30 GuestViewInternalNatives.RegisterView(this.viewInstanceId, this); 30 GuestViewInternalNatives.RegisterView(this.viewInstanceId, this, viewType);
31 } 31 }
32 32
33 // Forward public API methods from |proto| to their internal implementations. 33 // Forward public API methods from |proto| to their internal implementations.
34 GuestViewContainer.forwardApiMethods = function(proto, apiMethods) { 34 GuestViewContainer.forwardApiMethods = function(proto, apiMethods) {
35 var createProtoHandler = function(m) { 35 var createProtoHandler = function(m) {
36 return function(var_args) { 36 return function(var_args) {
37 var internal = privates(this).internal; 37 var internal = privates(this).internal;
38 return $Function.apply(internal[m], internal, arguments); 38 return $Function.apply(internal[m], internal, arguments);
39 }; 39 };
40 }; 40 };
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // Delete the callbacks so developers cannot call them and produce unexpected 274 // Delete the callbacks so developers cannot call them and produce unexpected
275 // behavior. 275 // behavior.
276 delete proto.createdCallback; 276 delete proto.createdCallback;
277 delete proto.attachedCallback; 277 delete proto.attachedCallback;
278 delete proto.detachedCallback; 278 delete proto.detachedCallback;
279 delete proto.attributeChangedCallback; 279 delete proto.attributeChangedCallback;
280 } 280 }
281 281
282 // Exports. 282 // Exports.
283 exports.GuestViewContainer = GuestViewContainer; 283 exports.GuestViewContainer = GuestViewContainer;
OLDNEW
« no previous file with comments | « extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698