| 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 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ServiceWorker_h | 31 #ifndef SharedWorkerRepositoryClientImpl_h |
| 32 #define ServiceWorker_h | 32 #define SharedWorkerRepositoryClientImpl_h |
| 33 | 33 |
| 34 #include "public/platform/WebServiceWorker.h" | 34 #include "core/workers/SharedWorkerRepositoryClient.h" |
| 35 #include "wtf/OwnPtr.h" | 35 #include "wtf/Noncopyable.h" |
| 36 #include "wtf/PassOwnPtr.h" | 36 #include "wtf/PassOwnPtr.h" |
| 37 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
| 38 #include "wtf/RefCounted.h" | |
| 39 | 38 |
| 40 namespace WebKit { | 39 namespace WebKit { |
| 41 class WebServiceWorker; | |
| 42 } | |
| 43 | 40 |
| 44 namespace WebCore { | 41 class WebSharedWorkerRepositoryClient; |
| 45 | 42 |
| 46 class ServiceWorker : public RefCounted<ServiceWorker> { | 43 class SharedWorkerRepositoryClientImpl : public WebCore::SharedWorkerRepositoryC
lient { |
| 44 WTF_MAKE_NONCOPYABLE(SharedWorkerRepositoryClientImpl); |
| 47 public: | 45 public: |
| 48 static PassRefPtr<ServiceWorker> create(PassOwnPtr<WebKit::WebServiceWorker>
worker) | 46 static PassOwnPtr<SharedWorkerRepositoryClientImpl> create(WebSharedWorkerRe
positoryClient* client) |
| 49 { | 47 { |
| 50 return adoptRef(new ServiceWorker(worker)); | 48 return adoptPtr(new SharedWorkerRepositoryClientImpl(client)); |
| 51 } | 49 } |
| 52 | 50 |
| 53 // For CallbackPromiseAdapter | 51 virtual ~SharedWorkerRepositoryClientImpl() { } |
| 54 typedef WebKit::WebServiceWorker WebType; | |
| 55 static PassRefPtr<ServiceWorker> from(WebType* worker) | |
| 56 { | |
| 57 return create(adoptPtr(worker)); | |
| 58 } | |
| 59 | 52 |
| 60 ~ServiceWorker() { } | 53 virtual void connect(PassRefPtr<WebCore::SharedWorker>, PassRefPtr<WebCore::
MessagePortChannel>, const WebCore::KURL&, const String& name, WebCore::Exceptio
nState&) OVERRIDE; |
| 54 virtual void documentDetached(WebCore::Document*) OVERRIDE; |
| 61 | 55 |
| 62 private: | 56 private: |
| 63 explicit ServiceWorker(PassOwnPtr<WebKit::WebServiceWorker>); | 57 explicit SharedWorkerRepositoryClientImpl(WebSharedWorkerRepositoryClient*); |
| 64 | 58 |
| 65 OwnPtr<WebKit::WebServiceWorker> m_outerWorker; | 59 WebSharedWorkerRepositoryClient* m_client; |
| 66 }; | 60 }; |
| 67 | 61 |
| 68 } // namespace WebCore | 62 } // namespace WebKit |
| 69 | 63 |
| 70 #endif // ServiceWorker_h | 64 #endif // SharedWorkerRepositoryClientImpl_h |
| OLD | NEW |