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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 namespace WebCore { | 45 namespace WebCore { |
46 | 46 |
47 class ScriptState; | 47 class ScriptState; |
48 class ScriptPromiseResolverWithContext; | 48 class ScriptPromiseResolverWithContext; |
49 | 49 |
50 class ServiceWorker | 50 class ServiceWorker |
51 : public AbstractWorker | 51 : public AbstractWorker |
52 , public ScriptWrappable | 52 , public ScriptWrappable |
53 , public blink::WebServiceWorkerProxy { | 53 , public blink::WebServiceWorkerProxy { |
54 public: | 54 public: |
55 static PassRefPtr<ServiceWorker> create(ExecutionContext*, PassOwnPtr<blink:
:WebServiceWorker>); | |
56 | |
57 virtual ~ServiceWorker() { } | 55 virtual ~ServiceWorker() { } |
58 | 56 |
59 // For CallbackPromiseAdapter | 57 // For CallbackPromiseAdapter |
60 typedef blink::WebServiceWorker WebType; | 58 typedef blink::WebServiceWorker WebType; |
61 static PassRefPtr<ServiceWorker> from(ScriptPromiseResolverWithContext*, Web
Type* worker); | 59 static PassRefPtr<ServiceWorker> from(ScriptPromiseResolverWithContext*, Web
Type* worker); |
62 | 60 |
63 static PassRefPtr<ServiceWorker> from(ScriptState*, WebType*); | 61 static PassRefPtr<ServiceWorker> from(ExecutionContext*, WebType*); |
64 | 62 |
65 void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePor
tArray*, ExceptionState&); | 63 void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePor
tArray*, ExceptionState&); |
66 | 64 |
67 String scope() const; | 65 String scope() const; |
68 String url() const; | 66 String url() const; |
69 const AtomicString& state() const; | 67 const AtomicString& state() const; |
70 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); | 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); |
71 | 69 |
72 // WebServiceWorkerProxy overrides. | 70 // WebServiceWorkerProxy overrides. |
73 virtual bool isReady() OVERRIDE; | 71 virtual bool isReady() OVERRIDE; |
74 virtual void dispatchStateChangeEvent() OVERRIDE; | 72 virtual void dispatchStateChangeEvent() OVERRIDE; |
75 | 73 |
76 // AbstractWorker overrides. | 74 // AbstractWorker overrides. |
77 virtual const AtomicString& interfaceName() const OVERRIDE; | 75 virtual const AtomicString& interfaceName() const OVERRIDE; |
78 | 76 |
79 private: | 77 private: |
80 class ThenFunction; | 78 class ThenFunction; |
81 | 79 |
| 80 static PassRefPtr<ServiceWorker> create(ExecutionContext*, PassOwnPtr<blink:
:WebServiceWorker>); |
82 ServiceWorker(ExecutionContext*, PassOwnPtr<blink::WebServiceWorker>); | 81 ServiceWorker(ExecutionContext*, PassOwnPtr<blink::WebServiceWorker>); |
83 void onPromiseResolved(); | 82 void onPromiseResolved(); |
84 void waitOnPromise(ScriptPromise); | 83 void waitOnPromise(ScriptPromise); |
85 | 84 |
86 OwnPtr<blink::WebServiceWorker> m_outerWorker; | 85 OwnPtr<blink::WebServiceWorker> m_outerWorker; |
87 bool m_isPromisePending; | 86 bool m_isPromisePending; |
88 }; | 87 }; |
89 | 88 |
90 } // namespace WebCore | 89 } // namespace WebCore |
91 | 90 |
92 #endif // ServiceWorker_h | 91 #endif // ServiceWorker_h |
OLD | NEW |