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

Side by Side Diff: net/socket/socket_test_util.h

Issue 1898133002: Add reprioritization to socket pools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated latest round of comments. Created 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SOCKET_SOCKET_TEST_UTIL_H_ 5 #ifndef NET_SOCKET_SOCKET_TEST_UTIL_H_
6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_ 6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 int GetOrderOfRequest(size_t index) const; 865 int GetOrderOfRequest(size_t index) const;
866 866
867 // Resets first initialized socket handle from |requests_|. If found such 867 // Resets first initialized socket handle from |requests_|. If found such
868 // a handle, returns true. 868 // a handle, returns true.
869 bool ReleaseOneConnection(KeepAlive keep_alive); 869 bool ReleaseOneConnection(KeepAlive keep_alive);
870 870
871 // Releases connections until there is nothing to release. 871 // Releases connections until there is nothing to release.
872 void ReleaseAllConnections(KeepAlive keep_alive); 872 void ReleaseAllConnections(KeepAlive keep_alive);
873 873
874 // Note that this uses 0-based indices, while GetOrderOfRequest takes and 874 // Note that this uses 0-based indices, while GetOrderOfRequest takes and
875 // returns 0-based indices. 875 // returns 1-based indices.
876 TestSocketRequest* request(int i) { return requests_[i].get(); } 876 TestSocketRequest* request(int i) { return requests_[i].get(); }
877 877
878 size_t requests_size() const { return requests_.size(); } 878 size_t requests_size() const { return requests_.size(); }
879 std::vector<std::unique_ptr<TestSocketRequest>>* requests() { 879 std::vector<std::unique_ptr<TestSocketRequest>>* requests() {
880 return &requests_; 880 return &requests_;
881 } 881 }
882 size_t completion_count() const { return completion_count_; } 882 size_t completion_count() const { return completion_count_; }
883 883
884 private: 884 private:
885 std::vector<std::unique_ptr<TestSocketRequest>> requests_; 885 std::vector<std::unique_ptr<TestSocketRequest>> requests_;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 int cancel_count() const { return cancel_count_; } 935 int cancel_count() const { return cancel_count_; }
936 936
937 // TransportClientSocketPool implementation. 937 // TransportClientSocketPool implementation.
938 int RequestSocket(const std::string& group_name, 938 int RequestSocket(const std::string& group_name,
939 const void* socket_params, 939 const void* socket_params,
940 RequestPriority priority, 940 RequestPriority priority,
941 RespectLimits respect_limits, 941 RespectLimits respect_limits,
942 ClientSocketHandle* handle, 942 ClientSocketHandle* handle,
943 const CompletionCallback& callback, 943 const CompletionCallback& callback,
944 const NetLogWithSource& net_log) override; 944 const NetLogWithSource& net_log) override;
945 945 void SetPriority(const std::string& group_name,
946 ClientSocketHandle* handle,
947 RequestPriority priority) override;
946 void CancelRequest(const std::string& group_name, 948 void CancelRequest(const std::string& group_name,
947 ClientSocketHandle* handle) override; 949 ClientSocketHandle* handle) override;
948 void ReleaseSocket(const std::string& group_name, 950 void ReleaseSocket(const std::string& group_name,
949 std::unique_ptr<StreamSocket> socket, 951 std::unique_ptr<StreamSocket> socket,
950 int id) override; 952 int id) override;
951 953
952 private: 954 private:
953 ClientSocketFactory* client_socket_factory_; 955 ClientSocketFactory* client_socket_factory_;
954 std::vector<std::unique_ptr<MockConnectJob>> job_list_; 956 std::vector<std::unique_ptr<MockConnectJob>> job_list_;
955 RequestPriority last_request_priority_; 957 RequestPriority last_request_priority_;
(...skipping 12 matching lines...) Expand all
968 ~MockSOCKSClientSocketPool() override; 970 ~MockSOCKSClientSocketPool() override;
969 971
970 // SOCKSClientSocketPool implementation. 972 // SOCKSClientSocketPool implementation.
971 int RequestSocket(const std::string& group_name, 973 int RequestSocket(const std::string& group_name,
972 const void* socket_params, 974 const void* socket_params,
973 RequestPriority priority, 975 RequestPriority priority,
974 RespectLimits respect_limits, 976 RespectLimits respect_limits,
975 ClientSocketHandle* handle, 977 ClientSocketHandle* handle,
976 const CompletionCallback& callback, 978 const CompletionCallback& callback,
977 const NetLogWithSource& net_log) override; 979 const NetLogWithSource& net_log) override;
978 980 void SetPriority(const std::string& group_name,
981 ClientSocketHandle* handle,
982 RequestPriority priority) override;
979 void CancelRequest(const std::string& group_name, 983 void CancelRequest(const std::string& group_name,
980 ClientSocketHandle* handle) override; 984 ClientSocketHandle* handle) override;
981 void ReleaseSocket(const std::string& group_name, 985 void ReleaseSocket(const std::string& group_name,
982 std::unique_ptr<StreamSocket> socket, 986 std::unique_ptr<StreamSocket> socket,
983 int id) override; 987 int id) override;
984 988
985 private: 989 private:
986 TransportClientSocketPool* const transport_pool_; 990 TransportClientSocketPool* const transport_pool_;
987 991
988 DISALLOW_COPY_AND_ASSIGN(MockSOCKSClientSocketPool); 992 DISALLOW_COPY_AND_ASSIGN(MockSOCKSClientSocketPool);
(...skipping 26 matching lines...) Expand all
1015 1019
1016 // Helper function to get the total data size of the MockReads in |reads|. 1020 // Helper function to get the total data size of the MockReads in |reads|.
1017 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); 1021 int64_t CountReadBytes(const MockRead reads[], size_t reads_size);
1018 1022
1019 // Helper function to get the total data size of the MockWrites in |writes|. 1023 // Helper function to get the total data size of the MockWrites in |writes|.
1020 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); 1024 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size);
1021 1025
1022 } // namespace net 1026 } // namespace net
1023 1027
1024 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ 1028 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698