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

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

Issue 2749753002: Migrate WTF::Deque::removeFirst() to ::pop_front() (Closed)
Patch Set: 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 static_cast<uint64_t>(totalSize - m_sentSizeOfTopMessage))); 381 static_cast<uint64_t>(totalSize - m_sentSizeOfTopMessage)));
382 bool final = (m_sentSizeOfTopMessage + size == totalSize); 382 bool final = (m_sentSizeOfTopMessage + size == totalSize);
383 383
384 m_handle->send(final, frameType, data + m_sentSizeOfTopMessage, size); 384 m_handle->send(final, frameType, data + m_sentSizeOfTopMessage, size);
385 385
386 m_sentSizeOfTopMessage += size; 386 m_sentSizeOfTopMessage += size;
387 m_sendingQuota -= size; 387 m_sendingQuota -= size;
388 *consumedBufferedAmount += size; 388 *consumedBufferedAmount += size;
389 389
390 if (final) { 390 if (final) {
391 m_messages.removeFirst(); 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.first().get();
401 if (m_sendingQuota == 0 && message->type != MessageTypeClose) 401 if (m_sendingQuota == 0 && message->type != MessageTypeClose)
(...skipping 21 matching lines...) Expand all
423 case MessageTypeBinaryAsCharVector: 423 case MessageTypeBinaryAsCharVector:
424 sendInternal(WebSocketHandle::MessageTypeBinary, 424 sendInternal(WebSocketHandle::MessageTypeBinary,
425 message->vectorData->data(), message->vectorData->size(), 425 message->vectorData->data(), message->vectorData->size(),
426 &consumedBufferedAmount); 426 &consumedBufferedAmount);
427 break; 427 break;
428 case MessageTypeClose: { 428 case MessageTypeClose: {
429 // No message should be sent from now on. 429 // No message should be sent from now on.
430 DCHECK_EQ(m_messages.size(), 1u); 430 DCHECK_EQ(m_messages.size(), 1u);
431 DCHECK_EQ(m_sentSizeOfTopMessage, 0u); 431 DCHECK_EQ(m_sentSizeOfTopMessage, 0u);
432 m_handle->close(message->code, message->reason); 432 m_handle->close(message->code, message->reason);
433 m_messages.removeFirst(); 433 m_messages.pop_front();
434 break; 434 break;
435 } 435 }
436 } 436 }
437 } 437 }
438 if (m_client && consumedBufferedAmount > 0) 438 if (m_client && consumedBufferedAmount > 0)
439 m_client->didConsumeBufferedAmount(consumedBufferedAmount); 439 m_client->didConsumeBufferedAmount(consumedBufferedAmount);
440 } 440 }
441 441
442 void DocumentWebSocketChannel::flowControlIfNecessary() { 442 void DocumentWebSocketChannel::flowControlIfNecessary() {
443 if (!m_handle || 443 if (!m_handle ||
(...skipping 276 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