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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 return; | 101 return; |
102 } | 102 } |
103 m_resolver->reject(T::take(m_resolver.get(), error)); | 103 m_resolver->reject(T::take(m_resolver.get(), error)); |
104 } | 104 } |
105 | 105 |
106 private: | 106 private: |
107 RefPtr<ScriptPromiseResolver> m_resolver; | 107 RefPtr<ScriptPromiseResolver> m_resolver; |
108 WTF_MAKE_NONCOPYABLE(CallbackPromiseAdapter); | 108 WTF_MAKE_NONCOPYABLE(CallbackPromiseAdapter); |
109 }; | 109 }; |
110 | 110 |
111 template<typename T> | |
112 class CallbackPromiseAdapter<void, T> FINAL : public blink::WebCallbacks<void, t ypename T::WebType> { | |
113 public: | |
114 CallbackPromiseAdapter(PassRefPtr<ScriptPromiseResolver> resolver) | |
esprehn
2014/08/19 19:24:53
explicit
| |
115 : m_resolver(resolver) | |
116 { | |
117 ASSERT(m_resolver); | |
118 } | |
119 virtual ~CallbackPromiseAdapter() { } | |
120 | |
121 virtual void onSuccess() OVERRIDE | |
122 { | |
123 if (!m_resolver->executionContext() || m_resolver->executionContext()->a ctiveDOMObjectsAreStopped()) { | |
124 return; | |
125 } | |
126 m_resolver->resolve(V8UndefinedType()); | |
127 } | |
128 | |
129 virtual void onError(typename T::WebType* error) OVERRIDE | |
130 { | |
131 if (!m_resolver->executionContext() || m_resolver->executionContext()->a ctiveDOMObjectsAreStopped()) { | |
132 T::dispose(error); | |
133 return; | |
134 } | |
135 m_resolver->reject(T::take(m_resolver.get(), error)); | |
136 } | |
137 | |
138 private: | |
139 RefPtr<ScriptPromiseResolver> m_resolver; | |
140 WTF_MAKE_NONCOPYABLE(CallbackPromiseAdapter); | |
141 }; | |
142 | |
111 } // namespace blink | 143 } // namespace blink |
112 | 144 |
113 #endif | 145 #endif |
OLD | NEW |