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