| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "wtf/PassRefPtr.h" | 44 #include "wtf/PassRefPtr.h" |
| 45 #include "wtf/RefPtr.h" | 45 #include "wtf/RefPtr.h" |
| 46 | 46 |
| 47 namespace blink { | 47 namespace blink { |
| 48 | 48 |
| 49 class ExecutionContext; | 49 class ExecutionContext; |
| 50 class WebServiceWorker; | 50 class WebServiceWorker; |
| 51 class WebServiceWorkerProvider; | 51 class WebServiceWorkerProvider; |
| 52 class WebServiceWorkerRegistration; | 52 class WebServiceWorkerRegistration; |
| 53 | 53 |
| 54 class ServiceWorkerContainer FINAL | 54 class ServiceWorkerContainer final |
| 55 : public GarbageCollectedFinalized<ServiceWorkerContainer> | 55 : public GarbageCollectedFinalized<ServiceWorkerContainer> |
| 56 , public ScriptWrappable | 56 , public ScriptWrappable |
| 57 , public ContextLifecycleObserver | 57 , public ContextLifecycleObserver |
| 58 , public WebServiceWorkerProviderClient { | 58 , public WebServiceWorkerProviderClient { |
| 59 DEFINE_WRAPPERTYPEINFO(); | 59 DEFINE_WRAPPERTYPEINFO(); |
| 60 public: | 60 public: |
| 61 static ServiceWorkerContainer* create(ExecutionContext*); | 61 static ServiceWorkerContainer* create(ExecutionContext*); |
| 62 ~ServiceWorkerContainer(); | 62 ~ServiceWorkerContainer(); |
| 63 | 63 |
| 64 void willBeDetachedFromFrame(); | 64 void willBeDetachedFromFrame(); |
| 65 | 65 |
| 66 void trace(Visitor*); | 66 void trace(Visitor*); |
| 67 | 67 |
| 68 PassRefPtrWillBeRawPtr<ServiceWorker> controller() { return m_controller.get
(); } | 68 PassRefPtrWillBeRawPtr<ServiceWorker> controller() { return m_controller.get
(); } |
| 69 ScriptPromise ready(ScriptState*); | 69 ScriptPromise ready(ScriptState*); |
| 70 WebServiceWorkerProvider* provider() { return m_provider; } | 70 WebServiceWorkerProvider* provider() { return m_provider; } |
| 71 | 71 |
| 72 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con
st RegistrationOptions&); | 72 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con
st RegistrationOptions&); |
| 73 ScriptPromise getRegistration(ScriptState*, const String& documentURL); | 73 ScriptPromise getRegistration(ScriptState*, const String& documentURL); |
| 74 | 74 |
| 75 // WebServiceWorkerProviderClient overrides. | 75 // WebServiceWorkerProviderClient overrides. |
| 76 virtual void setController(WebServiceWorker*) OVERRIDE; | 76 virtual void setController(WebServiceWorker*) override; |
| 77 virtual void setReadyRegistration(WebServiceWorkerRegistration*) OVERRIDE; | 77 virtual void setReadyRegistration(WebServiceWorkerRegistration*) override; |
| 78 virtual void dispatchMessageEvent(const WebString& message, const WebMessage
PortChannelArray&) OVERRIDE; | 78 virtual void dispatchMessageEvent(const WebString& message, const WebMessage
PortChannelArray&) override; |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 explicit ServiceWorkerContainer(ExecutionContext*); | 81 explicit ServiceWorkerContainer(ExecutionContext*); |
| 82 | 82 |
| 83 typedef ScriptPromiseProperty<Member<ServiceWorkerContainer>, Member<Service
WorkerRegistration>, Member<ServiceWorkerRegistration> > ReadyProperty; | 83 typedef ScriptPromiseProperty<Member<ServiceWorkerContainer>, Member<Service
WorkerRegistration>, Member<ServiceWorkerRegistration> > ReadyProperty; |
| 84 ReadyProperty* createReadyProperty(); | 84 ReadyProperty* createReadyProperty(); |
| 85 | 85 |
| 86 WebServiceWorkerProvider* m_provider; | 86 WebServiceWorkerProvider* m_provider; |
| 87 RefPtrWillBeMember<ServiceWorker> m_controller; | 87 RefPtrWillBeMember<ServiceWorker> m_controller; |
| 88 Member<ServiceWorkerRegistration> m_readyRegistration; | 88 Member<ServiceWorkerRegistration> m_readyRegistration; |
| 89 Member<ReadyProperty> m_ready; | 89 Member<ReadyProperty> m_ready; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace blink | 92 } // namespace blink |
| 93 | 93 |
| 94 #endif // ServiceWorkerContainer_h | 94 #endif // ServiceWorkerContainer_h |
| OLD | NEW |