Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 | 60 |
| 61 virtual ScriptValue call(ScriptValue value) OVERRIDE | 61 virtual ScriptValue call(ScriptValue value) OVERRIDE |
| 62 { | 62 { |
| 63 m_observer->onPromiseResolved(); | 63 m_observer->onPromiseResolved(); |
| 64 return value; | 64 return value; |
| 65 } | 65 } |
| 66 | 66 |
| 67 RefPtr<ServiceWorker> m_observer; | 67 RefPtr<ServiceWorker> m_observer; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 bool ServiceWorker::hasPendingActivity() const | |
| 71 { | |
| 72 if (m_contextStopped) | |
| 73 return false; | |
| 74 return m_outerWorker->state() != blink::WebServiceWorkerStateDeactivated; | |
| 75 } | |
| 76 | |
| 77 void ServiceWorker::stop() | |
| 78 { | |
| 79 m_contextStopped = true; | |
|
dominicc (has gone to gerrit)
2014/06/12 22:23:38
Would it make sense to tie m_contextStopped and m_
falken
2014/06/13 19:22:59
Hmm, right it would be good to make the possible c
| |
| 80 } | |
| 81 | |
| 70 const AtomicString& ServiceWorker::interfaceName() const | 82 const AtomicString& ServiceWorker::interfaceName() const |
| 71 { | 83 { |
| 72 return EventTargetNames::ServiceWorker; | 84 return EventTargetNames::ServiceWorker; |
| 73 } | 85 } |
| 74 | 86 |
| 75 void ServiceWorker::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionState& exceptionState) | 87 void ServiceWorker::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionState& exceptionState) |
| 76 { | 88 { |
| 77 // Disentangle the port in preparation for sending it to the remote context. | 89 // Disentangle the port in preparation for sending it to the remote context. |
| 78 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(por ts, exceptionState); | 90 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(por ts, exceptionState); |
| 79 if (exceptionState.hadException()) | 91 if (exceptionState.hadException()) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 RefPtr<ServiceWorker> worker = adoptRef(new ServiceWorker(executionContext, outerWorker)); | 193 RefPtr<ServiceWorker> worker = adoptRef(new ServiceWorker(executionContext, outerWorker)); |
| 182 worker->suspendIfNeeded(); | 194 worker->suspendIfNeeded(); |
| 183 return worker.release(); | 195 return worker.release(); |
| 184 } | 196 } |
| 185 | 197 |
| 186 ServiceWorker::ServiceWorker(ExecutionContext* executionContext, PassOwnPtr<blin k::WebServiceWorker> worker) | 198 ServiceWorker::ServiceWorker(ExecutionContext* executionContext, PassOwnPtr<blin k::WebServiceWorker> worker) |
| 187 : AbstractWorker(executionContext) | 199 : AbstractWorker(executionContext) |
| 188 , WebServiceWorkerProxy(this) | 200 , WebServiceWorkerProxy(this) |
| 189 , m_outerWorker(worker) | 201 , m_outerWorker(worker) |
| 190 , m_isPromisePending(false) | 202 , m_isPromisePending(false) |
| 203 , m_contextStopped(false) | |
| 191 { | 204 { |
| 192 ScriptWrappable::init(this); | 205 ScriptWrappable::init(this); |
| 193 ASSERT(m_outerWorker); | 206 ASSERT(m_outerWorker); |
| 194 m_outerWorker->setProxy(this); | 207 m_outerWorker->setProxy(this); |
| 195 } | 208 } |
| 196 | 209 |
| 197 } // namespace WebCore | 210 } // namespace WebCore |
| OLD | NEW |