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 29 matching lines...) Expand all Loading... |
40 #include "wtf/PassOwnPtr.h" | 40 #include "wtf/PassOwnPtr.h" |
41 #include "wtf/PassRefPtr.h" | 41 #include "wtf/PassRefPtr.h" |
42 #include "wtf/RefCounted.h" | 42 #include "wtf/RefCounted.h" |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 class ScriptPromiseResolver; | 46 class ScriptPromiseResolver; |
47 | 47 |
48 class ServiceWorker final : public AbstractWorker, public WebServiceWorkerProxy
{ | 48 class ServiceWorker final : public AbstractWorker, public WebServiceWorkerProxy
{ |
49 DEFINE_WRAPPERTYPEINFO(); | 49 DEFINE_WRAPPERTYPEINFO(); |
| 50 WILL_BE_USING_PRE_FINALIZER(ServiceWorker, dispose); |
50 public: | 51 public: |
51 // For CallbackPromiseAdapter | 52 // For CallbackPromiseAdapter |
52 typedef WebServiceWorker WebType; | 53 typedef WebServiceWorker WebType; |
53 static PassRefPtrWillBeRawPtr<ServiceWorker> take(ScriptPromiseResolver*, We
bType* worker); | 54 static PassRefPtrWillBeRawPtr<ServiceWorker> take(ScriptPromiseResolver*, We
bType* worker); |
54 | 55 |
55 static PassRefPtrWillBeRawPtr<ServiceWorker> from(ExecutionContext*, WebType
*); | 56 static PassRefPtrWillBeRawPtr<ServiceWorker> from(ExecutionContext*, WebType
*); |
| 57 |
| 58 ~ServiceWorker() override; |
56 static void dispose(WebType*); | 59 static void dispose(WebType*); |
57 | 60 |
58 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray*, ExceptionState&); | 61 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray*, ExceptionState&); |
59 void terminate(ExceptionState&); | 62 void terminate(ExceptionState&); |
60 | 63 |
61 String scriptURL() const; | 64 String scriptURL() const; |
62 const AtomicString& state() const; | 65 const AtomicString& state() const; |
63 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); | 66 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); |
64 | 67 |
65 // WebServiceWorkerProxy overrides. | 68 // WebServiceWorkerProxy overrides. |
(...skipping 17 matching lines...) Expand all Loading... |
83 static PassRefPtrWillBeRawPtr<ServiceWorker> getOrCreate(ExecutionContext*,
WebType*); | 86 static PassRefPtrWillBeRawPtr<ServiceWorker> getOrCreate(ExecutionContext*,
WebType*); |
84 ServiceWorker(ExecutionContext*, PassOwnPtr<WebServiceWorker>); | 87 ServiceWorker(ExecutionContext*, PassOwnPtr<WebServiceWorker>); |
85 void setProxyState(ProxyState); | 88 void setProxyState(ProxyState); |
86 void onPromiseResolved(); | 89 void onPromiseResolved(); |
87 void waitOnPromise(ScriptPromiseResolver*); | 90 void waitOnPromise(ScriptPromiseResolver*); |
88 | 91 |
89 // ActiveDOMObject overrides. | 92 // ActiveDOMObject overrides. |
90 virtual bool hasPendingActivity() const override; | 93 virtual bool hasPendingActivity() const override; |
91 virtual void stop() override; | 94 virtual void stop() override; |
92 | 95 |
| 96 void dispose(); |
| 97 |
93 OwnPtr<WebServiceWorker> m_outerWorker; | 98 OwnPtr<WebServiceWorker> m_outerWorker; |
94 ProxyState m_proxyState; | 99 ProxyState m_proxyState; |
95 }; | 100 }; |
96 | 101 |
97 } // namespace blink | 102 } // namespace blink |
98 | 103 |
99 #endif // ServiceWorker_h | 104 #endif // ServiceWorker_h |
OLD | NEW |