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

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

Issue 1033373003: GuestView: Lazily push attributes to the browser process on attach (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_sizing
Patch Set: Removed more unnecessary changes 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
Index: extensions/renderer/resources/guest_view/guest_view_attributes.js
diff --git a/extensions/renderer/resources/guest_view/guest_view_attributes.js b/extensions/renderer/resources/guest_view/guest_view_attributes.js
index a4c42b69b32a67c1437ff94f78d6e93843a70451..7bc33b81e24875e24ca0ad7ac2623fd8384381ab 100644
--- a/extensions/renderer/resources/guest_view/guest_view_attributes.js
+++ b/extensions/renderer/resources/guest_view/guest_view_attributes.js
@@ -9,9 +9,10 @@
// Default implementation of a GuestView attribute.
function Attribute(name, view) {
+ this.dirty = false;
+ this.ignoreMutation = false;
this.name = name;
this.view = view;
- this.ignoreMutation = false;
this.defineProperty();
}
@@ -21,6 +22,15 @@ Attribute.prototype.getValue = function() {
return this.view.element.getAttribute(this.name) || '';
};
+// Retrieves and returns the attribute's value if it has been dirtied since
+// the last time this method was called. Returns null otherwise.
+Attribute.prototype.getValueIfDirty = function() {
+ if (!this.dirty)
+ return null;
+ this.dirty = false;
+ return this.getValue();
+};
+
// Sets the attribute's value.
Attribute.prototype.setValue = function(value) {
this.view.element.setAttribute(this.name, value || '');
@@ -51,6 +61,7 @@ Attribute.prototype.maybeHandleMutation = function(oldValue, newValue) {
if (this.ignoreMutation)
return;
+ this.dirty = true;
this.handleMutation(oldValue, newValue);
};
« no previous file with comments | « extensions/browser/guest_view/guest_view_base.cc ('k') | extensions/renderer/resources/guest_view/web_view/web_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698