| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 | 171 |
| 172 void MainThreadWebSocketChannel::close(int code, const String& reason) | 172 void MainThreadWebSocketChannel::close(int code, const String& reason) |
| 173 { | 173 { |
| 174 WTF_LOG(Network, "MainThreadWebSocketChannel %p close() code=%d reason='%s'"
, this, code, reason.utf8().data()); | 174 WTF_LOG(Network, "MainThreadWebSocketChannel %p close() code=%d reason='%s'"
, this, code, reason.utf8().data()); |
| 175 ASSERT(!m_suspended); | 175 ASSERT(!m_suspended); |
| 176 if (!m_handle) | 176 if (!m_handle) |
| 177 return; | 177 return; |
| 178 startClosingHandshake(code, reason); | 178 startClosingHandshake(code, reason); |
| 179 if (!m_closingTimer.isActive()) | 179 if (!m_closingTimer.isActive()) |
| 180 m_closingTimer.startOneShot(2 * TCPMaximumSegmentLifetime); | 180 m_closingTimer.startOneShot(2 * TCPMaximumSegmentLifetime, FROM_HERE); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void MainThreadWebSocketChannel::clearDocument() | 183 void MainThreadWebSocketChannel::clearDocument() |
| 184 { | 184 { |
| 185 if (m_handshake) | 185 if (m_handshake) |
| 186 m_handshake->clearDocument(); | 186 m_handshake->clearDocument(); |
| 187 m_document = 0; | 187 m_document = 0; |
| 188 } | 188 } |
| 189 | 189 |
| 190 void MainThreadWebSocketChannel::disconnectHandle() | 190 void MainThreadWebSocketChannel::disconnectHandle() |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 void MainThreadWebSocketChannel::suspend() | 237 void MainThreadWebSocketChannel::suspend() |
| 238 { | 238 { |
| 239 m_suspended = true; | 239 m_suspended = true; |
| 240 } | 240 } |
| 241 | 241 |
| 242 void MainThreadWebSocketChannel::resume() | 242 void MainThreadWebSocketChannel::resume() |
| 243 { | 243 { |
| 244 m_suspended = false; | 244 m_suspended = false; |
| 245 if ((!m_buffer.isEmpty() || (m_state == ChannelClosed)) && m_client && !m_re
sumeTimer.isActive()) | 245 if ((!m_buffer.isEmpty() || (m_state == ChannelClosed)) && m_client && !m_re
sumeTimer.isActive()) |
| 246 m_resumeTimer.startOneShot(0); | 246 m_resumeTimer.startOneShot(0, FROM_HERE); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void MainThreadWebSocketChannel::willOpenSocketStream(SocketStreamHandle* handle
) | 249 void MainThreadWebSocketChannel::willOpenSocketStream(SocketStreamHandle* handle
) |
| 250 { | 250 { |
| 251 WTF_LOG(Network, "MainThreadWebSocketChannel %p willOpenSocketStream()", thi
s); | 251 WTF_LOG(Network, "MainThreadWebSocketChannel %p willOpenSocketStream()", thi
s); |
| 252 ASSERT(handle); | 252 ASSERT(handle); |
| 253 if (m_document->frame()) | 253 if (m_document->frame()) |
| 254 m_document->frame()->loader().client()->dispatchWillOpenSocketStream(han
dle); | 254 m_document->frame()->loader().client()->dispatchWillOpenSocketStream(han
dle); |
| 255 } | 255 } |
| 256 | 256 |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 } | 822 } |
| 823 | 823 |
| 824 Vector<char> frameData; | 824 Vector<char> frameData; |
| 825 frame.makeFrameData(frameData); | 825 frame.makeFrameData(frameData); |
| 826 | 826 |
| 827 m_perMessageDeflate.resetDeflateBuffer(); | 827 m_perMessageDeflate.resetDeflateBuffer(); |
| 828 return m_handle->send(frameData.data(), frameData.size()); | 828 return m_handle->send(frameData.data(), frameData.size()); |
| 829 } | 829 } |
| 830 | 830 |
| 831 } // namespace WebCore | 831 } // namespace WebCore |
| OLD | NEW |