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

Unified Diff: net/socket/client_socket_pool_base.h

Issue 1091793002: Report the connect status of the oldest connection in the socket pool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve comment Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/socket/client_socket_pool_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/client_socket_pool_base.h
diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h
index 4892780b4d641f0f52be1f05a73f5225ae8ed333..cd4b4f2a6b59f8198fa507665e6ce1b9c692459b 100644
--- a/net/socket/client_socket_pool_base.h
+++ b/net/socket/client_socket_pool_base.h
@@ -112,6 +112,14 @@ class NET_EXPORT_PRIVATE ConnectJob {
const BoundNetLog& net_log() const { return net_log_; }
+ // Used to order ConnectJob in a set with ascending connect time.
+ struct CompareJobConnectStartTime {
+ bool operator()(const ConnectJob* lhs, const ConnectJob* rhs) const {
+ return lhs->connect_timing().connect_start <
+ rhs->connect_timing().connect_start;
+ }
mmenke 2015/04/17 15:32:39 Also, should probably have two tests for this (In
mmenke 2015/04/17 15:32:40 If two ConnectJob are created at the same time, do
haavardm 2015/04/18 07:24:16 Agree. Using something else than a set here is pro
haavardm 2015/04/18 07:24:16 Yes, I discovered yesterday that that's exactly wh
mmenke 2015/04/18 13:49:57 That's probably because connect_start times can ch
haavardm 2015/04/20 13:03:48 Not sure I get this test. As I understand it, sock
haavardm 2015/04/20 13:03:48 I removed the compare function since list is now u
mmenke 2015/04/20 14:49:16 I was thinking SSL sockets, where more is needed a
+ };
+
protected:
RequestPriority priority() const { return priority_; }
void SetSocket(scoped_ptr<StreamSocket> socket);
@@ -450,7 +458,10 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper
void DecrementActiveSocketCount() { active_socket_count_--; }
int unassigned_job_count() const { return unassigned_job_count_; }
- const std::set<ConnectJob*>& jobs() const { return jobs_; }
+ const std::set<ConnectJob*, ConnectJob::CompareJobConnectStartTime>& jobs()
+ const {
+ return jobs_;
+ }
const std::list<IdleSocket>& idle_sockets() const { return idle_sockets_; }
int active_socket_count() const { return active_socket_count_; }
std::list<IdleSocket>* mutable_idle_sockets() { return &idle_sockets_; }
@@ -479,7 +490,7 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper
size_t unassigned_job_count_;
std::list<IdleSocket> idle_sockets_;
- std::set<ConnectJob*> jobs_;
+ std::set<ConnectJob*, ConnectJob::CompareJobConnectStartTime> jobs_;
RequestQueue pending_requests_;
int active_socket_count_; // number of active sockets used by clients
// A timer for when to start the backup job.
« no previous file with comments | « no previous file | net/socket/client_socket_pool_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698