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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host.h

Issue 677473002: Implement UMA and internal data structure for tracking EWOULDBLOCK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/common/p2p_socket_type.h" 10 #include "content/common/p2p_socket_type.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 void StartRtpDump( 85 void StartRtpDump(
86 bool incoming, 86 bool incoming,
87 bool outgoing, 87 bool outgoing,
88 const RenderProcessHost::WebRtcRtpPacketCallback& packet_callback); 88 const RenderProcessHost::WebRtcRtpPacketCallback& packet_callback);
89 void StopRtpDump(bool incoming, bool outgoing); 89 void StopRtpDump(bool incoming, bool outgoing);
90 90
91 protected: 91 protected:
92 friend class P2PSocketHostTcpTestBase; 92 friend class P2PSocketHostTcpTestBase;
93 93
94 // This should match suffix IPProtocolType defined in histograms.xml.
95 enum ProtocolType { UNKNOWN = 0, UDP = 0x1, TCP = 0x2 };
96
94 // TODO(mallinath) - Remove this below enum and use one defined in 97 // TODO(mallinath) - Remove this below enum and use one defined in
95 // libjingle/souce/talk/p2p/base/stun.h 98 // libjingle/souce/talk/p2p/base/stun.h
96 enum StunMessageType { 99 enum StunMessageType {
97 STUN_BINDING_REQUEST = 0x0001, 100 STUN_BINDING_REQUEST = 0x0001,
98 STUN_BINDING_RESPONSE = 0x0101, 101 STUN_BINDING_RESPONSE = 0x0101,
99 STUN_BINDING_ERROR_RESPONSE = 0x0111, 102 STUN_BINDING_ERROR_RESPONSE = 0x0111,
100 STUN_SHARED_SECRET_REQUEST = 0x0002, 103 STUN_SHARED_SECRET_REQUEST = 0x0002,
101 STUN_SHARED_SECRET_RESPONSE = 0x0102, 104 STUN_SHARED_SECRET_RESPONSE = 0x0102,
102 STUN_SHARED_SECRET_ERROR_RESPONSE = 0x0112, 105 STUN_SHARED_SECRET_ERROR_RESPONSE = 0x0112,
103 STUN_ALLOCATE_REQUEST = 0x0003, 106 STUN_ALLOCATE_REQUEST = 0x0003,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 138
136 // Calls |packet_dump_callback_| to record the RTP header. 139 // Calls |packet_dump_callback_| to record the RTP header.
137 void DumpRtpPacket(const char* packet, size_t length, bool incoming); 140 void DumpRtpPacket(const char* packet, size_t length, bool incoming);
138 141
139 // A helper to dump the packet on the IO thread. 142 // A helper to dump the packet on the IO thread.
140 void DumpRtpPacketOnIOThread(scoped_ptr<uint8[]> packet_header, 143 void DumpRtpPacketOnIOThread(scoped_ptr<uint8[]> packet_header,
141 size_t header_length, 144 size_t header_length,
142 size_t packet_length, 145 size_t packet_length,
143 bool incoming); 146 bool incoming);
144 147
148 // Used by subclasses to track the metrics of delayed bytes and packets.
149 void IncrementDelayedPackets();
150 void IncrementTotalSentPackets();
151 void IncrementDelayedBytes(uint32 size);
152 void DecrementDelayedBytes(uint32 size);
153
145 IPC::Sender* message_sender_; 154 IPC::Sender* message_sender_;
146 int id_; 155 int id_;
147 State state_; 156 State state_;
148 bool dump_incoming_rtp_packet_; 157 bool dump_incoming_rtp_packet_;
149 bool dump_outgoing_rtp_packet_; 158 bool dump_outgoing_rtp_packet_;
150 RenderProcessHost::WebRtcRtpPacketCallback packet_dump_callback_; 159 RenderProcessHost::WebRtcRtpPacketCallback packet_dump_callback_;
151 160
152 base::WeakPtrFactory<P2PSocketHost> weak_ptr_factory_; 161 base::WeakPtrFactory<P2PSocketHost> weak_ptr_factory_;
153 162
163 ProtocolType protocol_type_;
164
165 private:
166 // Track total delayed packets for calculating how many packets are
167 // delayed by system at the end of call.
168 uint32 send_packets_delayed_total_;
169 uint32 send_packets_total_;
170
171 // Track the maximum of consecutive delayed bytes caused by system's
172 // EWOULDBLOCK.
173 int32 send_bytes_delayed_max_;
174 int32 send_bytes_delayed_cur_;
175
154 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); 176 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost);
155 }; 177 };
156 178
157 } // namespace content 179 } // namespace content
158 180
159 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ 181 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/p2p/socket_host.cc » ('j') | content/browser/renderer_host/p2p/socket_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698