| OLD | NEW |
| 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/PeriodicSyncRegistration.h" | 9 #include "modules/background_sync/PeriodicSyncRegistration.h" |
| 10 #include "modules/background_sync/SyncError.h" | 10 #include "modules/background_sync/SyncError.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 delete(webSyncRegistrations); | 106 delete(webSyncRegistrations); |
| 107 } | 107 } |
| 108 return; | 108 return; |
| 109 } | 109 } |
| 110 | 110 |
| 111 if (!webSyncRegistrations) { | 111 if (!webSyncRegistrations) { |
| 112 m_resolver->resolve(v8::Null(m_resolver->scriptState()->isolate())); | 112 m_resolver->resolve(v8::Null(m_resolver->scriptState()->isolate())); |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 | 115 |
| 116 if (webSyncRegistrations->size() && (*webSyncRegistrations)[0]->periodicity
== blink::WebSyncRegistration::PeriodicityOneShot) { | 116 if (webSyncRegistrations->size() && (*webSyncRegistrations)[0]->periodicity
== WebSyncRegistration::PeriodicityOneShot) { |
| 117 Vector<SyncRegistration*> syncRegistrations; | 117 Vector<SyncRegistration*> syncRegistrations; |
| 118 for (size_t i = 0; i < webSyncRegistrations->size(); ++i) { | 118 for (size_t i = 0; i < webSyncRegistrations->size(); ++i) { |
| 119 WebSyncRegistration* webSyncRegistration = (*webSyncRegistrations)[i
]; | 119 WebSyncRegistration* webSyncRegistration = (*webSyncRegistrations)[i
]; |
| 120 SyncRegistration* reg = SyncRegistration::take(m_resolver.get(), web
SyncRegistration, m_serviceWorkerRegistration); | 120 SyncRegistration* reg = SyncRegistration::take(m_resolver.get(), web
SyncRegistration, m_serviceWorkerRegistration); |
| 121 syncRegistrations.append(reg); | 121 syncRegistrations.append(reg); |
| 122 } | 122 } |
| 123 delete(webSyncRegistrations); | 123 delete(webSyncRegistrations); |
| 124 m_resolver->resolve(syncRegistrations); | 124 m_resolver->resolve(syncRegistrations); |
| 125 } else { | 125 } else { |
| 126 Vector<PeriodicSyncRegistration*> syncRegistrations; | 126 Vector<PeriodicSyncRegistration*> syncRegistrations; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 137 void SyncGetRegistrationsCallbacks::onError(WebSyncError* error) | 137 void SyncGetRegistrationsCallbacks::onError(WebSyncError* error) |
| 138 { | 138 { |
| 139 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) { | 139 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) { |
| 140 SyncError::dispose(error); | 140 SyncError::dispose(error); |
| 141 return; | 141 return; |
| 142 } | 142 } |
| 143 m_resolver->reject(SyncError::take(m_resolver.get(), error)); | 143 m_resolver->reject(SyncError::take(m_resolver.get(), error)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace blink | 146 } // namespace blink |
| OLD | NEW |