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

Side by Side Diff: net/websockets/websocket_channel.cc

Issue 474973004: Remove implicit conversions from scoped_refptr to T* in net/websockets/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « net/websockets/websocket_basic_stream_test.cc ('k') | net/websockets/websocket_channel_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/websockets/websocket_channel.h" 5 #include "net/websockets/websocket_channel.h"
6 6
7 #include <limits.h> // for INT_MAX 7 #include <limits.h> // for INT_MAX
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <deque> 10 #include <deque>
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 DCHECK_LE(quota, INT_MAX); 423 DCHECK_LE(quota, INT_MAX);
424 if (!pending_received_frames_.empty()) { 424 if (!pending_received_frames_.empty()) {
425 DCHECK_EQ(0, current_receive_quota_); 425 DCHECK_EQ(0, current_receive_quota_);
426 } 426 }
427 while (!pending_received_frames_.empty() && quota > 0) { 427 while (!pending_received_frames_.empty() && quota > 0) {
428 PendingReceivedFrame& front = pending_received_frames_.front(); 428 PendingReceivedFrame& front = pending_received_frames_.front();
429 const size_t data_size = front.size() - front.offset(); 429 const size_t data_size = front.size() - front.offset();
430 const size_t bytes_to_send = 430 const size_t bytes_to_send =
431 std::min(base::checked_cast<size_t>(quota), data_size); 431 std::min(base::checked_cast<size_t>(quota), data_size);
432 const bool final = front.final() && data_size == bytes_to_send; 432 const bool final = front.final() && data_size == bytes_to_send;
433 const char* data = front.data() ? 433 const char* data =
434 front.data()->data() + front.offset() : NULL; 434 front.data().get() ? front.data()->data() + front.offset() : NULL;
wtc 2014/08/26 18:27:58 I was curious about this reformatting because we c
dcheng 2014/08/26 18:34:14 Yeah I'm not sure either. I think it has some heur
435 DCHECK(!bytes_to_send || data) << "Non empty data should not be null."; 435 DCHECK(!bytes_to_send || data) << "Non empty data should not be null.";
436 const std::vector<char> data_vector(data, data + bytes_to_send); 436 const std::vector<char> data_vector(data, data + bytes_to_send);
437 DVLOG(3) << "Sending frame previously split due to quota to the " 437 DVLOG(3) << "Sending frame previously split due to quota to the "
438 << "renderer: quota=" << quota << " data_size=" << data_size 438 << "renderer: quota=" << quota << " data_size=" << data_size
439 << " bytes_to_send=" << bytes_to_send; 439 << " bytes_to_send=" << bytes_to_send;
440 if (event_interface_->OnDataFrame(final, front.opcode(), data_vector) == 440 if (event_interface_->OnDataFrame(final, front.opcode(), data_vector) ==
441 CHANNEL_DELETED) 441 CHANNEL_DELETED)
442 return; 442 return;
443 if (bytes_to_send < data_size) { 443 if (bytes_to_send < data_size) {
444 front.DidConsume(bytes_to_send); 444 front.DidConsume(bytes_to_send);
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 } 1107 }
1108 1108
1109 void WebSocketChannel::CloseTimeout() { 1109 void WebSocketChannel::CloseTimeout() {
1110 stream_->Close(); 1110 stream_->Close();
1111 SetState(CLOSED); 1111 SetState(CLOSED);
1112 AllowUnused(DoDropChannel(false, kWebSocketErrorAbnormalClosure, "")); 1112 AllowUnused(DoDropChannel(false, kWebSocketErrorAbnormalClosure, ""));
1113 // |this| has been deleted. 1113 // |this| has been deleted.
1114 } 1114 }
1115 1115
1116 } // namespace net 1116 } // namespace net
OLDNEW
« no previous file with comments | « net/websockets/websocket_basic_stream_test.cc ('k') | net/websockets/websocket_channel_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698