| Index: third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp
|
| diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp
|
| index 16d287892bc8d21b2b1d550f3473cf21fe7da29f..9ad3c6ac88a5eae82d28cba638de552633bc5e8b 100644
|
| --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp
|
| +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp
|
| @@ -111,9 +111,16 @@
|
|
|
| bool ServiceWorker::hasPendingActivity() const
|
| {
|
| - if (!executionContext())
|
| + if (AbstractWorker::hasPendingActivity())
|
| + return true;
|
| + if (m_wasStopped)
|
| return false;
|
| return m_handle->serviceWorker()->state() != WebServiceWorkerStateRedundant;
|
| +}
|
| +
|
| +void ServiceWorker::stop()
|
| +{
|
| + m_wasStopped = true;
|
| }
|
|
|
| ServiceWorker* ServiceWorker::getOrCreate(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorker::Handle> handle)
|
| @@ -127,12 +134,15 @@
|
| return existingWorker;
|
| }
|
|
|
| - return new ServiceWorker(executionContext, handle);
|
| + ServiceWorker* newWorker = new ServiceWorker(executionContext, handle);
|
| + newWorker->suspendIfNeeded();
|
| + return newWorker;
|
| }
|
|
|
| ServiceWorker::ServiceWorker(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorker::Handle> handle)
|
| : AbstractWorker(executionContext)
|
| , m_handle(handle)
|
| + , m_wasStopped(false)
|
| {
|
| ASSERT(m_handle);
|
| m_handle->serviceWorker()->setProxy(this);
|
|
|