diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-07-20 17:04:09 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-07-20 17:04:09 -0700 |
commit | c26f7b73011fb54ee8d979ca169578e5ea2e1cd3 (patch) | |
tree | c7fdbf382d15f65f989b48530a5f4e249e227b5e /src/library_browser.js | |
parent | f2273cc4c24954dd28638a710e144913f1b91d90 (diff) |
even better main loop blockers progress reporting
Diffstat (limited to 'src/library_browser.js')
-rw-r--r-- | src/library_browser.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/library_browser.js b/src/library_browser.js index b9570683..2b8ffc1d 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -25,9 +25,11 @@ mergeInto(LibraryManager.library, { }, updateStatus: function() { if (Module['setStatus']) { - if (Browser.mainLoop.queue.length > 0) { - if (Browser.mainLoop.blockersNum && Browser.mainLoop.blockersNum >= Browser.mainLoop.queue.length) { - Module['setStatus']('Please wait.. (' + Browser.mainLoop.queue.length + '/' + Browser.mainLoop.blockersNum + ')'); + var remaining = Browser.mainLoop.remainingBlockers; + var expected = Browser.mainLoop.expectedBlockers; + if (remaining) { + if (remaining < expected) { + Module['setStatus']('Please wait.. (' + remaining + '/' + expected + ')'); } else { Module['setStatus']('Please wait..'); } @@ -263,7 +265,10 @@ mergeInto(LibraryManager.library, { var jsFunc = FUNCTION_TABLE[func]; var wrapper = function() { if (Browser.mainLoop.queue.length > 0) { + var start = Date.now(); Browser.mainLoop.queue.shift()(); + console.log('main loop blocker took ' + (Date.now() - start) + ' ms'); + if (Browser.mainLoop.remainingBlockers) Browser.mainLoop.remainingBlockers--; Browser.mainLoop.updateStatus(); setTimeout(wrapper, 0); return; @@ -313,8 +318,9 @@ mergeInto(LibraryManager.library, { Browser.mainLoop.updateStatus(); }, - emscripten_set_main_loop_blockers_num: function(num) { - Browser.mainLoop.blockersNum = num; + emscripten_set_main_loop_expected_blockers: function(num) { + Browser.mainLoop.expectedBlockers = num; + Browser.mainLoop.remainingBlockers = num; Browser.mainLoop.updateStatus(); }, |