| 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/dom/ContextLifecycleObserver.h" | 37 #include "core/dom/ContextLifecycleObserver.h" |
| 38 #include "modules/serviceworkers/ServiceWorker.h" | 38 #include "modules/serviceworkers/ServiceWorker.h" |
| 39 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
| 40 #include "public/platform/WebServiceWorkerProviderClient.h" | 40 #include "public/platform/WebServiceWorkerProviderClient.h" |
| 41 #include "wtf/Forward.h" | 41 #include "wtf/Forward.h" |
| 42 #include "wtf/PassRefPtr.h" | 42 #include "wtf/PassRefPtr.h" |
| 43 #include "wtf/RefCounted.h" | 43 #include "wtf/RefCounted.h" |
| 44 #include "wtf/RefPtr.h" | 44 #include "wtf/RefPtr.h" |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 class WebServiceWorkerProvider; | |
| 48 class WebServiceWorker; | |
| 49 } | |
| 50 | |
| 51 namespace blink { | |
| 52 | 47 |
| 53 class Dictionary; | 48 class Dictionary; |
| 54 class ExecutionContext; | 49 class ExecutionContext; |
| 55 class ServiceWorker; | 50 class ServiceWorker; |
| 51 class WebServiceWorkerProvider; |
| 52 class WebServiceWorker; |
| 56 | 53 |
| 57 class ServiceWorkerContainer FINAL | 54 class ServiceWorkerContainer FINAL |
| 58 : public RefCountedWillBeGarbageCollectedFinalized<ServiceWorkerContainer> | 55 : public RefCountedWillBeGarbageCollectedFinalized<ServiceWorkerContainer> |
| 59 , public ScriptWrappable | 56 , public ScriptWrappable |
| 60 , public ContextLifecycleObserver | 57 , public ContextLifecycleObserver |
| 61 , public blink::WebServiceWorkerProviderClient { | 58 , public WebServiceWorkerProviderClient { |
| 62 public: | 59 public: |
| 63 static PassRefPtrWillBeRawPtr<ServiceWorkerContainer> create(ExecutionContex
t*); | 60 static PassRefPtrWillBeRawPtr<ServiceWorkerContainer> create(ExecutionContex
t*); |
| 64 ~ServiceWorkerContainer(); | 61 ~ServiceWorkerContainer(); |
| 65 | 62 |
| 66 void willBeDetachedFromFrame(); | 63 void willBeDetachedFromFrame(); |
| 67 | 64 |
| 68 void trace(Visitor*); | 65 void trace(Visitor*); |
| 69 | 66 |
| 70 PassRefPtrWillBeRawPtr<ServiceWorker> active() { return m_active.get(); } | 67 PassRefPtrWillBeRawPtr<ServiceWorker> active() { return m_active.get(); } |
| 71 PassRefPtrWillBeRawPtr<ServiceWorker> controller() { return m_controller.get
(); } | 68 PassRefPtrWillBeRawPtr<ServiceWorker> controller() { return m_controller.get
(); } |
| 72 PassRefPtrWillBeRawPtr<ServiceWorker> installing() { return m_installing.get
(); } | 69 PassRefPtrWillBeRawPtr<ServiceWorker> installing() { return m_installing.get
(); } |
| 73 PassRefPtrWillBeRawPtr<ServiceWorker> waiting() { return m_waiting.get(); } | 70 PassRefPtrWillBeRawPtr<ServiceWorker> waiting() { return m_waiting.get(); } |
| 74 ScriptPromise ready(ScriptState*); | 71 ScriptPromise ready(ScriptState*); |
| 75 blink::WebServiceWorkerProvider* provider() { return m_provider; } | 72 WebServiceWorkerProvider* provider() { return m_provider; } |
| 76 | 73 |
| 77 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con
st Dictionary&); | 74 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con
st Dictionary&); |
| 78 ScriptPromise unregisterServiceWorker(ScriptState*, const String& scope); | 75 ScriptPromise unregisterServiceWorker(ScriptState*, const String& scope); |
| 79 | 76 |
| 80 // WebServiceWorkerProviderClient overrides. | 77 // WebServiceWorkerProviderClient overrides. |
| 81 virtual void setActive(blink::WebServiceWorker*) OVERRIDE; | 78 virtual void setActive(WebServiceWorker*) OVERRIDE; |
| 82 virtual void setController(blink::WebServiceWorker*) OVERRIDE; | 79 virtual void setController(WebServiceWorker*) OVERRIDE; |
| 83 virtual void setInstalling(blink::WebServiceWorker*) OVERRIDE; | 80 virtual void setInstalling(WebServiceWorker*) OVERRIDE; |
| 84 virtual void setWaiting(blink::WebServiceWorker*) OVERRIDE; | 81 virtual void setWaiting(WebServiceWorker*) OVERRIDE; |
| 85 virtual void dispatchMessageEvent(const blink::WebString& message, const bli
nk::WebMessagePortChannelArray&) OVERRIDE; | 82 virtual void dispatchMessageEvent(const WebString& message, const WebMessage
PortChannelArray&) OVERRIDE; |
| 86 | 83 |
| 87 private: | 84 private: |
| 88 explicit ServiceWorkerContainer(ExecutionContext*); | 85 explicit ServiceWorkerContainer(ExecutionContext*); |
| 89 | 86 |
| 90 typedef ScriptPromiseProperty<RawPtrWillBeMember<ServiceWorkerContainer>, Re
fPtrWillBeMember<ServiceWorker>, RefPtrWillBeMember<ServiceWorker> > ReadyProper
ty; | 87 typedef ScriptPromiseProperty<RawPtrWillBeMember<ServiceWorkerContainer>, Re
fPtrWillBeMember<ServiceWorker>, RefPtrWillBeMember<ServiceWorker> > ReadyProper
ty; |
| 91 ReadyProperty* createReadyProperty(); | 88 ReadyProperty* createReadyProperty(); |
| 92 void checkReadyChanged(PassRefPtrWillBeRawPtr<ServiceWorker> previousReadyWo
rker); | 89 void checkReadyChanged(PassRefPtrWillBeRawPtr<ServiceWorker> previousReadyWo
rker); |
| 93 | 90 |
| 94 blink::WebServiceWorkerProvider* m_provider; | 91 WebServiceWorkerProvider* m_provider; |
| 95 RefPtrWillBeMember<ServiceWorker> m_active; | 92 RefPtrWillBeMember<ServiceWorker> m_active; |
| 96 RefPtrWillBeMember<ServiceWorker> m_controller; | 93 RefPtrWillBeMember<ServiceWorker> m_controller; |
| 97 RefPtrWillBeMember<ServiceWorker> m_installing; | 94 RefPtrWillBeMember<ServiceWorker> m_installing; |
| 98 RefPtrWillBeMember<ServiceWorker> m_waiting; | 95 RefPtrWillBeMember<ServiceWorker> m_waiting; |
| 99 PersistentWillBeMember<ReadyProperty> m_ready; | 96 PersistentWillBeMember<ReadyProperty> m_ready; |
| 100 }; | 97 }; |
| 101 | 98 |
| 102 } // namespace blink | 99 } // namespace blink |
| 103 | 100 |
| 104 #endif // ServiceWorkerContainer_h | 101 #endif // ServiceWorkerContainer_h |
| OLD | NEW |