1 // Copyright 2015 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_SOCKET_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ 6 #define NET_SOCKET_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ 7 8 #include <memory> 9 10 #include "net/base/net_export.h" 11 12 namespace net { 13 14 class IPAddress; 15 class SocketPerformanceWatcher; 16 17 // SocketPerformanceWatcherFactory creates socket performance watcher for 18 // different type of sockets. 19 class NET_EXPORT_PRIVATE SocketPerformanceWatcherFactory { 20 public: 21 // Transport layer protocol used by the socket that are supported by 22 // |SocketPerformanceWatcherFactory|. 23 enum Protocol { PROTOCOL_TCP, PROTOCOL_QUIC }; 24 25 SocketPerformanceWatcherFactory(const SocketPerformanceWatcherFactory&) = 26 delete; 27 SocketPerformanceWatcherFactory& operator=( 28 const SocketPerformanceWatcherFactory&) = delete; 29 30 virtual ~SocketPerformanceWatcherFactory() = default; 31 32 // Creates a socket performance watcher that will record statistics for a 33 // single socket that uses |protocol| as the transport layer protocol. 34 // |ip_address| is the IP address that the socket is going to connect to. 35 // Implementations must return a valid, unique SocketRecorder for every call; 36 // recorders must not be shared across calls or objects, nor is nullptr valid. 37 virtual std::unique_ptr<SocketPerformanceWatcher> 38 CreateSocketPerformanceWatcher(const Protocol protocol, 39 const IPAddress& ip_address) = 0; 40 41 protected: 42 SocketPerformanceWatcherFactory() = default; 43 }; 44 45 } // namespace net 46 47 #endif // NET_SOCKET_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ 48