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 "core/dom/MessagePort.h" |
| 10 #include "modules/ModulesExport.h" |
| 11 #include "public/platform/modules/navigator_services/WebServicePort.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class ExceptionState; |
| 16 class ExecutionContext; |
| 17 class MessagePort; |
| 18 class ScriptState; |
| 19 class ScriptValue; |
| 20 class SerializedScriptValue; |
| 21 class ServicePortCollection; |
| 22 |
| 23 class MODULES_EXPORT ServicePort final |
| 24 : public GarbageCollectedFinalized<ServicePort>, public ScriptWrappable { |
| 25 DEFINE_WRAPPERTYPEINFO(); |
| 26 WTF_MAKE_NONCOPYABLE(ServicePort); |
| 27 public: |
| 28 static ServicePort* create(ServicePortCollection*, const WebServicePort&); |
| 29 virtual ~ServicePort(); |
| 30 |
| 31 WebServicePortID id() const { return m_port.id; } |
| 32 |
| 33 // ServicePort.idl |
| 34 String targetURL() const; |
| 35 String name() const; |
| 36 ScriptValue data(ScriptState*) const; |
| 37 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray*, ExceptionState&); |
| 38 void close(); |
| 39 |
| 40 DECLARE_VIRTUAL_TRACE(); |
| 41 |
| 42 private: |
| 43 ServicePort(ServicePortCollection*, const WebServicePort&); |
| 44 |
| 45 bool m_isOpen; |
| 46 WebServicePort m_port; |
| 47 RefPtr<SerializedScriptValue> m_serializedData; |
| 48 Member<ServicePortCollection> m_collection; |
| 49 }; |
| 50 |
| 51 } // namespace blink |
| 52 |
| 53 #endif // ServicePort_h |
OLD | NEW |