OLD | NEW |
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // This is a utility class intended to be used internally. | 119 // This is a utility class intended to be used internally. |
120 // ScriptPromiseResolver is for general purpose. | 120 // ScriptPromiseResolver is for general purpose. |
121 class InternalResolver final { | 121 class InternalResolver final { |
122 public: | 122 public: |
123 explicit InternalResolver(ScriptState*); | 123 explicit InternalResolver(ScriptState*); |
124 v8::Local<v8::Promise> v8Promise() const; | 124 v8::Local<v8::Promise> v8Promise() const; |
125 ScriptPromise promise() const; | 125 ScriptPromise promise() const; |
126 void resolve(v8::Local<v8::Value>); | 126 void resolve(v8::Local<v8::Value>); |
127 void reject(v8::Local<v8::Value>); | 127 void reject(v8::Local<v8::Value>); |
128 void clear() { m_resolver.clear(); } | 128 void clear() { m_resolver.clear(); } |
| 129 bool cleared() const { return m_resolver.isEmpty(); } |
129 | 130 |
130 private: | 131 private: |
131 ScriptValue m_resolver; | 132 ScriptValue m_resolver; |
132 }; | 133 }; |
133 | 134 |
134 private: | 135 private: |
135 RefPtr<ScriptState> m_scriptState; | 136 RefPtr<ScriptState> m_scriptState; |
136 ScriptValue m_promise; | 137 ScriptValue m_promise; |
137 }; | 138 }; |
138 | 139 |
139 } // namespace blink | 140 } // namespace blink |
140 | 141 |
141 | 142 |
142 #endif // ScriptPromise_h | 143 #endif // ScriptPromise_h |
OLD | NEW |