OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ServiceWorkerClient_h | 5 #ifndef ServiceWorkerClient_h |
6 #define ServiceWorkerClient_h | 6 #define ServiceWorkerClient_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "bindings/core/v8/SerializedScriptValue.h" | 10 #include "bindings/core/v8/SerializedScriptValue.h" |
11 #include "modules/ModulesExport.h" | 11 #include "modules/ModulesExport.h" |
12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
13 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" | 13 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" |
14 #include "wtf/Forward.h" | 14 #include "wtf/Forward.h" |
15 #include <memory> | |
16 | 15 |
17 namespace blink { | 16 namespace blink { |
18 | 17 |
19 class ExecutionContext; | 18 class ExecutionContext; |
20 class ScriptPromiseResolver; | 19 class ScriptPromiseResolver; |
21 class ScriptState; | 20 class ScriptState; |
22 | 21 |
23 class MODULES_EXPORT ServiceWorkerClient : public GarbageCollectedFinalized<Serv
iceWorkerClient>, public ScriptWrappable { | 22 class MODULES_EXPORT ServiceWorkerClient : public GarbageCollectedFinalized<Serv
iceWorkerClient>, public ScriptWrappable { |
24 DEFINE_WRAPPERTYPEINFO(); | 23 DEFINE_WRAPPERTYPEINFO(); |
25 public: | 24 public: |
26 // To be used by CallbackPromiseAdapter. | 25 // To be used by CallbackPromiseAdapter. |
27 using WebType = std::unique_ptr<WebServiceWorkerClientInfo>; | 26 using WebType = OwnPtr<WebServiceWorkerClientInfo>; |
28 | 27 |
29 static ServiceWorkerClient* take(ScriptPromiseResolver*, std::unique_ptr<Web
ServiceWorkerClientInfo>); | 28 static ServiceWorkerClient* take(ScriptPromiseResolver*, PassOwnPtr<WebServi
ceWorkerClientInfo>); |
30 static ServiceWorkerClient* create(const WebServiceWorkerClientInfo&); | 29 static ServiceWorkerClient* create(const WebServiceWorkerClientInfo&); |
31 | 30 |
32 virtual ~ServiceWorkerClient(); | 31 virtual ~ServiceWorkerClient(); |
33 | 32 |
34 // Client.idl | 33 // Client.idl |
35 String url() const { return m_url; } | 34 String url() const { return m_url; } |
36 String frameType() const; | 35 String frameType() const; |
37 String id() const { return m_uuid; } | 36 String id() const { return m_uuid; } |
38 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray&, ExceptionState&); | 37 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray&, ExceptionState&); |
39 | 38 |
40 DEFINE_INLINE_VIRTUAL_TRACE() { } | 39 DEFINE_INLINE_VIRTUAL_TRACE() { } |
41 | 40 |
42 protected: | 41 protected: |
43 explicit ServiceWorkerClient(const WebServiceWorkerClientInfo&); | 42 explicit ServiceWorkerClient(const WebServiceWorkerClientInfo&); |
44 | 43 |
45 String uuid() const { return m_uuid; } | 44 String uuid() const { return m_uuid; } |
46 | 45 |
47 private: | 46 private: |
48 String m_uuid; | 47 String m_uuid; |
49 String m_url; | 48 String m_url; |
50 WebURLRequest::FrameType m_frameType; | 49 WebURLRequest::FrameType m_frameType; |
51 }; | 50 }; |
52 | 51 |
53 } // namespace blink | 52 } // namespace blink |
54 | 53 |
55 #endif // ServiceWorkerClient_h | 54 #endif // ServiceWorkerClient_h |
OLD | NEW |