| 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 30 matching lines...) Expand all Loading... |
| 41 #include "wtf/PassOwnPtr.h" | 41 #include "wtf/PassOwnPtr.h" |
| 42 #include "wtf/PassRefPtr.h" | 42 #include "wtf/PassRefPtr.h" |
| 43 #include "wtf/RefCounted.h" | 43 #include "wtf/RefCounted.h" |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 class ScriptPromiseResolver; | 47 class ScriptPromiseResolver; |
| 48 | 48 |
| 49 class MODULES_EXPORT ServiceWorker final : public AbstractWorker, public WebServ
iceWorkerProxy { | 49 class MODULES_EXPORT ServiceWorker final : public AbstractWorker, public WebServ
iceWorkerProxy { |
| 50 DEFINE_WRAPPERTYPEINFO(); | 50 DEFINE_WRAPPERTYPEINFO(); |
| 51 WILL_BE_USING_PRE_FINALIZER(ServiceWorker, dispose); | |
| 52 public: | 51 public: |
| 53 typedef WebServiceWorker WebType; | 52 typedef WebServiceWorker WebType; |
| 54 static PassRefPtrWillBeRawPtr<ServiceWorker> from(ExecutionContext*, WebType
*); | 53 static PassRefPtrWillBeRawPtr<ServiceWorker> from(ExecutionContext*, WebType
*); |
| 55 | 54 |
| 56 ~ServiceWorker() override; | 55 ~ServiceWorker() override; |
| 57 | 56 |
| 57 // Eager finalization needed to promptly release owned WebServiceWorker. |
| 58 EAGERLY_FINALIZE(); |
| 59 |
| 58 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray*, ExceptionState&); | 60 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray*, ExceptionState&); |
| 59 void terminate(ExceptionState&); | 61 void terminate(ExceptionState&); |
| 60 | 62 |
| 61 String scriptURL() const; | 63 String scriptURL() const; |
| 62 String state() const; | 64 String state() const; |
| 63 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); | 65 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); |
| 64 | 66 |
| 65 // WebServiceWorkerProxy overrides. | 67 // WebServiceWorkerProxy overrides. |
| 66 virtual void dispatchStateChangeEvent() override; | 68 virtual void dispatchStateChangeEvent() override; |
| 67 | 69 |
| 68 // AbstractWorker overrides. | 70 // AbstractWorker overrides. |
| 69 virtual const AtomicString& interfaceName() const override; | 71 virtual const AtomicString& interfaceName() const override; |
| 70 | 72 |
| 71 void internalsTerminate(); | 73 void internalsTerminate(); |
| 72 private: | 74 private: |
| 73 static PassRefPtrWillBeRawPtr<ServiceWorker> getOrCreate(ExecutionContext*,
WebType*); | 75 static PassRefPtrWillBeRawPtr<ServiceWorker> getOrCreate(ExecutionContext*,
WebType*); |
| 74 ServiceWorker(ExecutionContext*, PassOwnPtr<WebServiceWorker>); | 76 ServiceWorker(ExecutionContext*, PassOwnPtr<WebServiceWorker>); |
| 75 | 77 |
| 76 // ActiveDOMObject overrides. | 78 // ActiveDOMObject overrides. |
| 77 virtual bool hasPendingActivity() const override; | 79 virtual bool hasPendingActivity() const override; |
| 78 virtual void stop() override; | 80 virtual void stop() override; |
| 79 | 81 |
| 80 void dispose(); | |
| 81 | |
| 82 OwnPtr<WebServiceWorker> m_outerWorker; | 82 OwnPtr<WebServiceWorker> m_outerWorker; |
| 83 bool m_wasStopped; | 83 bool m_wasStopped; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace blink | 86 } // namespace blink |
| 87 | 87 |
| 88 #endif // ServiceWorker_h | 88 #endif // ServiceWorker_h |
| OLD | NEW |