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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 14
14 namespace blink { 15 namespace blink {
15 16
16 PushSubscriptionCallbacks::PushSubscriptionCallbacks(ScriptPromiseResolver* reso lver, ServiceWorkerRegistration* serviceWorkerRegistration) 17 PushSubscriptionCallbacks::PushSubscriptionCallbacks(ScriptPromiseResolver* reso lver, ServiceWorkerRegistration* serviceWorkerRegistration)
17 : m_resolver(resolver) 18 : m_resolver(resolver)
18 , m_serviceWorkerRegistration(serviceWorkerRegistration) 19 , m_serviceWorkerRegistration(serviceWorkerRegistration)
19 { 20 {
20 DCHECK(m_resolver); 21 DCHECK(m_resolver);
21 DCHECK(m_serviceWorkerRegistration); 22 DCHECK(m_serviceWorkerRegistration);
22 } 23 }
23 24
24 PushSubscriptionCallbacks::~PushSubscriptionCallbacks() 25 PushSubscriptionCallbacks::~PushSubscriptionCallbacks()
25 { 26 {
26 } 27 }
27 28
28 void PushSubscriptionCallbacks::onSuccess(std::unique_ptr<WebPushSubscription> w ebPushSubscription) 29 void PushSubscriptionCallbacks::onSuccess(std::unique_ptr<WebPushSubscription> w ebPushSubscription)
29 { 30 {
30 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped()) 31 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped())
31 return; 32 return;
32 33
33 m_resolver->resolve(PushSubscription::take(m_resolver.get(), adoptPtr(webPus hSubscription.release()), m_serviceWorkerRegistration)); 34 m_resolver->resolve(PushSubscription::take(m_resolver.get(), wrapUnique(webP ushSubscription.release()), m_serviceWorkerRegistration));
34 } 35 }
35 36
36 void PushSubscriptionCallbacks::onError(const WebPushError& error) 37 void PushSubscriptionCallbacks::onError(const WebPushError& error)
37 { 38 {
38 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped()) 39 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped())
39 return; 40 return;
40 m_resolver->reject(PushError::take(m_resolver.get(), error)); 41 m_resolver->reject(PushError::take(m_resolver.get(), error));
41 } 42 }
42 43
43 } // namespace blink 44 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698