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

Side by Side Diff: third_party/WebKit/Source/modules/push_messaging/PushSubscriptionCallbacks.cpp

Issue 2433773006: Remove ExecutionContext::activeDOMObjectsAreStopped()
Patch Set: Created 4 years, 2 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/push_messaging/PushSubscriptionCallbacks.h" 5 #include "modules/push_messaging/PushSubscriptionCallbacks.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "modules/push_messaging/PushError.h" 8 #include "modules/push_messaging/PushError.h"
9 #include "modules/push_messaging/PushSubscription.h" 9 #include "modules/push_messaging/PushSubscription.h"
10 #include "modules/serviceworkers/ServiceWorkerRegistration.h" 10 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
11 #include "public/platform/modules/push_messaging/WebPushSubscription.h" 11 #include "public/platform/modules/push_messaging/WebPushSubscription.h"
12 #include "wtf/Assertions.h" 12 #include "wtf/Assertions.h"
13 #include "wtf/PtrUtil.h" 13 #include <utility>
14 14
15 namespace blink { 15 namespace blink {
16 16
17 PushSubscriptionCallbacks::PushSubscriptionCallbacks( 17 PushSubscriptionCallbacks::PushSubscriptionCallbacks(
18 ScriptPromiseResolver* resolver, 18 ScriptPromiseResolver* resolver,
19 ServiceWorkerRegistration* serviceWorkerRegistration) 19 ServiceWorkerRegistration* serviceWorkerRegistration)
20 : m_resolver(resolver), 20 : m_resolver(resolver),
21 m_serviceWorkerRegistration(serviceWorkerRegistration) { 21 m_serviceWorkerRegistration(serviceWorkerRegistration) {
22 DCHECK(m_resolver); 22 DCHECK(m_resolver);
23 DCHECK(m_serviceWorkerRegistration); 23 DCHECK(m_serviceWorkerRegistration);
24 } 24 }
25 25
26 PushSubscriptionCallbacks::~PushSubscriptionCallbacks() {} 26 PushSubscriptionCallbacks::~PushSubscriptionCallbacks() {}
27 27
28 void PushSubscriptionCallbacks::onSuccess( 28 void PushSubscriptionCallbacks::onSuccess(
29 std::unique_ptr<WebPushSubscription> webPushSubscription) { 29 std::unique_ptr<WebPushSubscription> webPushSubscription) {
30 if (!m_resolver->getExecutionContext() || 30 if (!m_resolver->getExecutionContext())
31 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
32 return; 31 return;
33 32
34 m_resolver->resolve(PushSubscription::take( 33 m_resolver->resolve(PushSubscription::take(m_resolver.get(),
35 m_resolver.get(), wrapUnique(webPushSubscription.release()), 34 std::move(webPushSubscription),
36 m_serviceWorkerRegistration)); 35 m_serviceWorkerRegistration));
37 } 36 }
38 37
39 void PushSubscriptionCallbacks::onError(const WebPushError& error) { 38 void PushSubscriptionCallbacks::onError(const WebPushError& error) {
40 if (!m_resolver->getExecutionContext() || 39 if (!m_resolver->getExecutionContext())
41 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
42 return; 40 return;
43 m_resolver->reject(PushError::take(m_resolver.get(), error)); 41 m_resolver->reject(PushError::take(m_resolver.get(), error));
44 } 42 }
45 43
46 } // namespace blink 44 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698