OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 NET_BASE_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ | 5 #ifndef NET_BASE_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ |
6 #define NET_BASE_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ | 6 #define NET_BASE_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
11 | 11 |
12 namespace base { | |
13 class TimeDelta; | |
14 } // namespace base | |
15 | |
16 namespace net { | 12 namespace net { |
17 | 13 |
18 class SocketPerformanceWatcher; | 14 class SocketPerformanceWatcher; |
19 | 15 |
20 // SocketPerformanceWatcherFactory creates socket performance watcher for | 16 // SocketPerformanceWatcherFactory creates socket performance watcher for |
21 // different type of sockets. | 17 // different type of sockets. |
22 class NET_EXPORT_PRIVATE SocketPerformanceWatcherFactory { | 18 class NET_EXPORT_PRIVATE SocketPerformanceWatcherFactory { |
23 public: | 19 public: |
24 // Transport layer protocol used by the socket that are supported by | 20 // Transport layer protocol used by the socket that are supported by |
25 // |SocketPerformanceWatcherFactory|. | 21 // |SocketPerformanceWatcherFactory|. |
26 enum Protocol { PROTOCOL_TCP, PROTOCOL_QUIC }; | 22 enum Protocol { PROTOCOL_TCP, PROTOCOL_QUIC }; |
27 | 23 |
28 virtual ~SocketPerformanceWatcherFactory() {} | 24 virtual ~SocketPerformanceWatcherFactory() {} |
29 | 25 |
30 // Creates a socket performance watcher that will record statistics for a | 26 // Creates a socket performance watcher that will record statistics for a |
31 // single socket that uses |protocol| as the transport layer protocol. | 27 // single socket that uses |protocol| as the transport layer protocol. |
32 // Implementations must return a valid, unique SocketRecorder for every call; | 28 // Implementations must return a valid, unique SocketRecorder for every call; |
33 // recorders must not be shared across calls or objects, nor is nullptr valid. | 29 // recorders must not be shared across calls or objects, nor is nullptr valid. |
34 virtual scoped_ptr<SocketPerformanceWatcher> CreateSocketPerformanceWatcher( | 30 virtual scoped_ptr<SocketPerformanceWatcher> CreateSocketPerformanceWatcher( |
35 const Protocol protocol) = 0; | 31 const Protocol protocol) = 0; |
36 | 32 |
37 // Called when updated transport layer RTT information is available from one | |
38 // of the watchers created by |this|. |protocol| is the protocol that was used | |
39 // by the watcher. |rtt| must be the transport layer RTT from this device to | |
40 // the remote transport layer endpoint. These methods are called immediately | |
41 // after the observation is made, hence no timestamp. | |
42 virtual void OnUpdatedRTTAvailable(const Protocol protocol, | |
43 const base::TimeDelta& rtt) = 0; | |
44 | |
45 protected: | 33 protected: |
46 SocketPerformanceWatcherFactory() {} | 34 SocketPerformanceWatcherFactory() {} |
47 | 35 |
48 private: | 36 private: |
49 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcherFactory); | 37 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcherFactory); |
50 }; | 38 }; |
51 | 39 |
52 } // namespace net | 40 } // namespace net |
53 | 41 |
54 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ | 42 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ |
OLD | NEW |