[GCM] Passing GCMClient::AccountTokenInfo list to GCMDriver
[chromium-blink-merge.git] / net / socket_stream / socket_stream_metrics.h
blob0040a9a00be9a21e8fc21a668ec36d886983b502
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
3 // found in the LICENSE file.
4 //
5 // Collect metrics of SocketStream usage.
6 // TODO(ukai): collect WebSocket specific metrics (e.g. handshake time, etc).
8 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_
9 #define NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_
11 #include "base/basictypes.h"
12 #include "base/time/time.h"
13 #include "net/base/net_export.h"
15 class GURL;
17 namespace net {
19 class NET_EXPORT_PRIVATE SocketStreamMetrics {
20 public:
21 enum ProtocolType {
22 PROTOCOL_UNKNOWN,
23 PROTOCOL_WEBSOCKET,
24 PROTOCOL_WEBSOCKET_SECURE,
25 NUM_PROTOCOL_TYPES,
28 enum ConnectionType {
29 CONNECTION_NONE,
30 ALL_CONNECTIONS,
31 TUNNEL_CONNECTION,
32 SOCKS_CONNECTION,
33 SSL_CONNECTION,
34 SECURE_PROXY_CONNECTION,
35 NUM_CONNECTION_TYPES,
38 enum WireProtocolType {
39 WIRE_PROTOCOL_WEBSOCKET,
40 WIRE_PROTOCOL_SPDY,
41 NUM_WIRE_PROTOCOL_TYPES,
44 explicit SocketStreamMetrics(const GURL& url);
45 ~SocketStreamMetrics();
47 void OnWaitConnection();
48 void OnStartConnection();
49 void OnConnected();
50 void OnRead(int len);
51 void OnWrite(int len);
52 void OnClose();
53 void OnCountConnectionType(ConnectionType type);
54 void OnCountWireProtocolType(WireProtocolType type);
56 private:
57 base::TimeTicks wait_start_time_;
58 base::TimeTicks connect_start_time_;
59 base::TimeTicks connect_establish_time_;
60 int received_bytes_;
61 int received_counts_;
62 int sent_bytes_;
63 int sent_counts_;
65 DISALLOW_COPY_AND_ASSIGN(SocketStreamMetrics);
68 } // namespace net
70 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_