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

Side by Side Diff: src/promise.js

Issue 357603005: Introduce debug events for promises. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase and addressed comments Created 6 years, 5 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/debug-debugger.js ('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 20 matching lines...) Expand all
31 var promiseRaw = GLOBAL_PRIVATE("Promise#raw"); 31 var promiseRaw = GLOBAL_PRIVATE("Promise#raw");
32 32
33 (function() { 33 (function() {
34 34
35 var $Promise = function Promise(resolver) { 35 var $Promise = function Promise(resolver) {
36 if (resolver === promiseRaw) return; 36 if (resolver === promiseRaw) return;
37 if (!%_IsConstructCall()) throw MakeTypeError('not_a_promise', [this]); 37 if (!%_IsConstructCall()) throw MakeTypeError('not_a_promise', [this]);
38 if (!IS_SPEC_FUNCTION(resolver)) 38 if (!IS_SPEC_FUNCTION(resolver))
39 throw MakeTypeError('resolver_not_a_function', [resolver]); 39 throw MakeTypeError('resolver_not_a_function', [resolver]);
40 var promise = PromiseInit(this); 40 var promise = PromiseInit(this);
41 if (DEBUG_IS_ACTIVE) {
42 %DebugPromiseEvent({ type : "new Promise",
43 promise: this,
44 resolver: resolver });
45 }
41 try { 46 try {
42 %DebugPromiseHandlePrologue(function() { return promise }); 47 %DebugPromiseHandlePrologue(function() { return promise });
43 resolver(function(x) { PromiseResolve(promise, x) }, 48 resolver(function(x) { PromiseResolve(promise, x) },
44 function(r) { PromiseReject(promise, r) }); 49 function(r) { PromiseReject(promise, r) });
45 } catch (e) { 50 } catch (e) {
46 PromiseReject(promise, e); 51 PromiseReject(promise, e);
47 } finally { 52 } finally {
48 %DebugPromiseHandleEpilogue(); 53 %DebugPromiseHandleEpilogue();
49 } 54 }
50 } 55 }
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 "race", PromiseOne, 313 "race", PromiseOne,
309 "resolve", PromiseCast 314 "resolve", PromiseCast
310 ]); 315 ]);
311 InstallFunctions($Promise.prototype, DONT_ENUM, [ 316 InstallFunctions($Promise.prototype, DONT_ENUM, [
312 "chain", PromiseChain, 317 "chain", PromiseChain,
313 "then", PromiseThen, 318 "then", PromiseThen,
314 "catch", PromiseCatch 319 "catch", PromiseCatch
315 ]); 320 ]);
316 321
317 })(); 322 })();
OLDNEW
« no previous file with comments | « src/debug-debugger.js ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698