OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ServicePort_h | |
6 #define ServicePort_h | |
7 | |
8 #include "bindings/core/v8/ScriptWrappable.h" | |
9 #include "modules/ModulesExport.h" | |
10 #include "public/platform/modules/navigator_services/WebServicePort.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class ExceptionState; | |
15 class ExecutionContext; | |
16 class MessagePort; | |
17 class ScriptState; | |
18 class ScriptValue; | |
19 class SerializedScriptValue; | |
20 class ServicePortCollection; | |
21 | |
22 typedef WillBeHeapVector<RefPtrWillBeMember<MessagePort>, 1> MessagePortArray; | |
haraken
2015/06/24 23:59:59
Nit: It is a bit unfortunate we duplicate this typ
Marijn Kruisselbrink
2015/06/25 01:07:26
Agreed, I changed it to just include one of the he
| |
23 | |
24 class MODULES_EXPORT ServicePort final | |
25 : public GarbageCollectedFinalized<ServicePort>, public ScriptWrappable { | |
26 DEFINE_WRAPPERTYPEINFO(); | |
27 WTF_MAKE_NONCOPYABLE(ServicePort); | |
28 public: | |
29 static ServicePort* create(WeakPtrWillBeRawPtr<ServicePortCollection>, const WebServicePort&); | |
30 virtual ~ServicePort(); | |
31 | |
32 WebServicePortID id() const { return m_port.id; } | |
33 | |
34 // ServicePort.idl | |
35 String targetURL() const; | |
36 String name() const; | |
37 ScriptValue data(ScriptState*) const; | |
38 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag e, const MessagePortArray*, ExceptionState&); | |
39 void close(); | |
40 | |
41 DEFINE_INLINE_VIRTUAL_TRACE() { } | |
42 | |
43 private: | |
44 explicit ServicePort(WeakPtrWillBeRawPtr<ServicePortCollection>, const WebSe rvicePort&); | |
haraken
2015/06/24 23:59:59
Drop explicit.
Marijn Kruisselbrink
2015/06/25 01:07:26
Done
| |
45 | |
46 bool m_isOpen; | |
47 WebServicePort m_port; | |
48 RefPtr<SerializedScriptValue> m_serializedData; | |
49 WeakPtrWillBeWeakMember<ServicePortCollection> m_collection; | |
haraken
2015/06/24 23:59:59
Would you help me understand why this needs to be
Marijn Kruisselbrink
2015/06/25 01:07:26
With ServicePortCollection being refcounted I had
haraken
2015/06/25 01:21:40
Cool!
| |
50 }; | |
51 | |
52 } // namespace blink | |
53 | |
54 #endif // ServicePort_h | |
OLD | NEW |