OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
5 * Copyright (C) 2009 Joseph Pecoraro | 5 * Copyright (C) 2009 Joseph Pecoraro |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * | 10 * |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 } | 783 } |
784 | 784 |
785 WebInspector.endBatchUpdate = function() | 785 WebInspector.endBatchUpdate = function() |
786 { | 786 { |
787 if (--WebInspector._coalescingLevel) | 787 if (--WebInspector._coalescingLevel) |
788 return; | 788 return; |
789 | 789 |
790 var handlers = WebInspector._postUpdateHandlers; | 790 var handlers = WebInspector._postUpdateHandlers; |
791 delete WebInspector._postUpdateHandlers; | 791 delete WebInspector._postUpdateHandlers; |
792 | 792 |
793 var keys = handlers.keys(); | 793 window.requestAnimationFrame(function() { |
794 for (var i = 0; i < keys.length; ++i) { | 794 if (WebInspector._coalescingLevel) |
795 var object = keys[i]; | 795 return; |
796 var methods = handlers.get(object).keys(); | 796 var keys = handlers.keys(); |
797 for (var j = 0; j < methods.length; ++j) | 797 for (var i = 0; i < keys.length; ++i) { |
798 methods[j].call(object); | 798 var object = keys[i]; |
799 } | 799 var methods = handlers.get(object).keys(); |
| 800 for (var j = 0; j < methods.length; ++j) |
| 801 methods[j].call(object); |
| 802 } |
| 803 }); |
800 } | 804 } |
801 | 805 |
802 /** | 806 /** |
803 * @param {!Object} object | 807 * @param {!Object} object |
804 * @param {function()} method | 808 * @param {function()} method |
805 */ | 809 */ |
806 WebInspector.invokeOnceAfterBatchUpdate = function(object, method) | 810 WebInspector.invokeOnceAfterBatchUpdate = function(object, method) |
807 { | 811 { |
808 if (!WebInspector._coalescingLevel) { | 812 if (!WebInspector._coalescingLevel) { |
809 method.call(object); | 813 window.requestAnimationFrame(function() { |
| 814 if (!WebInspector._coalescingLevel) |
| 815 method.call(object); |
| 816 }); |
810 return; | 817 return; |
811 } | 818 } |
812 | 819 |
813 var methods = WebInspector._postUpdateHandlers.get(object); | 820 var methods = WebInspector._postUpdateHandlers.get(object); |
814 if (!methods) { | 821 if (!methods) { |
815 methods = new Map(); | 822 methods = new Map(); |
816 WebInspector._postUpdateHandlers.put(object, methods); | 823 WebInspector._postUpdateHandlers.put(object, methods); |
817 } | 824 } |
818 methods.put(method); | 825 methods.put(method); |
819 } | 826 } |
820 | 827 |
821 ;(function() { | 828 ;(function() { |
822 | 829 |
823 function windowLoaded() | 830 function windowLoaded() |
824 { | 831 { |
825 window.addEventListener("focus", WebInspector._windowFocused, false); | 832 window.addEventListener("focus", WebInspector._windowFocused, false); |
826 window.addEventListener("blur", WebInspector._windowBlurred, false); | 833 window.addEventListener("blur", WebInspector._windowBlurred, false); |
827 document.addEventListener("focus", WebInspector._focusChanged, true); | 834 document.addEventListener("focus", WebInspector._focusChanged, true); |
828 document.addEventListener("blur", WebInspector._documentBlurred, true); | 835 document.addEventListener("blur", WebInspector._documentBlurred, true); |
829 window.removeEventListener("DOMContentLoaded", windowLoaded, false); | 836 window.removeEventListener("DOMContentLoaded", windowLoaded, false); |
830 } | 837 } |
831 | 838 |
832 window.addEventListener("DOMContentLoaded", windowLoaded, false); | 839 window.addEventListener("DOMContentLoaded", windowLoaded, false); |
833 | 840 |
834 })(); | 841 })(); |
OLD | NEW |