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 public: | 58 public: |
60 static PassRefPtrWillBeRawPtr<ServiceWorkerContainer> create(ExecutionContex t*); | 59 static ServiceWorkerContainer* create(ExecutionContext*); |
61 ~ServiceWorkerContainer(); | 60 ~ServiceWorkerContainer(); |
62 | 61 |
63 void willBeDetachedFromFrame(); | 62 void willBeDetachedFromFrame(); |
64 | 63 |
65 void trace(Visitor*); | 64 void trace(Visitor*); |
66 | 65 |
67 PassRefPtrWillBeRawPtr<ServiceWorker> active() { return m_active.get(); } | 66 PassRefPtrWillBeRawPtr<ServiceWorker> active() { return m_active.get(); } |
68 PassRefPtrWillBeRawPtr<ServiceWorker> controller() { return m_controller.get (); } | 67 PassRefPtrWillBeRawPtr<ServiceWorker> controller() { return m_controller.get (); } |
69 PassRefPtrWillBeRawPtr<ServiceWorker> installing() { return m_installing.get (); } | 68 PassRefPtrWillBeRawPtr<ServiceWorker> installing() { return m_installing.get (); } |
70 PassRefPtrWillBeRawPtr<ServiceWorker> waiting() { return m_waiting.get(); } | 69 PassRefPtrWillBeRawPtr<ServiceWorker> waiting() { return m_waiting.get(); } |
71 ScriptPromise ready(ScriptState*); | 70 ScriptPromise ready(ScriptState*); |
72 WebServiceWorkerProvider* provider() { return m_provider; } | 71 WebServiceWorkerProvider* provider() { return m_provider; } |
73 | 72 |
74 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con st Dictionary&); | 73 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con st Dictionary&); |
75 ScriptPromise unregisterServiceWorker(ScriptState*, const String& scope); | 74 ScriptPromise unregisterServiceWorker(ScriptState*, const String& scope); |
76 | 75 |
77 // WebServiceWorkerProviderClient overrides. | 76 // WebServiceWorkerProviderClient overrides. |
78 virtual void setActive(WebServiceWorker*) OVERRIDE; | 77 virtual void setActive(WebServiceWorker*) OVERRIDE; |
79 virtual void setController(WebServiceWorker*) OVERRIDE; | 78 virtual void setController(WebServiceWorker*) OVERRIDE; |
80 virtual void setInstalling(WebServiceWorker*) OVERRIDE; | 79 virtual void setInstalling(WebServiceWorker*) OVERRIDE; |
81 virtual void setWaiting(WebServiceWorker*) OVERRIDE; | 80 virtual void setWaiting(WebServiceWorker*) OVERRIDE; |
82 virtual void dispatchMessageEvent(const WebString& message, const WebMessage PortChannelArray&) OVERRIDE; | 81 virtual void dispatchMessageEvent(const WebString& message, const WebMessage PortChannelArray&) OVERRIDE; |
83 | 82 |
84 private: | 83 private: |
85 explicit ServiceWorkerContainer(ExecutionContext*); | 84 explicit ServiceWorkerContainer(ExecutionContext*); |
86 | 85 |
87 typedef ScriptPromiseProperty<RawPtrWillBeMember<ServiceWorkerContainer>, Re fPtrWillBeMember<ServiceWorker>, RefPtrWillBeMember<ServiceWorker> > ReadyProper ty; | 86 typedef ScriptPromiseProperty<Member<ServiceWorkerContainer>, RefPtrWillBeMe mber<ServiceWorker>, RefPtrWillBeMember<ServiceWorker> > ReadyProperty; |
88 ReadyProperty* createReadyProperty(); | 87 ReadyProperty* createReadyProperty(); |
89 void checkReadyChanged(PassRefPtrWillBeRawPtr<ServiceWorker> previousReadyWo rker); | 88 void checkReadyChanged(PassRefPtrWillBeRawPtr<ServiceWorker> previousReadyWo rker); |
90 | 89 |
91 WebServiceWorkerProvider* m_provider; | 90 WebServiceWorkerProvider* m_provider; |
92 RefPtrWillBeMember<ServiceWorker> m_active; | 91 RefPtrWillBeMember<ServiceWorker> m_active; |
dominicc (has gone to gerrit)
2014/08/26 14:01:34
Just out of curiosity, what is blocking doing this
haraken
2014/09/03 07:49:10
ServiceWorker inherits from AbstractWorker and we'
| |
93 RefPtrWillBeMember<ServiceWorker> m_controller; | 92 RefPtrWillBeMember<ServiceWorker> m_controller; |
94 RefPtrWillBeMember<ServiceWorker> m_installing; | 93 RefPtrWillBeMember<ServiceWorker> m_installing; |
95 RefPtrWillBeMember<ServiceWorker> m_waiting; | 94 RefPtrWillBeMember<ServiceWorker> m_waiting; |
96 PersistentWillBeMember<ReadyProperty> m_ready; | 95 Member<ReadyProperty> m_ready; |
97 }; | 96 }; |
98 | 97 |
99 } // namespace blink | 98 } // namespace blink |
100 | 99 |
101 #endif // ServiceWorkerContainer_h | 100 #endif // ServiceWorkerContainer_h |
OLD | NEW |