OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return existingServiceWorker; | 151 return existingServiceWorker; |
152 } | 152 } |
153 | 153 |
154 return create(executionContext, adoptPtr(worker)); | 154 return create(executionContext, adoptPtr(worker)); |
155 } | 155 } |
156 | 156 |
157 PassRefPtrWillBeRawPtr<ServiceWorker> ServiceWorker::from(ScriptPromiseResolver*
resolver, WebType* worker) | 157 PassRefPtrWillBeRawPtr<ServiceWorker> ServiceWorker::from(ScriptPromiseResolver*
resolver, WebType* worker) |
158 { | 158 { |
159 RefPtrWillBeRawPtr<ServiceWorker> serviceWorker = ServiceWorker::from(resolv
er->scriptState()->executionContext(), worker); | 159 RefPtrWillBeRawPtr<ServiceWorker> serviceWorker = ServiceWorker::from(resolv
er->scriptState()->executionContext(), worker); |
160 ScriptState::Scope scope(resolver->scriptState()); | 160 ScriptState::Scope scope(resolver->scriptState()); |
161 serviceWorker->waitOnPromise(resolver->promise()); | 161 if (serviceWorker->m_proxyState == Initial) |
| 162 serviceWorker->waitOnPromise(resolver->promise()); |
162 return serviceWorker; | 163 return serviceWorker; |
163 } | 164 } |
164 | 165 |
165 void ServiceWorker::setProxyState(ProxyState state) | 166 void ServiceWorker::setProxyState(ProxyState state) |
166 { | 167 { |
167 if (m_proxyState == state) | 168 if (m_proxyState == state) |
168 return; | 169 return; |
169 switch (m_proxyState) { | 170 switch (m_proxyState) { |
170 case Initial: | 171 case Initial: |
171 ASSERT(state == RegisterPromisePending || state == ContextStopped); | 172 ASSERT(state == RegisterPromisePending || state == ContextStopped); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 , WebServiceWorkerProxy(this) | 233 , WebServiceWorkerProxy(this) |
233 , m_outerWorker(worker) | 234 , m_outerWorker(worker) |
234 , m_proxyState(Initial) | 235 , m_proxyState(Initial) |
235 { | 236 { |
236 ScriptWrappable::init(this); | 237 ScriptWrappable::init(this); |
237 ASSERT(m_outerWorker); | 238 ASSERT(m_outerWorker); |
238 m_outerWorker->setProxy(this); | 239 m_outerWorker->setProxy(this); |
239 } | 240 } |
240 | 241 |
241 } // namespace blink | 242 } // namespace blink |
OLD | NEW |