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 27 matching lines...) Expand all Loading... |
38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
39 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
40 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 class WebServiceWorker; | 43 class WebServiceWorker; |
44 } | 44 } |
45 | 45 |
46 namespace WebCore { | 46 namespace WebCore { |
47 | 47 |
| 48 class NewScriptState; |
| 49 |
48 class ServiceWorker | 50 class ServiceWorker |
49 : public RefCounted<ServiceWorker> | 51 : public RefCounted<ServiceWorker> |
50 , public blink::WebServiceWorkerProxy { | 52 , public blink::WebServiceWorkerProxy { |
51 public: | 53 public: |
52 static PassRefPtr<ServiceWorker> create(PassOwnPtr<blink::WebServiceWorker>
worker) | 54 static PassRefPtr<ServiceWorker> create(PassOwnPtr<blink::WebServiceWorker>
worker) |
53 { | 55 { |
54 return adoptRef(new ServiceWorker(worker)); | 56 return adoptRef(new ServiceWorker(worker)); |
55 } | 57 } |
56 | 58 |
57 // For CallbackPromiseAdapter | 59 // For CallbackPromiseAdapter |
58 typedef blink::WebServiceWorker WebType; | 60 typedef blink::WebServiceWorker WebType; |
59 static PassRefPtr<ServiceWorker> from(WebType* worker) | 61 static PassRefPtr<ServiceWorker> from(NewScriptState*, WebType* worker) |
60 { | 62 { |
61 return create(adoptPtr(worker)); | 63 return create(adoptPtr(worker)); |
62 } | 64 } |
63 | 65 |
64 virtual ~ServiceWorker() { } | 66 virtual ~ServiceWorker() { } |
65 | 67 |
66 void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePor
tArray*, ExceptionState&); | 68 void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePor
tArray*, ExceptionState&); |
67 | 69 |
68 // WebServiceWorkerProxy overrides. | 70 // WebServiceWorkerProxy overrides. |
69 virtual void dispatchStateChangeEvent() OVERRIDE; | 71 virtual void dispatchStateChangeEvent() OVERRIDE; |
70 | 72 |
71 private: | 73 private: |
72 explicit ServiceWorker(PassOwnPtr<blink::WebServiceWorker>); | 74 explicit ServiceWorker(PassOwnPtr<blink::WebServiceWorker>); |
73 | 75 |
74 OwnPtr<blink::WebServiceWorker> m_outerWorker; | 76 OwnPtr<blink::WebServiceWorker> m_outerWorker; |
75 }; | 77 }; |
76 | 78 |
77 } // namespace WebCore | 79 } // namespace WebCore |
78 | 80 |
79 #endif // ServiceWorker_h | 81 #endif // ServiceWorker_h |
OLD | NEW |