| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 case blink::WebServiceWorkerStateActive: | 130 case blink::WebServiceWorkerStateActive: |
| 131 return active; | 131 return active; |
| 132 case blink::WebServiceWorkerStateDeactivated: | 132 case blink::WebServiceWorkerStateDeactivated: |
| 133 return deactivated; | 133 return deactivated; |
| 134 default: | 134 default: |
| 135 ASSERT_NOT_REACHED(); | 135 ASSERT_NOT_REACHED(); |
| 136 return nullAtom; | 136 return nullAtom; |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 PassRefPtr<ServiceWorker> ServiceWorker::from(ScriptState* scriptState, WebType*
worker) | 140 PassRefPtr<ServiceWorker> ServiceWorker::from(ExecutionContext* executionContext
, WebType* worker) |
| 141 { | 141 { |
| 142 blink::WebServiceWorkerProxy* proxy = worker->proxy(); | 142 blink::WebServiceWorkerProxy* proxy = worker->proxy(); |
| 143 ServiceWorker* existingServiceWorker = proxy ? proxy->unwrap() : 0; | 143 ServiceWorker* existingServiceWorker = proxy ? proxy->unwrap() : 0; |
| 144 if (existingServiceWorker) { | 144 if (existingServiceWorker) { |
| 145 ASSERT(existingServiceWorker->executionContext() == scriptState->executi
onContext()); | 145 ASSERT(existingServiceWorker->executionContext() == executionContext); |
| 146 return existingServiceWorker; | 146 return existingServiceWorker; |
| 147 } | 147 } |
| 148 | 148 |
| 149 return create(scriptState->executionContext(), adoptPtr(worker)); | 149 return create(executionContext, adoptPtr(worker)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 PassRefPtr<ServiceWorker> ServiceWorker::from(ScriptPromiseResolverWithContext*
resolver, WebType* worker) | 152 PassRefPtr<ServiceWorker> ServiceWorker::from(ScriptPromiseResolverWithContext*
resolver, WebType* worker) |
| 153 { | 153 { |
| 154 RefPtr<ServiceWorker> serviceWorker = ServiceWorker::from(resolver->scriptSt
ate(), worker); | 154 RefPtr<ServiceWorker> serviceWorker = ServiceWorker::from(resolver->scriptSt
ate()->executionContext(), worker); |
| 155 | 155 |
| 156 ScriptState::Scope scope(resolver->scriptState()); | 156 ScriptState::Scope scope(resolver->scriptState()); |
| 157 serviceWorker->waitOnPromise(resolver->promise()); | 157 serviceWorker->waitOnPromise(resolver->promise()); |
| 158 | 158 |
| 159 return serviceWorker; | 159 return serviceWorker; |
| 160 } | 160 } |
| 161 | 161 |
| 162 void ServiceWorker::onPromiseResolved() | 162 void ServiceWorker::onPromiseResolved() |
| 163 { | 163 { |
| 164 ASSERT(m_isPromisePending); | 164 ASSERT(m_isPromisePending); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 186 , WebServiceWorkerProxy(this) | 186 , WebServiceWorkerProxy(this) |
| 187 , m_outerWorker(worker) | 187 , m_outerWorker(worker) |
| 188 , m_isPromisePending(false) | 188 , m_isPromisePending(false) |
| 189 { | 189 { |
| 190 ScriptWrappable::init(this); | 190 ScriptWrappable::init(this); |
| 191 ASSERT(m_outerWorker); | 191 ASSERT(m_outerWorker); |
| 192 m_outerWorker->setProxy(this); | 192 m_outerWorker->setProxy(this); |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace WebCore | 195 } // namespace WebCore |
| OLD | NEW |