Changeset 54267 in webkit
- Timestamp:
- Feb 2, 2010 5:36:14 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r54254 r54267 1 2010-02-02 Fumitoshi Ukai <ukai@chromium.org> 2 3 Reviewed by Alexey Proskuryakov. 4 5 WebSocket wrapper can be collected even if events are pending 6 https://bugs.webkit.org/show_bug.cgi?id=34014 7 8 * websocket/tests/websocket-pending-activity-expected.txt: Added. 9 * websocket/tests/websocket-pending-activity.html: Added. 10 1 11 2010-02-02 Eric Seidel <eric@webkit.org> 2 12 -
trunk/WebCore/ChangeLog
r54266 r54267 1 2010-02-02 Fumitoshi Ukai <ukai@chromium.org> 2 3 Reviewed by Alexey Proskuryakov. 4 5 WebSocket set pending activity to avoid unexpected GC. 6 https://bugs.webkit.org/show_bug.cgi?id=34014 7 8 Test: websocket/tests/websocket-pending-activity.html 9 10 * websockets/WebSocket.cpp: 11 (WebCore::WebSocket::connect): set pending activity until it receives didClose. 12 (WebCore::WebSocket::contextDestroyed): check socket is already closed. 13 (WebCore::WebSocket::stop): close the connection and unset pending activity when it stops. 14 (WebCore::WebSocket::didClose): unset pending activity. 15 * websockets/WebSocket.h: 16 * websockets/WebSocketChannel.cpp: 17 (WebCore::WebSocketChannel::didReceiveData): protect this while it processes received data. 18 1 19 2010-02-02 Gustavo Noronha Silva <gns@gnome.org> 2 20 -
trunk/WebCore/websockets/WebSocket.cpp
r52892 r54267 152 152 m_channel = ThreadableWebSocketChannel::create(scriptExecutionContext(), this, m_url, m_protocol); 153 153 m_channel->connect(); 154 ActiveDOMObject::setPendingActivity(this); 154 155 } 155 156 … … 199 200 } 200 201 202 void WebSocket::contextDestroyed() 203 { 204 LOG(Network, "WebSocket %p scriptExecutionContext destroyed", this); 205 ASSERT(!m_channel); 206 ASSERT(m_state == CLOSED); 207 ActiveDOMObject::contextDestroyed(); 208 } 209 210 void WebSocket::stop() 211 { 212 bool pending = hasPendingActivity(); 213 if (m_channel) 214 m_channel->disconnect(); 215 m_channel = 0; 216 m_state = CLOSED; 217 ActiveDOMObject::stop(); 218 if (pending) 219 ActiveDOMObject::unsetPendingActivity(this); 220 } 221 201 222 void WebSocket::didConnect() 202 223 { … … 225 246 m_state = CLOSED; 226 247 dispatchEvent(Event::create(eventNames().closeEvent, false, false)); 248 m_channel = 0; 249 if (hasPendingActivity()) 250 ActiveDOMObject::unsetPendingActivity(this); 227 251 } 228 252 -
trunk/WebCore/websockets/WebSocket.h
r52892 r54267 83 83 84 84 virtual ScriptExecutionContext* scriptExecutionContext() const; 85 virtual void contextDestroyed(); 86 virtual void stop(); 85 87 86 88 using RefCounted<WebSocket>::ref; -
trunk/WebCore/websockets/WebSocketChannel.cpp
r52234 r54267 142 142 { 143 143 LOG(Network, "WebSocketChannel %p didReceiveData %d", this, len); 144 RefPtr<WebSocketChannel> protect(this); // The client can close the channel, potentially removing the last reference. 144 145 ASSERT(handle == m_handle); 145 146 if (!appendToBuffer(data, len)) {
Note: See TracChangeset
for help on using the changeset viewer.