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

Side by Side Diff: Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp

Issue 1233173002: Have ScriptPromiseResolver on the Oilpan heap always. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase upto conflicting r199893 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
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/notifications/ServiceWorkerRegistrationNotifications.h" 6 #include "modules/notifications/ServiceWorkerRegistrationNotifications.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return exceptionState.reject(scriptState); 71 return exceptionState.reject(scriptState);
72 72
73 data->toWireBytes(dataAsWireBytes); 73 data->toWireBytes(dataAsWireBytes);
74 } 74 }
75 75
76 for (const NotificationAction& action : options.actions()) { 76 for (const NotificationAction& action : options.actions()) {
77 if (action.title().isEmpty()) 77 if (action.title().isEmpty())
78 return ScriptPromise::reject(scriptState, V8ThrowException::createTy peError(scriptState->isolate(), "Notification action titles must not be empty.") ); 78 return ScriptPromise::reject(scriptState, V8ThrowException::createTy peError(scriptState->isolate(), "Notification action titles must not be empty.") );
79 } 79 }
80 80
81 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 81 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
82 ScriptPromise promise = resolver->promise(); 82 ScriptPromise promise = resolver->promise();
83 83
84 // FIXME: Do the appropriate CORS checks on the icon URL. 84 // FIXME: Do the appropriate CORS checks on the icon URL.
85 85
86 KURL iconUrl; 86 KURL iconUrl;
87 if (options.hasIcon() && !options.icon().isEmpty()) { 87 if (options.hasIcon() && !options.icon().isEmpty()) {
88 iconUrl = executionContext->completeURL(options.icon()); 88 iconUrl = executionContext->completeURL(options.icon());
89 if (!iconUrl.isValid()) 89 if (!iconUrl.isValid())
90 iconUrl = KURL(); 90 iconUrl = KURL();
91 } 91 }
(...skipping 10 matching lines...) Expand all
102 102
103 WebNotificationManager* notificationManager = Platform::current()->notificat ionManager(); 103 WebNotificationManager* notificationManager = Platform::current()->notificat ionManager();
104 ASSERT(notificationManager); 104 ASSERT(notificationManager);
105 105
106 notificationManager->showPersistent(WebSecurityOrigin(origin), notification, serviceWorkerRegistration.webRegistration(), callbacks); 106 notificationManager->showPersistent(WebSecurityOrigin(origin), notification, serviceWorkerRegistration.webRegistration(), callbacks);
107 return promise; 107 return promise;
108 } 108 }
109 109
110 ScriptPromise ServiceWorkerRegistrationNotifications::getNotifications(ScriptSta te* scriptState, ServiceWorkerRegistration& serviceWorkerRegistration, const Get NotificationOptions& options) 110 ScriptPromise ServiceWorkerRegistrationNotifications::getNotifications(ScriptSta te* scriptState, ServiceWorkerRegistration& serviceWorkerRegistration, const Get NotificationOptions& options)
111 { 111 {
112 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 112 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
113 ScriptPromise promise = resolver->promise(); 113 ScriptPromise promise = resolver->promise();
114 114
115 WebNotificationGetCallbacks* callbacks = new CallbackPromiseAdapter<Notifica tionArray, void>(resolver); 115 WebNotificationGetCallbacks* callbacks = new CallbackPromiseAdapter<Notifica tionArray, void>(resolver);
116 116
117 WebNotificationManager* notificationManager = Platform::current()->notificat ionManager(); 117 WebNotificationManager* notificationManager = Platform::current()->notificat ionManager();
118 ASSERT(notificationManager); 118 ASSERT(notificationManager);
119 119
120 notificationManager->getNotifications(options.tag(), serviceWorkerRegistrati on.webRegistration(), callbacks); 120 notificationManager->getNotifications(options.tag(), serviceWorkerRegistrati on.webRegistration(), callbacks);
121 return promise; 121 return promise;
122 } 122 }
123 123
124 } // namespace blink 124 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698