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

Side by Side Diff: net/socket_stream/socket_stream_metrics.h

Issue 6263010: More net/ header/implementation method reordering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Collect metrics of SocketStream usage. 5 // Collect metrics of SocketStream usage.
6 // TODO(ukai): collect WebSocket specific metrics (e.g. handshake time, etc). 6 // TODO(ukai): collect WebSocket specific metrics (e.g. handshake time, etc).
7 7
8 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_ 8 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_
9 #define NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_ 9 #define NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_
10 #pragma once 10 #pragma once
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 14
15 class GURL; 15 class GURL;
16 16
17 namespace net { 17 namespace net {
18 18
19 class SocketStreamMetrics { 19 class SocketStreamMetrics {
20 public: 20 public:
21 explicit SocketStreamMetrics(const GURL& url);
22 ~SocketStreamMetrics();
23
24 void OnWaitConnection();
25 void OnStartConnection();
26 void OnTunnelProxy();
27 void OnSOCKSProxy();
28 void OnSSLConnection();
29 void OnConnected();
30 void OnRead(int len);
31 void OnWrite(int len);
32 void OnClose();
33
34 enum ProtocolType { 21 enum ProtocolType {
35 PROTOCOL_UNKNOWN, 22 PROTOCOL_UNKNOWN,
36 PROTOCOL_WEBSOCKET, 23 PROTOCOL_WEBSOCKET,
37 PROTOCOL_WEBSOCKET_SECURE, 24 PROTOCOL_WEBSOCKET_SECURE,
38 NUM_PROTOCOL_TYPES, 25 NUM_PROTOCOL_TYPES,
39 }; 26 };
27
40 enum ConnectionType { 28 enum ConnectionType {
41 CONNECTION_NONE, 29 CONNECTION_NONE,
42 ALL_CONNECTIONS, 30 ALL_CONNECTIONS,
43 TUNNEL_CONNECTION, 31 TUNNEL_CONNECTION,
44 SOCKS_CONNECTION, 32 SOCKS_CONNECTION,
45 SSL_CONNECTION, 33 SSL_CONNECTION,
46 NUM_CONNECTION_TYPES, 34 NUM_CONNECTION_TYPES,
47 }; 35 };
48 36
37 explicit SocketStreamMetrics(const GURL& url);
38 ~SocketStreamMetrics();
39
40 void OnWaitConnection();
41 void OnStartConnection();
42 void OnTunnelProxy();
43 void OnSOCKSProxy();
44 void OnSSLConnection();
45 void OnConnected();
46 void OnRead(int len);
47 void OnWrite(int len);
48 void OnClose();
49
49 private: 50 private:
50 void CountProtocolType(ProtocolType protocol_type); 51 void CountProtocolType(ProtocolType protocol_type);
51 void CountConnectionType(ConnectionType connection_type); 52 void CountConnectionType(ConnectionType connection_type);
52 53
53 base::TimeTicks wait_start_time_; 54 base::TimeTicks wait_start_time_;
54 base::TimeTicks connect_start_time_; 55 base::TimeTicks connect_start_time_;
55 base::TimeTicks connect_establish_time_; 56 base::TimeTicks connect_establish_time_;
56 int received_bytes_; 57 int received_bytes_;
57 int received_counts_; 58 int received_counts_;
58 int sent_bytes_; 59 int sent_bytes_;
59 int sent_counts_; 60 int sent_counts_;
60 61
61 DISALLOW_COPY_AND_ASSIGN(SocketStreamMetrics); 62 DISALLOW_COPY_AND_ASSIGN(SocketStreamMetrics);
62 }; 63 };
63 64
64 } // namespace net 65 } // namespace net
65 66
66 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_ 67 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698