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

Side by Side Diff: third_party/WebKit/Source/modules/background_sync/SyncCallbacks.cpp

Issue 1437883002: [Background Sync] Align exposed API with spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src@remove-periodic
Patch Set: Rebase Created 5 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/background_sync/SyncCallbacks.h" 6 #include "modules/background_sync/SyncCallbacks.h"
7 7
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "modules/background_sync/SyncError.h" 9 #include "modules/background_sync/SyncError.h"
10 #include "modules/background_sync/SyncRegistration.h" 10 #include "modules/background_sync/SyncRegistration.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 ASSERT(m_resolver); 113 ASSERT(m_resolver);
114 ASSERT(m_serviceWorkerRegistration); 114 ASSERT(m_serviceWorkerRegistration);
115 } 115 }
116 116
117 SyncGetRegistrationsCallbacks::~SyncGetRegistrationsCallbacks() 117 SyncGetRegistrationsCallbacks::~SyncGetRegistrationsCallbacks()
118 { 118 {
119 } 119 }
120 120
121 void SyncGetRegistrationsCallbacks::onSuccess(const WebVector<WebSyncRegistratio n*>& webSyncRegistrations) 121 void SyncGetRegistrationsCallbacks::onSuccess(const WebVector<WebSyncRegistratio n*>& webSyncRegistrations)
122 { 122 {
123 Vector<OwnPtr<WebSyncRegistration>> registrations;
124 for (WebSyncRegistration* r : webSyncRegistrations) {
125 registrations.append(adoptPtr(r));
126 }
jkarlin 2015/11/13 01:32:18 We now have a memory leak, webSyncRegistration's e
iclelland 2015/11/13 15:26:19 Maybe it's early and I haven't had enough coffee y
jkarlin 2015/11/13 17:00:42 My bad. I didn't realize that WebVector deleted it
127 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ eDOMObjectsAreStopped()) { 123 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ eDOMObjectsAreStopped()) {
128 return; 124 return;
129 } 125 }
130 126 Vector<String> tags;
131 HeapVector<Member<SyncRegistration>> syncRegistrations; 127 for (WebSyncRegistration* r : webSyncRegistrations) {
jkarlin 2015/11/13 01:32:18 const WebSyncRegistration*
iclelland 2015/11/13 15:26:19 Done.
jkarlin 2015/11/13 17:00:42 I don't see the change.
iclelland 2015/11/13 20:49:24 Okay, *really* done now.
132 for (auto& r : registrations) { 128 tags.append(r->tag);
133 SyncRegistration* reg = SyncRegistration::take(m_resolver.get(), r.relea se(), m_serviceWorkerRegistration);
134 syncRegistrations.append(reg);
135 } 129 }
136 m_resolver->resolve(syncRegistrations); 130 m_resolver->resolve(tags);
137 } 131 }
138 132
139 void SyncGetRegistrationsCallbacks::onError(const WebSyncError& error) 133 void SyncGetRegistrationsCallbacks::onError(const WebSyncError& error)
140 { 134 {
141 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ eDOMObjectsAreStopped()) { 135 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ eDOMObjectsAreStopped()) {
142 return; 136 return;
143 } 137 }
144 m_resolver->reject(SyncError::take(m_resolver.get(), error)); 138 m_resolver->reject(SyncError::take(m_resolver.get(), error));
145 } 139 }
146 140
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return "denied"; 177 return "denied";
184 case WebSyncPermissionStatusPrompt: 178 case WebSyncPermissionStatusPrompt:
185 return "prompt"; 179 return "prompt";
186 } 180 }
187 181
188 ASSERT_NOT_REACHED(); 182 ASSERT_NOT_REACHED();
189 return "denied"; 183 return "denied";
190 } 184 }
191 185
192 } // namespace blink 186 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698