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" |
11 #include "modules/background_sync/SyncRegistration.h" | 11 #include "modules/background_sync/SyncRegistration.h" |
12 #include "modules/serviceworkers/ServiceWorkerRegistration.h" | 12 #include "modules/serviceworkers/ServiceWorkerRegistration.h" |
13 #include "wtf/OwnPtr.h" | 13 #include "wtf/OwnPtr.h" |
14 #include "wtf/PassOwnPtr.h" | 14 #include "wtf/PassOwnPtr.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 SyncRegistrationCallbacks::SyncRegistrationCallbacks(PassRefPtrWillBeRawPtr<Scri
ptPromiseResolver> resolver, ServiceWorkerRegistration* serviceWorkerRegistratio
n) | 18 SyncRegistrationCallbacks::SyncRegistrationCallbacks(ScriptPromiseResolver* reso
lver, ServiceWorkerRegistration* serviceWorkerRegistration) |
19 : m_resolver(resolver) | 19 : m_resolver(resolver) |
20 , m_serviceWorkerRegistration(serviceWorkerRegistration) | 20 , m_serviceWorkerRegistration(serviceWorkerRegistration) |
21 { | 21 { |
22 ASSERT(m_resolver); | 22 ASSERT(m_resolver); |
23 ASSERT(m_serviceWorkerRegistration); | 23 ASSERT(m_serviceWorkerRegistration); |
24 } | 24 } |
25 | 25 |
26 SyncRegistrationCallbacks::~SyncRegistrationCallbacks() | 26 SyncRegistrationCallbacks::~SyncRegistrationCallbacks() |
27 { | 27 { |
28 } | 28 } |
(...skipping 21 matching lines...) Expand all Loading... |
50 | 50 |
51 void SyncRegistrationCallbacks::onError(WebSyncError* error) | 51 void SyncRegistrationCallbacks::onError(WebSyncError* error) |
52 { | 52 { |
53 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) { | 53 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) { |
54 SyncError::dispose(error); | 54 SyncError::dispose(error); |
55 return; | 55 return; |
56 } | 56 } |
57 m_resolver->reject(SyncError::take(m_resolver.get(), error)); | 57 m_resolver->reject(SyncError::take(m_resolver.get(), error)); |
58 } | 58 } |
59 | 59 |
60 SyncUnregistrationCallbacks::SyncUnregistrationCallbacks(PassRefPtrWillBeRawPtr<
ScriptPromiseResolver> resolver, ServiceWorkerRegistration* serviceWorkerRegistr
ation) | 60 SyncUnregistrationCallbacks::SyncUnregistrationCallbacks(ScriptPromiseResolver*
resolver, ServiceWorkerRegistration* serviceWorkerRegistration) |
61 : m_resolver(resolver) | 61 : m_resolver(resolver) |
62 , m_serviceWorkerRegistration(serviceWorkerRegistration) | 62 , m_serviceWorkerRegistration(serviceWorkerRegistration) |
63 { | 63 { |
64 ASSERT(m_resolver); | 64 ASSERT(m_resolver); |
65 ASSERT(m_serviceWorkerRegistration); | 65 ASSERT(m_serviceWorkerRegistration); |
66 } | 66 } |
67 | 67 |
68 SyncUnregistrationCallbacks::~SyncUnregistrationCallbacks() | 68 SyncUnregistrationCallbacks::~SyncUnregistrationCallbacks() |
69 { | 69 { |
70 } | 70 } |
(...skipping 10 matching lines...) Expand all Loading... |
81 | 81 |
82 void SyncUnregistrationCallbacks::onError(WebSyncError* error) | 82 void SyncUnregistrationCallbacks::onError(WebSyncError* error) |
83 { | 83 { |
84 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) { | 84 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) { |
85 SyncError::dispose(error); | 85 SyncError::dispose(error); |
86 return; | 86 return; |
87 } | 87 } |
88 m_resolver->reject(SyncError::take(m_resolver.get(), error)); | 88 m_resolver->reject(SyncError::take(m_resolver.get(), error)); |
89 } | 89 } |
90 | 90 |
91 SyncGetRegistrationsCallbacks::SyncGetRegistrationsCallbacks(PassRefPtrWillBeRaw
Ptr<ScriptPromiseResolver> resolver, ServiceWorkerRegistration* serviceWorkerReg
istration) | 91 SyncGetRegistrationsCallbacks::SyncGetRegistrationsCallbacks(ScriptPromiseResolv
er* resolver, ServiceWorkerRegistration* serviceWorkerRegistration) |
92 : m_resolver(resolver) | 92 : m_resolver(resolver) |
93 , m_serviceWorkerRegistration(serviceWorkerRegistration) | 93 , m_serviceWorkerRegistration(serviceWorkerRegistration) |
94 { | 94 { |
95 ASSERT(m_resolver); | 95 ASSERT(m_resolver); |
96 ASSERT(m_serviceWorkerRegistration); | 96 ASSERT(m_serviceWorkerRegistration); |
97 } | 97 } |
98 | 98 |
99 SyncGetRegistrationsCallbacks::~SyncGetRegistrationsCallbacks() | 99 SyncGetRegistrationsCallbacks::~SyncGetRegistrationsCallbacks() |
100 { | 100 { |
101 } | 101 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 void SyncGetRegistrationsCallbacks::onError(WebSyncError* error) | 140 void SyncGetRegistrationsCallbacks::onError(WebSyncError* error) |
141 { | 141 { |
142 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) { | 142 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) { |
143 SyncError::dispose(error); | 143 SyncError::dispose(error); |
144 return; | 144 return; |
145 } | 145 } |
146 m_resolver->reject(SyncError::take(m_resolver.get(), error)); | 146 m_resolver->reject(SyncError::take(m_resolver.get(), error)); |
147 } | 147 } |
148 | 148 |
149 SyncGetPermissionStatusCallbacks::SyncGetPermissionStatusCallbacks(PassRefPtrWil
lBeRawPtr<ScriptPromiseResolver> resolver, ServiceWorkerRegistration* serviceWor
kerRegistration) | 149 SyncGetPermissionStatusCallbacks::SyncGetPermissionStatusCallbacks(ScriptPromise
Resolver* resolver, ServiceWorkerRegistration* serviceWorkerRegistration) |
150 : m_resolver(resolver) | 150 : m_resolver(resolver) |
151 , m_serviceWorkerRegistration(serviceWorkerRegistration) | 151 , m_serviceWorkerRegistration(serviceWorkerRegistration) |
152 { | 152 { |
153 ASSERT(m_resolver); | 153 ASSERT(m_resolver); |
154 ASSERT(m_serviceWorkerRegistration); | 154 ASSERT(m_serviceWorkerRegistration); |
155 } | 155 } |
156 | 156 |
157 SyncGetPermissionStatusCallbacks::~SyncGetPermissionStatusCallbacks() | 157 SyncGetPermissionStatusCallbacks::~SyncGetPermissionStatusCallbacks() |
158 { | 158 { |
159 } | 159 } |
(...skipping 27 matching lines...) Expand all Loading... |
187 return "denied"; | 187 return "denied"; |
188 case WebSyncPermissionStatusPrompt: | 188 case WebSyncPermissionStatusPrompt: |
189 return "prompt"; | 189 return "prompt"; |
190 } | 190 } |
191 | 191 |
192 ASSERT_NOT_REACHED(); | 192 ASSERT_NOT_REACHED(); |
193 return "denied"; | 193 return "denied"; |
194 } | 194 } |
195 | 195 |
196 } // namespace blink | 196 } // namespace blink |
OLD | NEW |