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

Side by Side Diff: Source/modules/push_messaging/PushSubscription.cpp

Issue 1304723002: [PushMessaging] Use appopriate type parameters for WebCallbacks (1/3). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 #include "modules/push_messaging/PushSubscription.h" 6 #include "modules/push_messaging/PushSubscription.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/V8ObjectBuilder.h" 10 #include "bindings/core/v8/V8ObjectBuilder.h"
11 #include "modules/push_messaging/PushError.h" 11 #include "modules/push_messaging/PushError.h"
12 #include "modules/serviceworkers/ServiceWorkerRegistration.h" 12 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
13 #include "public/platform/Platform.h" 13 #include "public/platform/Platform.h"
14 #include "public/platform/modules/push_messaging/WebPushProvider.h" 14 #include "public/platform/modules/push_messaging/WebPushProvider.h"
15 #include "public/platform/modules/push_messaging/WebPushSubscription.h" 15 #include "public/platform/modules/push_messaging/WebPushSubscription.h"
16 #include "wtf/OwnPtr.h" 16 #include "wtf/OwnPtr.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 PushSubscription* PushSubscription::take(ScriptPromiseResolver*, WebPushSubscrip tion* pushSubscription, ServiceWorkerRegistration* serviceWorkerRegistration) 20 PushSubscription* PushSubscription::take(ScriptPromiseResolver*, PassOwnPtr<WebP ushSubscription> pushSubscription, ServiceWorkerRegistration* serviceWorkerRegis tration)
21 { 21 {
22 OwnPtr<WebPushSubscription> subscription = adoptPtr(pushSubscription); 22 if (!pushSubscription)
23 return new PushSubscription(*subscription, serviceWorkerRegistration); 23 return nullptr;
24 return new PushSubscription(*pushSubscription, serviceWorkerRegistration);
24 } 25 }
25 26
26 void PushSubscription::dispose(WebPushSubscription* pushSubscription) 27 void PushSubscription::dispose(WebPushSubscription* pushSubscription)
27 { 28 {
28 if (pushSubscription) 29 if (pushSubscription)
29 delete pushSubscription; 30 delete pushSubscription;
30 } 31 }
31 32
32 PushSubscription::PushSubscription(const WebPushSubscription& subscription, Serv iceWorkerRegistration* serviceWorkerRegistration) 33 PushSubscription::PushSubscription(const WebPushSubscription& subscription, Serv iceWorkerRegistration* serviceWorkerRegistration)
33 : m_endpoint(subscription.endpoint) 34 : m_endpoint(subscription.endpoint)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 73
73 return result.scriptValue(); 74 return result.scriptValue();
74 } 75 }
75 76
76 DEFINE_TRACE(PushSubscription) 77 DEFINE_TRACE(PushSubscription)
77 { 78 {
78 visitor->trace(m_serviceWorkerRegistration); 79 visitor->trace(m_serviceWorkerRegistration);
79 } 80 }
80 81
81 } // namespace blink 82 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/push_messaging/PushSubscription.h ('k') | Source/modules/push_messaging/PushSubscriptionCallbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698