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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 void WebSocket::stop() | 578 void WebSocket::stop() |
579 { | 579 { |
580 m_eventQueue->stop(); | 580 m_eventQueue->stop(); |
581 if (m_channel) { | 581 if (m_channel) { |
582 m_channel->close(WebSocketChannel::CloseEventCodeGoingAway, String()); | 582 m_channel->close(WebSocketChannel::CloseEventCodeGoingAway, String()); |
583 releaseChannel(); | 583 releaseChannel(); |
584 } | 584 } |
585 m_state = CLOSED; | 585 m_state = CLOSED; |
586 } | 586 } |
587 | 587 |
588 void WebSocket::didConnect() | 588 void WebSocket::didConnect(const String& subprotocol, const String& extensions) |
589 { | 589 { |
590 WTF_LOG(Network, "WebSocket %p didConnect()", this); | 590 WTF_LOG(Network, "WebSocket %p didConnect()", this); |
591 if (m_state != CONNECTING) | 591 if (m_state != CONNECTING) |
592 return; | 592 return; |
593 m_state = OPEN; | 593 m_state = OPEN; |
594 m_subprotocol = m_channel->subprotocol(); | 594 m_subprotocol = subprotocol; |
595 m_extensions = m_channel->extensions(); | 595 m_extensions = extensions; |
596 m_eventQueue->dispatch(Event::create(EventTypeNames::open)); | 596 m_eventQueue->dispatch(Event::create(EventTypeNames::open)); |
597 } | 597 } |
598 | 598 |
599 void WebSocket::didReceiveMessage(const String& msg) | 599 void WebSocket::didReceiveMessage(const String& msg) |
600 { | 600 { |
601 WTF_LOG(Network, "WebSocket %p didReceiveMessage() Text message '%s'", this,
msg.utf8().data()); | 601 WTF_LOG(Network, "WebSocket %p didReceiveMessage() Text message '%s'", this,
msg.utf8().data()); |
602 if (m_state != OPEN) | 602 if (m_state != OPEN) |
603 return; | 603 return; |
604 m_eventQueue->dispatch(MessageEvent::create(msg, SecurityOrigin::create(m_ur
l)->toString())); | 604 m_eventQueue->dispatch(MessageEvent::create(msg, SecurityOrigin::create(m_ur
l)->toString())); |
605 } | 605 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 } | 681 } |
682 | 682 |
683 void WebSocket::trace(Visitor* visitor) | 683 void WebSocket::trace(Visitor* visitor) |
684 { | 684 { |
685 visitor->trace(m_channel); | 685 visitor->trace(m_channel); |
686 visitor->trace(m_eventQueue); | 686 visitor->trace(m_eventQueue); |
687 EventTargetWithInlineData::trace(visitor); | 687 EventTargetWithInlineData::trace(visitor); |
688 } | 688 } |
689 | 689 |
690 } // namespace WebCore | 690 } // namespace WebCore |
OLD | NEW |