| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 template <typename S, typename T> | 182 template <typename S, typename T> |
| 183 class OnError : public OnSuccess<S, T> { | 183 class OnError : public OnSuccess<S, T> { |
| 184 public: | 184 public: |
| 185 explicit OnError(ScriptPromiseResolver* resolver) : OnSuccess<S, T>(reso
lver) {} | 185 explicit OnError(ScriptPromiseResolver* resolver) : OnSuccess<S, T>(reso
lver) {} |
| 186 void onError(WebPassType<typename T::WebType> e) override | 186 void onError(WebPassType<typename T::WebType> e) override |
| 187 { | 187 { |
| 188 typename T::WebType result(adopt(e)); | 188 typename T::WebType result(adopt(e)); |
| 189 ScriptPromiseResolver* resolver = this->resolver(); | 189 ScriptPromiseResolver* resolver = this->resolver(); |
| 190 if (!resolver->getExecutionContext() || resolver->getExecutionContex
t()->activeDOMObjectsAreStopped()) | 190 if (!resolver->getExecutionContext() || resolver->getExecutionContex
t()->activeDOMObjectsAreStopped()) |
| 191 return; | 191 return; |
| 192 ScriptState::Scope scope(resolver->getScriptState()); |
| 192 resolver->reject(T::take(resolver, pass(result))); | 193 resolver->reject(T::take(resolver, pass(result))); |
| 193 } | 194 } |
| 194 }; | 195 }; |
| 195 template <typename S> | 196 template <typename S> |
| 196 class OnError<S, CallbackPromiseAdapterTrivialWebTypeHolder<void>> : public
OnSuccess<S, CallbackPromiseAdapterTrivialWebTypeHolder<void>> { | 197 class OnError<S, CallbackPromiseAdapterTrivialWebTypeHolder<void>> : public
OnSuccess<S, CallbackPromiseAdapterTrivialWebTypeHolder<void>> { |
| 197 public: | 198 public: |
| 198 explicit OnError(ScriptPromiseResolver* resolver) : OnSuccess<S, Callbac
kPromiseAdapterTrivialWebTypeHolder<void>>(resolver) {} | 199 explicit OnError(ScriptPromiseResolver* resolver) : OnSuccess<S, Callbac
kPromiseAdapterTrivialWebTypeHolder<void>>(resolver) {} |
| 199 void onError() override | 200 void onError() override |
| 200 { | 201 { |
| 201 ScriptPromiseResolver* resolver = this->resolver(); | 202 ScriptPromiseResolver* resolver = this->resolver(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 215 }; | 216 }; |
| 216 | 217 |
| 217 } // namespace internal | 218 } // namespace internal |
| 218 | 219 |
| 219 template <typename S, typename T> | 220 template <typename S, typename T> |
| 220 using CallbackPromiseAdapter = internal::CallbackPromiseAdapterInternal::Callbac
kPromiseAdapter<S, T>; | 221 using CallbackPromiseAdapter = internal::CallbackPromiseAdapterInternal::Callbac
kPromiseAdapter<S, T>; |
| 221 | 222 |
| 222 } // namespace blink | 223 } // namespace blink |
| 223 | 224 |
| 224 #endif | 225 #endif |
| OLD | NEW |