| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 public: | 51 public: |
| 52 static PassRefPtrWillBeRawPtr<ServiceWorker> from(ExecutionContext*, WebServ
iceWorker*); | 52 static ServiceWorker* from(ExecutionContext*, WebServiceWorker*); |
| 53 | 53 |
| 54 ~ServiceWorker() override; | 54 ~ServiceWorker() override; |
| 55 | 55 |
| 56 // Eager finalization needed to promptly release owned WebServiceWorker. | 56 // Eager finalization needed to promptly release owned WebServiceWorker. |
| 57 EAGERLY_FINALIZE(); | 57 EAGERLY_FINALIZE(); |
| 58 #if ENABLE(OILPAN) | 58 |
| 59 // Override 'operator new' to enforce allocation of eagerly finalized object
. | 59 // Override 'operator new' to enforce allocation of eagerly finalized object
. |
| 60 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); | 60 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); |
| 61 #endif | |
| 62 | 61 |
| 63 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray*, ExceptionState&); | 62 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray*, ExceptionState&); |
| 64 | 63 |
| 65 String scriptURL() const; | 64 String scriptURL() const; |
| 66 String state() const; | 65 String state() const; |
| 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); | 66 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); |
| 68 | 67 |
| 69 // WebServiceWorkerProxy overrides. | 68 // WebServiceWorkerProxy overrides. |
| 70 void dispatchStateChangeEvent() override; | 69 void dispatchStateChangeEvent() override; |
| 71 | 70 |
| 72 // AbstractWorker overrides. | 71 // AbstractWorker overrides. |
| 73 const AtomicString& interfaceName() const override; | 72 const AtomicString& interfaceName() const override; |
| 74 | 73 |
| 75 void internalsTerminate(); | 74 void internalsTerminate(); |
| 76 private: | 75 private: |
| 77 static PassRefPtrWillBeRawPtr<ServiceWorker> getOrCreate(ExecutionContext*,
WebServiceWorker*); | 76 static ServiceWorker* getOrCreate(ExecutionContext*, WebServiceWorker*); |
| 78 ServiceWorker(ExecutionContext*, PassOwnPtr<WebServiceWorker>); | 77 ServiceWorker(ExecutionContext*, PassOwnPtr<WebServiceWorker>); |
| 79 | 78 |
| 80 // ActiveDOMObject overrides. | 79 // ActiveDOMObject overrides. |
| 81 bool hasPendingActivity() const override; | 80 bool hasPendingActivity() const override; |
| 82 void stop() override; | 81 void stop() override; |
| 83 | 82 |
| 84 OwnPtr<WebServiceWorker> m_outerWorker; | 83 OwnPtr<WebServiceWorker> m_outerWorker; |
| 85 bool m_wasStopped; | 84 bool m_wasStopped; |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 } // namespace blink | 87 } // namespace blink |
| 89 | 88 |
| 90 #endif // ServiceWorker_h | 89 #endif // ServiceWorker_h |
| OLD | NEW |