OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 FileError::ErrorCode errorCode) { | 124 FileError::ErrorCode errorCode) { |
125 m_channel->didFailLoadingBlob(errorCode); | 125 m_channel->didFailLoadingBlob(errorCode); |
126 // |this| is deleted here. | 126 // |this| is deleted here. |
127 } | 127 } |
128 | 128 |
129 DocumentWebSocketChannel::DocumentWebSocketChannel( | 129 DocumentWebSocketChannel::DocumentWebSocketChannel( |
130 Document* document, | 130 Document* document, |
131 WebSocketChannelClient* client, | 131 WebSocketChannelClient* client, |
132 std::unique_ptr<SourceLocation> location, | 132 std::unique_ptr<SourceLocation> location, |
133 WebSocketHandle* handle) | 133 WebSocketHandle* handle) |
134 : m_handle(wrapUnique(handle ? handle : new WebSocketHandleImpl())), | 134 : m_handle(WTF::wrapUnique(handle ? handle : new WebSocketHandleImpl())), |
135 m_client(client), | 135 m_client(client), |
136 m_identifier(createUniqueIdentifier()), | 136 m_identifier(createUniqueIdentifier()), |
137 m_document(document), | 137 m_document(document), |
138 m_sendingQuota(0), | 138 m_sendingQuota(0), |
139 m_receivedDataSizeForFlowControl( | 139 m_receivedDataSizeForFlowControl( |
140 receivedDataSizeForFlowControlHighWaterMark * 2), // initial quota | 140 receivedDataSizeForFlowControlHighWaterMark * 2), // initial quota |
141 m_sentSizeOfTopMessage(0), | 141 m_sentSizeOfTopMessage(0), |
142 m_locationAtConstruction(std::move(location)) {} | 142 m_locationAtConstruction(std::move(location)) {} |
143 | 143 |
144 DocumentWebSocketChannel::~DocumentWebSocketChannel() { | 144 DocumentWebSocketChannel::~DocumentWebSocketChannel() { |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 : String::fromUTF8(m_receivingMessageData.data(), | 561 : String::fromUTF8(m_receivingMessageData.data(), |
562 m_receivingMessageData.size()); | 562 m_receivingMessageData.size()); |
563 m_receivingMessageData.clear(); | 563 m_receivingMessageData.clear(); |
564 if (message.isNull()) { | 564 if (message.isNull()) { |
565 failAsError("Could not decode a text frame as UTF-8."); | 565 failAsError("Could not decode a text frame as UTF-8."); |
566 // failAsError may delete this object. | 566 // failAsError may delete this object. |
567 } else { | 567 } else { |
568 m_client->didReceiveTextMessage(message); | 568 m_client->didReceiveTextMessage(message); |
569 } | 569 } |
570 } else { | 570 } else { |
571 std::unique_ptr<Vector<char>> binaryData = wrapUnique(new Vector<char>); | 571 std::unique_ptr<Vector<char>> binaryData = |
| 572 WTF::wrapUnique(new Vector<char>); |
572 binaryData->swap(m_receivingMessageData); | 573 binaryData->swap(m_receivingMessageData); |
573 m_client->didReceiveBinaryMessage(std::move(binaryData)); | 574 m_client->didReceiveBinaryMessage(std::move(binaryData)); |
574 } | 575 } |
575 } | 576 } |
576 | 577 |
577 void DocumentWebSocketChannel::didClose(WebSocketHandle* handle, | 578 void DocumentWebSocketChannel::didClose(WebSocketHandle* handle, |
578 bool wasClean, | 579 bool wasClean, |
579 unsigned short code, | 580 unsigned short code, |
580 const String& reason) { | 581 const String& reason) { |
581 NETWORK_DVLOG(1) << this << " didClose(" << handle << ", " << wasClean << ", " | 582 NETWORK_DVLOG(1) << this << " didClose(" << handle << ", " << wasClean << ", " |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 WebSocketChannel::trace(visitor); | 654 WebSocketChannel::trace(visitor); |
654 } | 655 } |
655 | 656 |
656 std::ostream& operator<<(std::ostream& ostream, | 657 std::ostream& operator<<(std::ostream& ostream, |
657 const DocumentWebSocketChannel* channel) { | 658 const DocumentWebSocketChannel* channel) { |
658 return ostream << "DocumentWebSocketChannel " | 659 return ostream << "DocumentWebSocketChannel " |
659 << static_cast<const void*>(channel); | 660 << static_cast<const void*>(channel); |
660 } | 661 } |
661 | 662 |
662 } // namespace blink | 663 } // namespace blink |
OLD | NEW |