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

Side by Side Diff: src/promise.js

Issue 486763002: Make all global private symbols own symbols. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: HAS_DEFINED_PRIVATE is back Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/macros.py ('k') | src/runtime.h » ('j') | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 "use strict"; 5 "use strict";
6 6
7 // This file relies on the fact that the following declaration has been made 7 // This file relies on the fact that the following declaration has been made
8 // in runtime.js: 8 // in runtime.js:
9 // var $Object = global.Object 9 // var $Object = global.Object
10 // var $WeakMap = global.WeakMap 10 // var $WeakMap = global.WeakMap
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 function PromiseIdRejectHandler(r) { throw r } 139 function PromiseIdRejectHandler(r) { throw r }
140 140
141 function PromiseNopResolver() {} 141 function PromiseNopResolver() {}
142 142
143 // ------------------------------------------------------------------- 143 // -------------------------------------------------------------------
144 // Define exported functions. 144 // Define exported functions.
145 145
146 // For bootstrapper. 146 // For bootstrapper.
147 147
148 IsPromise = function IsPromise(x) { 148 IsPromise = function IsPromise(x) {
149 return IS_SPEC_OBJECT(x) && HAS_PRIVATE(x, promiseStatus); 149 return IS_SPEC_OBJECT(x) && HAS_DEFINED_PRIVATE(x, promiseStatus);
150 } 150 }
151 151
152 PromiseCreate = function PromiseCreate() { 152 PromiseCreate = function PromiseCreate() {
153 return new $Promise(PromiseNopResolver) 153 return new $Promise(PromiseNopResolver)
154 } 154 }
155 155
156 PromiseResolve = function PromiseResolve(promise, x) { 156 PromiseResolve = function PromiseResolve(promise, x) {
157 PromiseDone(promise, +1, x, promiseOnResolve) 157 PromiseDone(promise, +1, x, promiseOnResolve)
158 } 158 }
159 159
160 PromiseReject = function PromiseReject(promise, r) { 160 PromiseReject = function PromiseReject(promise, r) {
161 // Check promise status to confirm that this reject has an effect. 161 // Check promise status to confirm that this reject has an effect.
162 // Check promiseDebug property to avoid duplicate event. 162 // Check promiseDebug property to avoid duplicate event.
163 if (DEBUG_IS_ACTIVE && 163 if (DEBUG_IS_ACTIVE &&
164 GET_PRIVATE(promise, promiseStatus) == 0 && 164 GET_PRIVATE(promise, promiseStatus) == 0 &&
165 !HAS_PRIVATE(promise, promiseDebug)) { 165 !HAS_DEFINED_PRIVATE(promise, promiseDebug)) {
166 %DebugPromiseRejectEvent(promise, r); 166 %DebugPromiseRejectEvent(promise, r);
167 } 167 }
168 PromiseDone(promise, -1, r, promiseOnReject) 168 PromiseDone(promise, -1, r, promiseOnReject)
169 } 169 }
170 170
171 // Convenience. 171 // Convenience.
172 172
173 function PromiseDeferred() { 173 function PromiseDeferred() {
174 if (this === $Promise) { 174 if (this === $Promise) {
175 // Optimized case, avoid extra closure. 175 // Optimized case, avoid extra closure.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 "race", PromiseOne, 356 "race", PromiseOne,
357 "resolve", PromiseCast 357 "resolve", PromiseCast
358 ]); 358 ]);
359 InstallFunctions($Promise.prototype, DONT_ENUM, [ 359 InstallFunctions($Promise.prototype, DONT_ENUM, [
360 "chain", PromiseChain, 360 "chain", PromiseChain,
361 "then", PromiseThen, 361 "then", PromiseThen,
362 "catch", PromiseCatch 362 "catch", PromiseCatch
363 ]); 363 ]);
364 364
365 })(); 365 })();
OLDNEW
« no previous file with comments | « src/macros.py ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698