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

Side by Side Diff: src/v8natives.js

Issue 250883002: Fix |RunMicrotasks()| leaking reference to the last context being run on. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: remove external_ Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/promise.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 1886
1887 SetUpFunction(); 1887 SetUpFunction();
1888 1888
1889 1889
1890 //---------------------------------------------------------------------------- 1890 //----------------------------------------------------------------------------
1891 1891
1892 // TODO(rossberg): very simple abstraction for generic microtask queue. 1892 // TODO(rossberg): very simple abstraction for generic microtask queue.
1893 // Eventually, we should move to a real event queue that allows to maintain 1893 // Eventually, we should move to a real event queue that allows to maintain
1894 // relative ordering of different kinds of tasks. 1894 // relative ordering of different kinds of tasks.
1895 1895
1896 function GetMicrotaskQueue() {
1897 var microtaskState = %GetMicrotaskState();
1898 if (IS_UNDEFINED(microtaskState.queue)) {
1899 microtaskState.queue = new InternalArray;
1900 }
1901 return microtaskState.queue;
1902 }
1903
1904 function RunMicrotasks() { 1896 function RunMicrotasks() {
1905 while (%SetMicrotaskPending(false)) { 1897 while (%SetMicrotaskPending(false)) {
1906 var microtaskState = %GetMicrotaskState(); 1898 var microtaskState = %GetMicrotaskState();
1907 if (IS_UNDEFINED(microtaskState.queue)) 1899 if (IS_UNDEFINED(microtaskState.queue))
1908 return; 1900 return;
1909 1901
1910 var microtasks = microtaskState.queue; 1902 var microtasks = microtaskState.queue;
1911 microtaskState.queue = new InternalArray; 1903 microtaskState.queue = null;
1912 1904
1913 for (var i = 0; i < microtasks.length; i++) { 1905 for (var i = 0; i < microtasks.length; i++) {
1914 microtasks[i](); 1906 microtasks[i]();
1915 } 1907 }
1916 } 1908 }
1917 } 1909 }
1918 1910
1919 function EnqueueExternalMicrotask(fn) { 1911 function EnqueueMicrotask(fn) {
1920 GetMicrotaskQueue().push(fn); 1912 var microtaskState = %GetMicrotaskState();
1913 if (IS_UNDEFINED(microtaskState.queue) || IS_NULL(microtaskState.queue)) {
1914 microtaskState.queue = new InternalArray;
1915 }
1916 microtaskState.queue.push(fn);
1921 %SetMicrotaskPending(true); 1917 %SetMicrotaskPending(true);
1922 } 1918 }
OLDNEW
« no previous file with comments | « src/promise.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698