Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ServiceWorkerContainer_h | 31 #ifndef ServiceWorkerContainer_h |
| 32 #define ServiceWorkerContainer_h | 32 #define ServiceWorkerContainer_h |
| 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 "modules/serviceworkers/ServiceWorkerRegistration.h" | |
| 39 #include "platform/heap/Handle.h" | 40 #include "platform/heap/Handle.h" |
| 40 #include "public/platform/WebServiceWorkerProviderClient.h" | 41 #include "public/platform/WebServiceWorkerProviderClient.h" |
| 41 #include "wtf/Forward.h" | 42 #include "wtf/Forward.h" |
| 42 #include "wtf/PassRefPtr.h" | 43 #include "wtf/PassRefPtr.h" |
| 43 #include "wtf/RefCounted.h" | 44 #include "wtf/RefCounted.h" |
| 44 #include "wtf/RefPtr.h" | 45 #include "wtf/RefPtr.h" |
| 45 | 46 |
| 46 namespace blink { | 47 namespace blink { |
| 47 | 48 |
| 48 class Dictionary; | 49 class Dictionary; |
| 49 class ExecutionContext; | 50 class ExecutionContext; |
| 50 class ServiceWorker; | |
| 51 class WebServiceWorker; | 51 class WebServiceWorker; |
| 52 class WebServiceWorkerProvider; | 52 class WebServiceWorkerProvider; |
| 53 class WebServiceWorkerRegistration; | |
| 53 | 54 |
| 54 class ServiceWorkerContainer FINAL | 55 class ServiceWorkerContainer FINAL |
| 55 : public RefCountedWillBeGarbageCollectedFinalized<ServiceWorkerContainer> | 56 : public RefCountedWillBeGarbageCollectedFinalized<ServiceWorkerContainer> |
| 56 , public ScriptWrappable | 57 , public ScriptWrappable |
| 57 , public ContextLifecycleObserver | 58 , public ContextLifecycleObserver |
| 58 , public WebServiceWorkerProviderClient { | 59 , public WebServiceWorkerProviderClient { |
| 59 DEFINE_WRAPPERTYPEINFO(); | 60 DEFINE_WRAPPERTYPEINFO(); |
| 60 public: | 61 public: |
| 61 static PassRefPtrWillBeRawPtr<ServiceWorkerContainer> create(ExecutionContex t*); | 62 static PassRefPtrWillBeRawPtr<ServiceWorkerContainer> create(ExecutionContex t*); |
| 62 ~ServiceWorkerContainer(); | 63 ~ServiceWorkerContainer(); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 73 WebServiceWorkerProvider* provider() { return m_provider; } | 74 WebServiceWorkerProvider* provider() { return m_provider; } |
| 74 | 75 |
| 75 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con st Dictionary&); | 76 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con st Dictionary&); |
| 76 ScriptPromise unregisterServiceWorker(ScriptState*, const String& scope); | 77 ScriptPromise unregisterServiceWorker(ScriptState*, const String& scope); |
| 77 | 78 |
| 78 // WebServiceWorkerProviderClient overrides. | 79 // WebServiceWorkerProviderClient overrides. |
| 79 virtual void setActive(WebServiceWorker*) OVERRIDE; | 80 virtual void setActive(WebServiceWorker*) OVERRIDE; |
| 80 virtual void setController(WebServiceWorker*) OVERRIDE; | 81 virtual void setController(WebServiceWorker*) OVERRIDE; |
| 81 virtual void setInstalling(WebServiceWorker*) OVERRIDE; | 82 virtual void setInstalling(WebServiceWorker*) OVERRIDE; |
| 82 virtual void setWaiting(WebServiceWorker*) OVERRIDE; | 83 virtual void setWaiting(WebServiceWorker*) OVERRIDE; |
| 84 virtual void setReadyRegistration(WebServiceWorkerRegistration*) OVERRIDE; | |
| 83 virtual void dispatchMessageEvent(const WebString& message, const WebMessage PortChannelArray&) OVERRIDE; | 85 virtual void dispatchMessageEvent(const WebString& message, const WebMessage PortChannelArray&) OVERRIDE; |
| 84 | 86 |
| 85 private: | 87 private: |
| 86 explicit ServiceWorkerContainer(ExecutionContext*); | 88 explicit ServiceWorkerContainer(ExecutionContext*); |
| 87 | 89 |
| 88 typedef ScriptPromiseProperty<RawPtrWillBeMember<ServiceWorkerContainer>, Re fPtrWillBeMember<ServiceWorker>, RefPtrWillBeMember<ServiceWorker> > ReadyProper ty; | 90 typedef ScriptPromiseProperty<RawPtrWillBeMember<ServiceWorkerContainer>, Re fPtrWillBeMember<ServiceWorkerRegistration>, RefPtrWillBeMember<ServiceWorkerReg istration> > ReadyProperty; |
| 89 ReadyProperty* createReadyProperty(); | 91 ReadyProperty* createReadyProperty(); |
| 90 void checkReadyChanged(PassRefPtrWillBeRawPtr<ServiceWorker> previousReadyWo rker); | |
| 91 | 92 |
| 92 WebServiceWorkerProvider* m_provider; | 93 WebServiceWorkerProvider* m_provider; |
| 93 RefPtrWillBeMember<ServiceWorker> m_active; | 94 RefPtrWillBeMember<ServiceWorker> m_active; |
| 94 RefPtrWillBeMember<ServiceWorker> m_controller; | 95 RefPtrWillBeMember<ServiceWorker> m_controller; |
| 95 RefPtrWillBeMember<ServiceWorker> m_installing; | 96 RefPtrWillBeMember<ServiceWorker> m_installing; |
| 96 RefPtrWillBeMember<ServiceWorker> m_waiting; | 97 RefPtrWillBeMember<ServiceWorker> m_waiting; |
| 98 RefPtrWillBeMember<ServiceWorkerRegistration> m_readyRegistration; | |
|
tkent
2014/09/05 02:01:25
Please update ServiceWorkerContainer::trace().
nhiroki
2014/09/05 02:23:04
Done. Thanks!
| |
| 97 PersistentWillBeMember<ReadyProperty> m_ready; | 99 PersistentWillBeMember<ReadyProperty> m_ready; |
| 98 }; | 100 }; |
| 99 | 101 |
| 100 } // namespace blink | 102 } // namespace blink |
| 101 | 103 |
| 102 #endif // ServiceWorkerContainer_h | 104 #endif // ServiceWorkerContainer_h |
| OLD | NEW |