Chromium Code Reviews| Index: src/v8natives.js |
| diff --git a/src/v8natives.js b/src/v8natives.js |
| index f183afb968f84df9b11c5438f2cfadc64d20068d..d787afa196447bc041fbc2834266ee1e7aecd3ce 100644 |
| --- a/src/v8natives.js |
| +++ b/src/v8natives.js |
| @@ -1893,14 +1893,6 @@ SetUpFunction(); |
| // Eventually, we should move to a real event queue that allows to maintain |
| // relative ordering of different kinds of tasks. |
| -function GetMicrotaskQueue() { |
| - var microtaskState = %GetMicrotaskState(); |
| - if (IS_UNDEFINED(microtaskState.queue)) { |
| - microtaskState.queue = new InternalArray; |
| - } |
| - return microtaskState.queue; |
| -} |
| - |
| function RunMicrotasks() { |
| while (%SetMicrotaskPending(false)) { |
| var microtaskState = %GetMicrotaskState(); |
| @@ -1908,7 +1900,7 @@ function RunMicrotasks() { |
| return; |
| var microtasks = microtaskState.queue; |
| - microtaskState.queue = new InternalArray; |
| + delete microtaskState.queue; |
|
rafaelw
2014/04/28 05:09:34
nit: assign NULL here (and check for NULL as well
kouhei (in TOK)
2014/04/28 05:22:29
Sorry I reverted the change by mistake. Done.
|
| for (var i = 0; i < microtasks.length; i++) { |
| microtasks[i](); |
| @@ -1916,7 +1908,11 @@ function RunMicrotasks() { |
| } |
| } |
| -function EnqueueExternalMicrotask(fn) { |
| - GetMicrotaskQueue().push(fn); |
| +function EnqueueMicrotask(fn) { |
| + var microtaskState = %GetMicrotaskState(); |
| + if (IS_UNDEFINED(microtaskState.queue)) { |
| + microtaskState.queue = new InternalArray; |
| + } |
| + microtaskState.queue.push(fn); |
| %SetMicrotaskPending(true); |
| } |