Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: Source/bindings/core/v8/CallbackPromiseAdapter.h

Issue 787893002: Actually hook up ServiceWorkerRegistration.showNotification() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 return; 163 return;
164 } 164 }
165 m_resolver->reject(T::take(m_resolver.get(), error)); 165 m_resolver->reject(T::take(m_resolver.get(), error));
166 } 166 }
167 167
168 private: 168 private:
169 RefPtr<ScriptPromiseResolver> m_resolver; 169 RefPtr<ScriptPromiseResolver> m_resolver;
170 WTF_MAKE_NONCOPYABLE(CallbackPromiseAdapter); 170 WTF_MAKE_NONCOPYABLE(CallbackPromiseAdapter);
171 }; 171 };
172 172
173 template<>
174 class CallbackPromiseAdapter<void, void> final : public blink::WebCallbacks<void , void> {
175 public:
176 explicit CallbackPromiseAdapter(PassRefPtr<ScriptPromiseResolver> resolver)
177 : m_resolver(resolver)
178 {
179 ASSERT(m_resolver);
180 }
181 virtual ~CallbackPromiseAdapter() { }
182
183 virtual void onSuccess() override
184 {
185 if (!m_resolver->executionContext() || m_resolver->executionContext()->a ctiveDOMObjectsAreStopped())
186 return;
187 m_resolver->resolve();
188 }
189
190 virtual void onError() override
191 {
192 if (!m_resolver->executionContext() || m_resolver->executionContext()->a ctiveDOMObjectsAreStopped())
193 return;
194 m_resolver->reject();
195 }
196
197 private:
198 RefPtr<ScriptPromiseResolver> m_resolver;
199 WTF_MAKE_NONCOPYABLE(CallbackPromiseAdapter);
200 };
201
173 } // namespace blink 202 } // namespace blink
174 203
175 #endif 204 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698