Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp

Issue 2752593003: Migrate WTF::Deque::first() to ::front() (Closed)
Patch Set: one more platform specific reference Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 if (final) { 390 if (final) {
391 m_messages.pop_front(); 391 m_messages.pop_front();
392 m_sentSizeOfTopMessage = 0; 392 m_sentSizeOfTopMessage = 0;
393 } 393 }
394 } 394 }
395 395
396 void DocumentWebSocketChannel::processSendQueue() { 396 void DocumentWebSocketChannel::processSendQueue() {
397 DCHECK(m_handle); 397 DCHECK(m_handle);
398 uint64_t consumedBufferedAmount = 0; 398 uint64_t consumedBufferedAmount = 0;
399 while (!m_messages.isEmpty() && !m_blobLoader) { 399 while (!m_messages.isEmpty() && !m_blobLoader) {
400 Message* message = m_messages.first().get(); 400 Message* message = m_messages.front().get();
401 if (m_sendingQuota == 0 && message->type != MessageTypeClose) 401 if (m_sendingQuota == 0 && message->type != MessageTypeClose)
402 break; 402 break;
403 switch (message->type) { 403 switch (message->type) {
404 case MessageTypeText: 404 case MessageTypeText:
405 sendInternal(WebSocketHandle::MessageTypeText, message->text.data(), 405 sendInternal(WebSocketHandle::MessageTypeText, message->text.data(),
406 message->text.length(), &consumedBufferedAmount); 406 message->text.length(), &consumedBufferedAmount);
407 break; 407 break;
408 case MessageTypeBlob: 408 case MessageTypeBlob:
409 DCHECK(!m_blobLoader); 409 DCHECK(!m_blobLoader);
410 m_blobLoader = new BlobLoader(message->blobDataHandle, this); 410 m_blobLoader = new BlobLoader(message->blobDataHandle, this);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 665
666 if (m_client) 666 if (m_client)
667 m_client->didStartClosingHandshake(); 667 m_client->didStartClosingHandshake();
668 } 668 }
669 669
670 void DocumentWebSocketChannel::didFinishLoadingBlob(DOMArrayBuffer* buffer) { 670 void DocumentWebSocketChannel::didFinishLoadingBlob(DOMArrayBuffer* buffer) {
671 m_blobLoader.clear(); 671 m_blobLoader.clear();
672 DCHECK(m_handle); 672 DCHECK(m_handle);
673 // The loaded blob is always placed on m_messages[0]. 673 // The loaded blob is always placed on m_messages[0].
674 DCHECK_GT(m_messages.size(), 0u); 674 DCHECK_GT(m_messages.size(), 0u);
675 DCHECK_EQ(m_messages.first()->type, MessageTypeBlob); 675 DCHECK_EQ(m_messages.front()->type, MessageTypeBlob);
676 // We replace it with the loaded blob. 676 // We replace it with the loaded blob.
677 m_messages.first() = new Message(buffer); 677 m_messages.front() = new Message(buffer);
678 processSendQueue(); 678 processSendQueue();
679 } 679 }
680 680
681 void DocumentWebSocketChannel::didFailLoadingBlob( 681 void DocumentWebSocketChannel::didFailLoadingBlob(
682 FileError::ErrorCode errorCode) { 682 FileError::ErrorCode errorCode) {
683 m_blobLoader.clear(); 683 m_blobLoader.clear();
684 if (errorCode == FileError::kAbortErr) { 684 if (errorCode == FileError::kAbortErr) {
685 // The error is caused by cancel(). 685 // The error is caused by cancel().
686 return; 686 return;
687 } 687 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 WebSocketChannel::trace(visitor); 720 WebSocketChannel::trace(visitor);
721 } 721 }
722 722
723 std::ostream& operator<<(std::ostream& ostream, 723 std::ostream& operator<<(std::ostream& ostream,
724 const DocumentWebSocketChannel* channel) { 724 const DocumentWebSocketChannel* channel) {
725 return ostream << "DocumentWebSocketChannel " 725 return ostream << "DocumentWebSocketChannel "
726 << static_cast<const void*>(channel); 726 << static_cast<const void*>(channel);
727 } 727 }
728 728
729 } // namespace blink 729 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698