| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // Constructs and returns a ScriptPromise from |value|. | 111 // Constructs and returns a ScriptPromise from |value|. |
| 112 // if |value| is not a Promise object, returns a Promise object | 112 // if |value| is not a Promise object, returns a Promise object |
| 113 // resolved with |value|. | 113 // resolved with |value|. |
| 114 // Returns |value| itself if it is a Promise. | 114 // Returns |value| itself if it is a Promise. |
| 115 static ScriptPromise cast(ScriptState*, const ScriptValue& /*value*/); | 115 static ScriptPromise cast(ScriptState*, const ScriptValue& /*value*/); |
| 116 static ScriptPromise cast(ScriptState*, v8::Handle<v8::Value> /*value*/); | 116 static ScriptPromise cast(ScriptState*, v8::Handle<v8::Value> /*value*/); |
| 117 | 117 |
| 118 static ScriptPromise reject(ScriptState*, const ScriptValue&); | 118 static ScriptPromise reject(ScriptState*, const ScriptValue&); |
| 119 static ScriptPromise reject(ScriptState*, v8::Handle<v8::Value>); | 119 static ScriptPromise reject(ScriptState*, v8::Handle<v8::Value>); |
| 120 | 120 |
| 121 static ScriptPromise rejectWithDOMException(ScriptState*, PassRefPtrWillBeRa
wPtr<DOMException>); | 121 static ScriptPromise rejectWithDOMException(ScriptState*, DOMException*); |
| 122 | 122 |
| 123 static v8::Local<v8::Promise> rejectRaw(ScriptState*, v8::Handle<v8::Value>)
; | 123 static v8::Local<v8::Promise> rejectRaw(ScriptState*, v8::Handle<v8::Value>)
; |
| 124 | 124 |
| 125 // This is a utility class intended to be used internally. | 125 // This is a utility class intended to be used internally. |
| 126 // ScriptPromiseResolver is for general purpose. | 126 // ScriptPromiseResolver is for general purpose. |
| 127 class InternalResolver final { | 127 class InternalResolver final { |
| 128 public: | 128 public: |
| 129 explicit InternalResolver(ScriptState*); | 129 explicit InternalResolver(ScriptState*); |
| 130 v8::Local<v8::Promise> v8Promise() const; | 130 v8::Local<v8::Promise> v8Promise() const; |
| 131 ScriptPromise promise() const; | 131 ScriptPromise promise() const; |
| 132 void resolve(v8::Local<v8::Value>); | 132 void resolve(v8::Local<v8::Value>); |
| 133 void reject(v8::Local<v8::Value>); | 133 void reject(v8::Local<v8::Value>); |
| 134 void clear() { m_resolver.clear(); } | 134 void clear() { m_resolver.clear(); } |
| 135 | 135 |
| 136 private: | 136 private: |
| 137 ScriptValue m_resolver; | 137 ScriptValue m_resolver; |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 private: | 140 private: |
| 141 RefPtr<ScriptState> m_scriptState; | 141 RefPtr<ScriptState> m_scriptState; |
| 142 ScriptValue m_promise; | 142 ScriptValue m_promise; |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 } // namespace blink | 145 } // namespace blink |
| 146 | 146 |
| 147 | 147 |
| 148 #endif // ScriptPromise_h | 148 #endif // ScriptPromise_h |
| OLD | NEW |