OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 498 } |
499 | 499 |
500 void WebSocket::stop() | 500 void WebSocket::stop() |
501 { | 501 { |
502 if (!hasPendingActivity()) { | 502 if (!hasPendingActivity()) { |
503 ASSERT(!m_channel); | 503 ASSERT(!m_channel); |
504 ASSERT(m_state == CLOSED); | 504 ASSERT(m_state == CLOSED); |
505 return; | 505 return; |
506 } | 506 } |
507 if (m_channel) { | 507 if (m_channel) { |
| 508 m_channel->close(WebSocketChannel::CloseEventCodeGoingAway, String()); |
508 m_channel->disconnect(); | 509 m_channel->disconnect(); |
509 m_channel = 0; | 510 m_channel = 0; |
510 } | 511 } |
511 m_state = CLOSED; | 512 m_state = CLOSED; |
512 ActiveDOMObject::stop(); | 513 ActiveDOMObject::stop(); |
513 ActiveDOMObject::unsetPendingActivity(this); | 514 ActiveDOMObject::unsetPendingActivity(this); |
514 } | 515 } |
515 | 516 |
516 void WebSocket::didConnect() | 517 void WebSocket::didConnect() |
517 { | 518 { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 static const size_t minimumPayloadSizeWithEightByteExtendedPayloadLength = 0
x10000; | 614 static const size_t minimumPayloadSizeWithEightByteExtendedPayloadLength = 0
x10000; |
614 size_t overhead = hybiBaseFramingOverhead + hybiMaskingKeyLength; | 615 size_t overhead = hybiBaseFramingOverhead + hybiMaskingKeyLength; |
615 if (payloadSize >= minimumPayloadSizeWithEightByteExtendedPayloadLength) | 616 if (payloadSize >= minimumPayloadSizeWithEightByteExtendedPayloadLength) |
616 overhead += 8; | 617 overhead += 8; |
617 else if (payloadSize >= minimumPayloadSizeWithTwoByteExtendedPayloadLength) | 618 else if (payloadSize >= minimumPayloadSizeWithTwoByteExtendedPayloadLength) |
618 overhead += 2; | 619 overhead += 2; |
619 return overhead; | 620 return overhead; |
620 } | 621 } |
621 | 622 |
622 } // namespace WebCore | 623 } // namespace WebCore |
OLD | NEW |