| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 bool started() const { return m_started; } | 83 bool started() const { return m_started; } |
| 84 | 84 |
| 85 virtual const AtomicString& interfaceName() const OVERRIDE; | 85 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 86 virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveD
OMObject::executionContext(); } | 86 virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveD
OMObject::executionContext(); } |
| 87 virtual MessagePort* toMessagePort() OVERRIDE { return this; } | 87 virtual MessagePort* toMessagePort() OVERRIDE { return this; } |
| 88 | 88 |
| 89 // ActiveDOMObject implementation. | 89 // ActiveDOMObject implementation. |
| 90 virtual bool hasPendingActivity() const OVERRIDE; | 90 virtual bool hasPendingActivity() const OVERRIDE; |
| 91 virtual void stop() OVERRIDE { close(); } | 91 virtual void stop() OVERRIDE { close(); } |
| 92 | 92 |
| 93 void setOnmessage(PassRefPtr<EventListener> listener, DOMWrapperWorld* world
) | 93 void setOnmessage(PassRefPtr<EventListener> listener) |
| 94 { | 94 { |
| 95 setAttributeEventListener(EventTypeNames::message, listener, world); | 95 setAttributeEventListener(EventTypeNames::message, listener); |
| 96 start(); | 96 start(); |
| 97 } | 97 } |
| 98 EventListener* onmessage(DOMWrapperWorld* world) { return getAttributeEventL
istener(EventTypeNames::message, world); } | 98 EventListener* onmessage() { return getAttributeEventListener(EventTypeNames
::message); } |
| 99 | 99 |
| 100 // A port starts out its life entangled, and remains entangled until it is c
losed or is cloned. | 100 // A port starts out its life entangled, and remains entangled until it is c
losed or is cloned. |
| 101 bool isEntangled() const { return !m_closed && !isNeutered(); } | 101 bool isEntangled() const { return !m_closed && !isNeutered(); } |
| 102 | 102 |
| 103 // A port gets neutered when it is transferred to a new owner via postMessag
e(). | 103 // A port gets neutered when it is transferred to a new owner via postMessag
e(). |
| 104 bool isNeutered() const { return !m_entangledChannel; } | 104 bool isNeutered() const { return !m_entangledChannel; } |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 explicit MessagePort(ExecutionContext&); | 107 explicit MessagePort(ExecutionContext&); |
| 108 | 108 |
| 109 // WebMessagePortChannelClient implementation. | 109 // WebMessagePortChannelClient implementation. |
| 110 virtual void messageAvailable() OVERRIDE; | 110 virtual void messageAvailable() OVERRIDE; |
| 111 void dispatchMessages(); | 111 void dispatchMessages(); |
| 112 | 112 |
| 113 OwnPtr<blink::WebMessagePortChannel> m_entangledChannel; | 113 OwnPtr<blink::WebMessagePortChannel> m_entangledChannel; |
| 114 | 114 |
| 115 bool m_started; | 115 bool m_started; |
| 116 bool m_closed; | 116 bool m_closed; |
| 117 | 117 |
| 118 WeakPtrFactory<MessagePort> m_weakFactory; | 118 WeakPtrFactory<MessagePort> m_weakFactory; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 } // namespace WebCore | 121 } // namespace WebCore |
| 122 | 122 |
| 123 #endif // MessagePort_h | 123 #endif // MessagePort_h |
| OLD | NEW |