Chromium Code Reviews| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 } | 178 } |
| 179 }; | 179 }; |
| 180 template <typename S, typename T> | 180 template <typename S, typename T> |
| 181 class OnError : public OnSuccess<S, T> { | 181 class OnError : public OnSuccess<S, T> { |
| 182 public: | 182 public: |
| 183 explicit OnError(ScriptPromiseResolver* resolver) : OnSuccess<S, T>(reso lver) {} | 183 explicit OnError(ScriptPromiseResolver* resolver) : OnSuccess<S, T>(reso lver) {} |
| 184 void onError(WebPassType<typename T::WebType> e) override | 184 void onError(WebPassType<typename T::WebType> e) override |
| 185 { | 185 { |
| 186 typename T::WebType result(adopt(e)); | 186 typename T::WebType result(adopt(e)); |
| 187 ScriptPromiseResolver* resolver = this->resolver(); | 187 ScriptPromiseResolver* resolver = this->resolver(); |
| 188 ScriptState::Scope scope(resolver->scriptState()); | |
|
whywhat
2015/10/13 15:59:04
nit: is this needed? shoulnd't this be part of a s
davve
2015/10/19 13:12:42
Gone now we're heading for DOMException instead.
| |
| 188 if (!resolver->executionContext() || resolver->executionContext()->a ctiveDOMObjectsAreStopped()) | 189 if (!resolver->executionContext() || resolver->executionContext()->a ctiveDOMObjectsAreStopped()) |
| 189 return; | 190 return; |
| 190 resolver->reject(T::take(resolver, pass(result))); | 191 resolver->reject(T::take(resolver, pass(result))); |
| 191 } | 192 } |
| 192 }; | 193 }; |
| 193 template <typename S> | 194 template <typename S> |
| 194 class OnError<S, CallbackPromiseAdapterTrivialWebTypeHolder<void>> : public OnSuccess<S, CallbackPromiseAdapterTrivialWebTypeHolder<void>> { | 195 class OnError<S, CallbackPromiseAdapterTrivialWebTypeHolder<void>> : public OnSuccess<S, CallbackPromiseAdapterTrivialWebTypeHolder<void>> { |
| 195 public: | 196 public: |
| 196 explicit OnError(ScriptPromiseResolver* resolver) : OnSuccess<S, Callbac kPromiseAdapterTrivialWebTypeHolder<void>>(resolver) {} | 197 explicit OnError(ScriptPromiseResolver* resolver) : OnSuccess<S, Callbac kPromiseAdapterTrivialWebTypeHolder<void>>(resolver) {} |
| 197 void onError() override | 198 void onError() override |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 213 }; | 214 }; |
| 214 | 215 |
| 215 } // namespace internal | 216 } // namespace internal |
| 216 | 217 |
| 217 template <typename S, typename T> | 218 template <typename S, typename T> |
| 218 using CallbackPromiseAdapter = internal::CallbackPromiseAdapterInternal::Callbac kPromiseAdapter<S, T>; | 219 using CallbackPromiseAdapter = internal::CallbackPromiseAdapterInternal::Callbac kPromiseAdapter<S, T>; |
| 219 | 220 |
| 220 } // namespace blink | 221 } // namespace blink |
| 221 | 222 |
| 222 #endif | 223 #endif |
| OLD | NEW |