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

Side by Side Diff: include/v8.h

Issue 2589113002: [api] add API for Promise status and result. (Closed)
Patch Set: Created 4 years 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 | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')
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 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 3681 matching lines...) Expand 10 before | Expand all | Expand 10 after
3692 Function(); 3692 Function();
3693 static void CheckCast(Value* obj); 3693 static void CheckCast(Value* obj);
3694 }; 3694 };
3695 3695
3696 3696
3697 /** 3697 /**
3698 * An instance of the built-in Promise constructor (ES6 draft). 3698 * An instance of the built-in Promise constructor (ES6 draft).
3699 */ 3699 */
3700 class V8_EXPORT Promise : public Object { 3700 class V8_EXPORT Promise : public Object {
3701 public: 3701 public:
3702 enum PromiseStatus { kPending, kFulfilled, kRejected };
jochen (gone - plz use gerrit) 2016/12/20 07:49:52 why not an enum class? also, please add a comment
Yang 2016/12/20 11:38:27 enum class requires static_cast all over the place
3703
3702 class V8_EXPORT Resolver : public Object { 3704 class V8_EXPORT Resolver : public Object {
3703 public: 3705 public:
3704 /** 3706 /**
3705 * Create a new resolver, along with an associated promise in pending state. 3707 * Create a new resolver, along with an associated promise in pending state.
3706 */ 3708 */
3707 static V8_DEPRECATE_SOON("Use maybe version", 3709 static V8_DEPRECATE_SOON("Use maybe version",
3708 Local<Resolver> New(Isolate* isolate)); 3710 Local<Resolver> New(Isolate* isolate));
3709 static V8_WARN_UNUSED_RESULT MaybeLocal<Resolver> New( 3711 static V8_WARN_UNUSED_RESULT MaybeLocal<Resolver> New(
3710 Local<Context> context); 3712 Local<Context> context);
3711 3713
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3748 Local<Promise> Then(Local<Function> handler)); 3750 Local<Promise> Then(Local<Function> handler));
3749 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Then(Local<Context> context, 3751 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Then(Local<Context> context,
3750 Local<Function> handler); 3752 Local<Function> handler);
3751 3753
3752 /** 3754 /**
3753 * Returns true if the promise has at least one derived promise, and 3755 * Returns true if the promise has at least one derived promise, and
3754 * therefore resolve/reject handlers (including default handler). 3756 * therefore resolve/reject handlers (including default handler).
3755 */ 3757 */
3756 bool HasHandler(); 3758 bool HasHandler();
3757 3759
3760 MaybeLocal<Value> Result();
jochen (gone - plz use gerrit) 2016/12/20 07:49:52 please also add a comment to document this API (an
Yang 2016/12/20 11:38:27 Done.
3761
3762 PromiseStatus Status();
3763
3758 V8_INLINE static Promise* Cast(Value* obj); 3764 V8_INLINE static Promise* Cast(Value* obj);
3759 3765
3760 private: 3766 private:
3761 Promise(); 3767 Promise();
3762 static void CheckCast(Value* obj); 3768 static void CheckCast(Value* obj);
3763 }; 3769 };
3764 3770
3765 /** 3771 /**
3766 * An instance of a Property Descriptor, see Ecma-262 6.2.4. 3772 * An instance of a Property Descriptor, see Ecma-262 6.2.4.
3767 * 3773 *
(...skipping 5963 matching lines...) Expand 10 before | Expand all | Expand 10 after
9731 */ 9737 */
9732 9738
9733 9739
9734 } // namespace v8 9740 } // namespace v8
9735 9741
9736 9742
9737 #undef TYPE_CHECK 9743 #undef TYPE_CHECK
9738 9744
9739 9745
9740 #endif // INCLUDE_V8_H_ 9746 #endif // INCLUDE_V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698