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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 void ServiceWorker::stop() | 234 void ServiceWorker::stop() |
235 { | 235 { |
236 setProxyState(ContextStopped); | 236 setProxyState(ContextStopped); |
237 } | 237 } |
238 | 238 |
239 PassRefPtrWillBeRawPtr<ServiceWorker> ServiceWorker::getOrCreate(ExecutionContex
t* executionContext, WebType* outerWorker) | 239 PassRefPtrWillBeRawPtr<ServiceWorker> ServiceWorker::getOrCreate(ExecutionContex
t* executionContext, WebType* outerWorker) |
240 { | 240 { |
241 if (!outerWorker) | 241 if (!outerWorker) |
242 return nullptr; | 242 return nullptr; |
243 | 243 |
244 WebServiceWorkerProxy* proxy = outerWorker->proxy(); | 244 ServiceWorker* existingServiceWorker = static_cast<ServiceWorker*>(outerWork
er->proxy()); |
245 ServiceWorker* existingServiceWorker = proxy ? proxy->unwrap() : 0; | |
246 if (existingServiceWorker) { | 245 if (existingServiceWorker) { |
247 ASSERT(existingServiceWorker->executionContext() == executionContext); | 246 ASSERT(existingServiceWorker->executionContext() == executionContext); |
248 return existingServiceWorker; | 247 return existingServiceWorker; |
249 } | 248 } |
250 | 249 |
251 RefPtrWillBeRawPtr<ServiceWorker> worker = adoptRefWillBeNoop(new ServiceWor
ker(executionContext, adoptPtr(outerWorker))); | 250 RefPtrWillBeRawPtr<ServiceWorker> worker = adoptRefWillBeNoop(new ServiceWor
ker(executionContext, adoptPtr(outerWorker))); |
252 worker->suspendIfNeeded(); | 251 worker->suspendIfNeeded(); |
253 return worker.release(); | 252 return worker.release(); |
254 } | 253 } |
255 | 254 |
256 ServiceWorker::ServiceWorker(ExecutionContext* executionContext, PassOwnPtr<WebS
erviceWorker> worker) | 255 ServiceWorker::ServiceWorker(ExecutionContext* executionContext, PassOwnPtr<WebS
erviceWorker> worker) |
257 : AbstractWorker(executionContext) | 256 : AbstractWorker(executionContext) |
258 , WebServiceWorkerProxy(this) | |
259 , m_outerWorker(worker) | 257 , m_outerWorker(worker) |
260 , m_proxyState(Initial) | 258 , m_proxyState(Initial) |
261 { | 259 { |
262 ASSERT(m_outerWorker); | 260 ASSERT(m_outerWorker); |
263 m_outerWorker->setProxy(this); | 261 m_outerWorker->setProxy(this); |
264 } | 262 } |
265 | 263 |
266 } // namespace blink | 264 } // namespace blink |
OLD | NEW |