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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 start(); | 98 start(); |
99 } | 99 } |
100 EventListener* onmessage() { return getAttributeEventListener(EventTypeNames
::message); } | 100 EventListener* onmessage() { return getAttributeEventListener(EventTypeNames
::message); } |
101 | 101 |
102 // A port starts out its life entangled, and remains entangled until it is c
losed or is cloned. | 102 // A port starts out its life entangled, and remains entangled until it is c
losed or is cloned. |
103 bool isEntangled() const { return !m_closed && !isNeutered(); } | 103 bool isEntangled() const { return !m_closed && !isNeutered(); } |
104 | 104 |
105 // A port gets neutered when it is transferred to a new owner via postMessag
e(). | 105 // A port gets neutered when it is transferred to a new owner via postMessag
e(). |
106 bool isNeutered() const { return !m_entangledChannel; } | 106 bool isNeutered() const { return !m_entangledChannel; } |
107 | 107 |
108 virtual void trace(Visitor*) override; | 108 DECLARE_VIRTUAL_TRACE(); |
109 | 109 |
110 private: | 110 private: |
111 explicit MessagePort(ExecutionContext&); | 111 explicit MessagePort(ExecutionContext&); |
112 | 112 |
113 // WebMessagePortChannelClient implementation. | 113 // WebMessagePortChannelClient implementation. |
114 virtual void messageAvailable() override; | 114 virtual void messageAvailable() override; |
115 void dispatchMessages(); | 115 void dispatchMessages(); |
116 | 116 |
117 OwnPtr<WebMessagePortChannel> m_entangledChannel; | 117 OwnPtr<WebMessagePortChannel> m_entangledChannel; |
118 | 118 |
119 bool m_started; | 119 bool m_started; |
120 bool m_closed; | 120 bool m_closed; |
121 | 121 |
122 WeakPtrFactory<MessagePort> m_weakFactory; | 122 WeakPtrFactory<MessagePort> m_weakFactory; |
123 }; | 123 }; |
124 | 124 |
125 } // namespace blink | 125 } // namespace blink |
126 | 126 |
127 #endif // MessagePort_h | 127 #endif // MessagePort_h |
OLD | NEW |