Index: Source/devtools/blink/chromeServerProfile/Default/Cache/f_000044 |
diff --git a/Source/devtools/front_end/UIUtils.js b/Source/devtools/blink/chromeServerProfile/Default/Cache/f_000044 |
similarity index 95% |
copy from Source/devtools/front_end/UIUtils.js |
copy to Source/devtools/blink/chromeServerProfile/Default/Cache/f_000044 |
index 1247e01145def93c39ab51c7613c96ee5823c5b2..e1a22692ef5ac9a66b2fa7a25268aa1de6e73662 100644 |
--- a/Source/devtools/front_end/UIUtils.js |
+++ b/Source/devtools/blink/chromeServerProfile/Default/Cache/f_000044 |
@@ -773,46 +773,24 @@ WebInspector.revertDomChanges = function(domChanges) |
} |
} |
-/** |
- * @constructor |
- * @param {boolean} autoInvoke |
- */ |
-WebInspector.InvokeOnceHandlers = function(autoInvoke) |
+WebInspector._coalescingLevel = 0; |
+ |
+WebInspector.startBatchUpdate = function() |
{ |
- this._handlers = null; |
- this._autoInvoke = autoInvoke; |
+ if (!WebInspector._coalescingLevel) |
+ WebInspector._postUpdateHandlers = new Map(); |
+ WebInspector._coalescingLevel++; |
} |
-WebInspector.InvokeOnceHandlers.prototype = { |
- /** |
- * @param {!Object} object |
- * @param {function()} method |
- */ |
- add: function(object, method) |
- { |
- if (!this._handlers) { |
- this._handlers = new Map(); |
- if (this._autoInvoke) |
- this.scheduleInvoke(); |
- } |
- var methods = this._handlers.get(object); |
- if (!methods) { |
- methods = new Set(); |
- this._handlers.put(object, methods); |
- } |
- methods.add(method); |
- }, |
+WebInspector.endBatchUpdate = function() |
+{ |
+ if (--WebInspector._coalescingLevel) |
+ return; |
- scheduleInvoke: function() |
- { |
- if (this._handlers) |
- requestAnimationFrame(this._invoke.bind(this)); |
- }, |
+ var handlers = WebInspector._postUpdateHandlers; |
+ delete WebInspector._postUpdateHandlers; |
- _invoke: function() |
- { |
- var handlers = this._handlers; |
- this._handlers = null; |
+ window.requestAnimationFrame(function() { |
var keys = handlers.keys(); |
for (var i = 0; i < keys.length; ++i) { |
var object = keys[i]; |
@@ -820,24 +798,7 @@ WebInspector.InvokeOnceHandlers.prototype = { |
for (var j = 0; j < methods.length; ++j) |
methods[j].call(object); |
} |
- } |
-} |
- |
-WebInspector._coalescingLevel = 0; |
-WebInspector._postUpdateHandlers = null; |
- |
-WebInspector.startBatchUpdate = function() |
-{ |
- if (!WebInspector._coalescingLevel++) |
- WebInspector._postUpdateHandlers = new WebInspector.InvokeOnceHandlers(false); |
-} |
- |
-WebInspector.endBatchUpdate = function() |
-{ |
- if (--WebInspector._coalescingLevel) |
- return; |
- WebInspector._postUpdateHandlers.scheduleInvoke(); |
- WebInspector._postUpdateHandlers = null; |
+ }); |
} |
/** |
@@ -846,9 +807,17 @@ WebInspector.endBatchUpdate = function() |
*/ |
WebInspector.invokeOnceAfterBatchUpdate = function(object, method) |
{ |
- if (!WebInspector._postUpdateHandlers) |
- WebInspector._postUpdateHandlers = new WebInspector.InvokeOnceHandlers(true); |
- WebInspector._postUpdateHandlers.add(object, method); |
+ if (!WebInspector._coalescingLevel) { |
+ window.requestAnimationFrame(method.bind(object)); |
+ return; |
+ } |
+ |
+ var methods = WebInspector._postUpdateHandlers.get(object); |
+ if (!methods) { |
+ methods = new Set(); |
+ WebInspector._postUpdateHandlers.put(object, methods); |
+ } |
+ methods.add(method); |
} |
;(function() { |