| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 // Not to be confused with WebMessagePortChannelArray; this one uses Vector and
OwnPtr instead of WebVector and raw pointers. | 55 // Not to be confused with WebMessagePortChannelArray; this one uses Vector and
OwnPtr instead of WebVector and raw pointers. |
| 56 typedef Vector<OwnPtr<WebMessagePortChannel>, 1> MessagePortChannelArray; | 56 typedef Vector<OwnPtr<WebMessagePortChannel>, 1> MessagePortChannelArray; |
| 57 | 57 |
| 58 class CORE_EXPORT MessagePort | 58 class CORE_EXPORT MessagePort |
| 59 : public RefCountedGarbageCollectedEventTargetWithInlineData<MessagePort> | 59 : public RefCountedGarbageCollectedEventTargetWithInlineData<MessagePort> |
| 60 , public ActiveDOMObject | 60 , public ActiveDOMObject |
| 61 , public WebMessagePortChannelClient { | 61 , public WebMessagePortChannelClient { |
| 62 DEFINE_WRAPPERTYPEINFO(); | 62 DEFINE_WRAPPERTYPEINFO(); |
| 63 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MessagePort); | 63 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MessagePort); |
| 64 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MessagePort); | 64 USING_GARBAGE_COLLECTED_MIXIN(MessagePort); |
| 65 public: | 65 public: |
| 66 static MessagePort* create(ExecutionContext&); | 66 static MessagePort* create(ExecutionContext&); |
| 67 ~MessagePort() override; | 67 ~MessagePort() override; |
| 68 | 68 |
| 69 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray*, ExceptionState&); | 69 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag
e, const MessagePortArray*, ExceptionState&); |
| 70 | 70 |
| 71 void start(); | 71 void start(); |
| 72 void close(); | 72 void close(); |
| 73 | 73 |
| 74 void entangle(PassOwnPtr<WebMessagePortChannel>); | 74 void entangle(PassOwnPtr<WebMessagePortChannel>); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 86 bool started() const { return m_started; } | 86 bool started() const { return m_started; } |
| 87 | 87 |
| 88 const AtomicString& interfaceName() const override; | 88 const AtomicString& interfaceName() const override; |
| 89 ExecutionContext* executionContext() const override { return ActiveDOMObject
::executionContext(); } | 89 ExecutionContext* executionContext() const override { return ActiveDOMObject
::executionContext(); } |
| 90 MessagePort* toMessagePort() override { return this; } | 90 MessagePort* toMessagePort() override { return this; } |
| 91 | 91 |
| 92 // ActiveDOMObject implementation. | 92 // ActiveDOMObject implementation. |
| 93 bool hasPendingActivity() const override; | 93 bool hasPendingActivity() const override; |
| 94 void stop() override { close(); } | 94 void stop() override { close(); } |
| 95 | 95 |
| 96 void setOnmessage(PassRefPtrWillBeRawPtr<EventListener> listener) | 96 void setOnmessage(RawPtr<EventListener> listener) |
| 97 { | 97 { |
| 98 setAttributeEventListener(EventTypeNames::message, listener); | 98 setAttributeEventListener(EventTypeNames::message, listener); |
| 99 start(); | 99 start(); |
| 100 } | 100 } |
| 101 EventListener* onmessage() { return getAttributeEventListener(EventTypeNames
::message); } | 101 EventListener* onmessage() { return getAttributeEventListener(EventTypeNames
::message); } |
| 102 | 102 |
| 103 // A port starts out its life entangled, and remains entangled until it is c
losed or is cloned. | 103 // A port starts out its life entangled, and remains entangled until it is c
losed or is cloned. |
| 104 bool isEntangled() const { return !m_closed && !isNeutered(); } | 104 bool isEntangled() const { return !m_closed && !isNeutered(); } |
| 105 | 105 |
| 106 // A port gets neutered when it is transferred to a new owner via postMessag
e(). | 106 // A port gets neutered when it is transferred to a new owner via postMessag
e(). |
| (...skipping 18 matching lines...) Expand all Loading... |
| 125 bool m_closed; | 125 bool m_closed; |
| 126 | 126 |
| 127 WeakPtrFactory<MessagePort> m_weakFactory; | 127 WeakPtrFactory<MessagePort> m_weakFactory; |
| 128 | 128 |
| 129 RefPtr<ScriptState> m_scriptStateForConversion; | 129 RefPtr<ScriptState> m_scriptStateForConversion; |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 } // namespace blink | 132 } // namespace blink |
| 133 | 133 |
| 134 #endif // MessagePort_h | 134 #endif // MessagePort_h |
| OLD | NEW |