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

Unified Diff: net/quic/quic_protocol.cc

Issue 1399893005: relnote: Inline all frames smaller than a pointer into QuicFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Avoid_redundant_recvmmsg_104327020
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_protocol.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_protocol.cc
diff --git a/net/quic/quic_protocol.cc b/net/quic/quic_protocol.cc
index 41fdf0373f2ec54aecf69921e00a640df1dbdcea..c7113473feff2c0796284d98f435b5ac59b3db87 100644
--- a/net/quic/quic_protocol.cc
+++ b/net/quic/quic_protocol.cc
@@ -266,59 +266,37 @@ QuicConnectionCloseFrame::QuicConnectionCloseFrame()
QuicFrame::QuicFrame() {}
-QuicFrame::QuicFrame(QuicPaddingFrame* padding_frame)
- : type(PADDING_FRAME),
- padding_frame(padding_frame) {
-}
+QuicFrame::QuicFrame(QuicPaddingFrame padding_frame)
+ : type(PADDING_FRAME), padding_frame(padding_frame) {}
QuicFrame::QuicFrame(QuicStreamFrame* stream_frame)
- : type(STREAM_FRAME),
- stream_frame(stream_frame) {
-}
+ : type(STREAM_FRAME), stream_frame(stream_frame) {}
-QuicFrame::QuicFrame(QuicAckFrame* frame)
- : type(ACK_FRAME),
- ack_frame(frame) {
-}
+QuicFrame::QuicFrame(QuicAckFrame* frame) : type(ACK_FRAME), ack_frame(frame) {}
-QuicFrame::QuicFrame(QuicMtuDiscoveryFrame* frame)
- : type(MTU_DISCOVERY_FRAME), mtu_discovery_frame(frame) {
-}
+QuicFrame::QuicFrame(QuicMtuDiscoveryFrame frame)
+ : type(MTU_DISCOVERY_FRAME), mtu_discovery_frame(frame) {}
QuicFrame::QuicFrame(QuicStopWaitingFrame* frame)
- : type(STOP_WAITING_FRAME),
- stop_waiting_frame(frame) {
-}
+ : type(STOP_WAITING_FRAME), stop_waiting_frame(frame) {}
-QuicFrame::QuicFrame(QuicPingFrame* frame)
- : type(PING_FRAME),
- ping_frame(frame) {
-}
+QuicFrame::QuicFrame(QuicPingFrame frame)
+ : type(PING_FRAME), ping_frame(frame) {}
QuicFrame::QuicFrame(QuicRstStreamFrame* frame)
- : type(RST_STREAM_FRAME),
- rst_stream_frame(frame) {
-}
+ : type(RST_STREAM_FRAME), rst_stream_frame(frame) {}
QuicFrame::QuicFrame(QuicConnectionCloseFrame* frame)
- : type(CONNECTION_CLOSE_FRAME),
- connection_close_frame(frame) {
-}
+ : type(CONNECTION_CLOSE_FRAME), connection_close_frame(frame) {}
QuicFrame::QuicFrame(QuicGoAwayFrame* frame)
- : type(GOAWAY_FRAME),
- goaway_frame(frame) {
-}
+ : type(GOAWAY_FRAME), goaway_frame(frame) {}
QuicFrame::QuicFrame(QuicWindowUpdateFrame* frame)
- : type(WINDOW_UPDATE_FRAME),
- window_update_frame(frame) {
-}
+ : type(WINDOW_UPDATE_FRAME), window_update_frame(frame) {}
-QuicFrame::QuicFrame(QuicBlockedFrame* frame)
- : type(BLOCKED_FRAME),
- blocked_frame(frame) {
-}
+QuicFrame::QuicFrame(QuicBlockedFrame frame)
+ : type(BLOCKED_FRAME), blocked_frame(frame) {}
QuicFecData::QuicFecData() : fec_group(0) {}
@@ -615,7 +593,7 @@ ostream& operator<<(ostream& os, const QuicFrame& frame) {
break;
}
case BLOCKED_FRAME: {
- os << "type { BLOCKED_FRAME } " << *(frame.blocked_frame);
+ os << "type { BLOCKED_FRAME } " << frame.blocked_frame;
break;
}
case STREAM_FRAME: {
@@ -788,43 +766,37 @@ RetransmittableFrames::RetransmittableFrames(EncryptionLevel level)
}
RetransmittableFrames::~RetransmittableFrames() {
- for (QuicFrames::iterator it = frames_.begin(); it != frames_.end(); ++it) {
- switch (it->type) {
+ for (QuicFrame& frame : frames_) {
+ switch (frame.type) {
+ // Frames smaller than a pointer are inlined, so don't need to be deleted.
case PADDING_FRAME:
- delete it->padding_frame;
+ case MTU_DISCOVERY_FRAME:
+ case PING_FRAME:
+ case BLOCKED_FRAME:
break;
case STREAM_FRAME:
- delete it->stream_frame;
+ delete frame.stream_frame;
break;
case ACK_FRAME:
- delete it->ack_frame;
- break;
- case MTU_DISCOVERY_FRAME:
- delete it->mtu_discovery_frame;
+ delete frame.ack_frame;
break;
case STOP_WAITING_FRAME:
- delete it->stop_waiting_frame;
- break;
- case PING_FRAME:
- delete it->ping_frame;
+ delete frame.stop_waiting_frame;
break;
case RST_STREAM_FRAME:
- delete it->rst_stream_frame;
+ delete frame.rst_stream_frame;
break;
case CONNECTION_CLOSE_FRAME:
- delete it->connection_close_frame;
+ delete frame.connection_close_frame;
break;
case GOAWAY_FRAME:
- delete it->goaway_frame;
+ delete frame.goaway_frame;
break;
case WINDOW_UPDATE_FRAME:
- delete it->window_update_frame;
- break;
- case BLOCKED_FRAME:
- delete it->blocked_frame;
+ delete frame.window_update_frame;
break;
case NUM_FRAME_TYPES:
- DCHECK(false) << "Cannot delete type: " << it->type;
+ DCHECK(false) << "Cannot delete type: " << frame.type;
}
}
// TODO(rtenneti): Delete the for loop once chrome has c++11 library support
« no previous file with comments | « net/quic/quic_protocol.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698