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

Side by Side Diff: Source/bindings/core/v8/ScriptPromise.h

Issue 1035623002: bindings: Use Maybe APIs in ScriptPromise (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | Source/bindings/core/v8/ScriptPromise.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // resolved with |value|. 108 // resolved with |value|.
109 // Returns |value| itself if it is a Promise. 109 // Returns |value| itself if it is a Promise.
110 static ScriptPromise cast(ScriptState*, const ScriptValue& /*value*/); 110 static ScriptPromise cast(ScriptState*, const ScriptValue& /*value*/);
111 static ScriptPromise cast(ScriptState*, v8::Handle<v8::Value> /*value*/); 111 static ScriptPromise cast(ScriptState*, v8::Handle<v8::Value> /*value*/);
112 112
113 static ScriptPromise reject(ScriptState*, const ScriptValue&); 113 static ScriptPromise reject(ScriptState*, const ScriptValue&);
114 static ScriptPromise reject(ScriptState*, v8::Handle<v8::Value>); 114 static ScriptPromise reject(ScriptState*, v8::Handle<v8::Value>);
115 115
116 static ScriptPromise rejectWithDOMException(ScriptState*, PassRefPtrWillBeRa wPtr<DOMException>); 116 static ScriptPromise rejectWithDOMException(ScriptState*, PassRefPtrWillBeRa wPtr<DOMException>);
117 117
118 static v8::Local<v8::Promise> rejectRaw(v8::Isolate*, v8::Handle<v8::Value>) ; 118 static v8::Local<v8::Promise> rejectRaw(ScriptState*, v8::Handle<v8::Value>) ;
119 119
120 // This is a utility class intended to be used internally. 120 // This is a utility class intended to be used internally.
121 // ScriptPromiseResolver is for general purpose. 121 // ScriptPromiseResolver is for general purpose.
122 class InternalResolver final { 122 class InternalResolver final {
123 public: 123 public:
124 explicit InternalResolver(ScriptState*); 124 explicit InternalResolver(ScriptState*);
125 v8::Local<v8::Promise> v8Promise() const; 125 v8::Local<v8::Promise> v8Promise() const;
126 ScriptPromise promise() const; 126 ScriptPromise promise() const;
127 void resolve(v8::Local<v8::Value>); 127 void resolve(v8::Local<v8::Value>);
128 void reject(v8::Local<v8::Value>); 128 void reject(v8::Local<v8::Value>);
129 void clear() { m_resolver.clear(); } 129 void clear() { m_resolver.clear(); }
130 130
131 private: 131 private:
132 ScriptValue m_resolver; 132 ScriptValue m_resolver;
133 }; 133 };
134 134
135 private: 135 private:
136 RefPtr<ScriptState> m_scriptState; 136 RefPtr<ScriptState> m_scriptState;
137 ScriptValue m_promise; 137 ScriptValue m_promise;
138 }; 138 };
139 139
140 } // namespace blink 140 } // namespace blink
141 141
142 142
143 #endif // ScriptPromise_h 143 #endif // ScriptPromise_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptPromise.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698