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

Side by Side Diff: net/socket/client_socket_pool_base.cc

Issue 7825026: Revert "Currently, base/timer.cc calls PostTask with FROM_HERE as the Location, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | net/socket/ssl_client_socket_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 #include "net/socket/client_socket_pool_base.h" 5 #include "net/socket/client_socket_pool_base.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 void ConnectJob::Initialize(bool is_preconnect) { 84 void ConnectJob::Initialize(bool is_preconnect) {
85 if (is_preconnect) 85 if (is_preconnect)
86 preconnect_state_ = UNUSED_PRECONNECT; 86 preconnect_state_ = UNUSED_PRECONNECT;
87 else 87 else
88 preconnect_state_ = NOT_PRECONNECT; 88 preconnect_state_ = NOT_PRECONNECT;
89 } 89 }
90 90
91 int ConnectJob::Connect() { 91 int ConnectJob::Connect() {
92 if (timeout_duration_ != base::TimeDelta()) 92 if (timeout_duration_ != base::TimeDelta())
93 timer_.Start(FROM_HERE, timeout_duration_, this, &ConnectJob::OnTimeout); 93 timer_.Start(timeout_duration_, this, &ConnectJob::OnTimeout);
94 94
95 idle_ = false; 95 idle_ = false;
96 96
97 LogConnectStart(); 97 LogConnectStart();
98 98
99 int rv = ConnectInternal(); 99 int rv = ConnectInternal();
100 100
101 if (rv != ERR_IO_PENDING) { 101 if (rv != ERR_IO_PENDING) {
102 LogConnectCompletion(rv); 102 LogConnectCompletion(rv);
103 delegate_ = NULL; 103 delegate_ = NULL;
(...skipping 20 matching lines...) Expand all
124 // The delegate will delete |this|. 124 // The delegate will delete |this|.
125 Delegate *delegate = delegate_; 125 Delegate *delegate = delegate_;
126 delegate_ = NULL; 126 delegate_ = NULL;
127 127
128 LogConnectCompletion(rv); 128 LogConnectCompletion(rv);
129 delegate->OnConnectJobComplete(rv, this); 129 delegate->OnConnectJobComplete(rv, this);
130 } 130 }
131 131
132 void ConnectJob::ResetTimer(base::TimeDelta remaining_time) { 132 void ConnectJob::ResetTimer(base::TimeDelta remaining_time) {
133 timer_.Stop(); 133 timer_.Stop();
134 timer_.Start(FROM_HERE, remaining_time, this, &ConnectJob::OnTimeout); 134 timer_.Start(remaining_time, this, &ConnectJob::OnTimeout);
135 } 135 }
136 136
137 void ConnectJob::LogConnectStart() { 137 void ConnectJob::LogConnectStart() {
138 net_log().BeginEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT, 138 net_log().BeginEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT,
139 make_scoped_refptr(new NetLogStringParameter("group_name", group_name_))); 139 make_scoped_refptr(new NetLogStringParameter("group_name", group_name_)));
140 } 140 }
141 141
142 void ConnectJob::LogConnectCompletion(int net_error) { 142 void ConnectJob::LogConnectCompletion(int net_error) {
143 net_log().EndEventWithNetErrorCode( 143 net_log().EndEventWithNetErrorCode(
144 NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT, net_error); 144 NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT, net_error);
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 g_connect_backup_jobs_enabled = enabled; 690 g_connect_backup_jobs_enabled = enabled;
691 return old_value; 691 return old_value;
692 } 692 }
693 693
694 void ClientSocketPoolBaseHelper::EnableConnectBackupJobs() { 694 void ClientSocketPoolBaseHelper::EnableConnectBackupJobs() {
695 connect_backup_jobs_enabled_ = g_connect_backup_jobs_enabled; 695 connect_backup_jobs_enabled_ = g_connect_backup_jobs_enabled;
696 } 696 }
697 697
698 void ClientSocketPoolBaseHelper::IncrementIdleCount() { 698 void ClientSocketPoolBaseHelper::IncrementIdleCount() {
699 if (++idle_socket_count_ == 1) 699 if (++idle_socket_count_ == 1)
700 timer_.Start(FROM_HERE, TimeDelta::FromSeconds(kCleanupInterval), this, 700 timer_.Start(TimeDelta::FromSeconds(kCleanupInterval), this,
701 &ClientSocketPoolBaseHelper::OnCleanupTimerFired); 701 &ClientSocketPoolBaseHelper::OnCleanupTimerFired);
702 } 702 }
703 703
704 void ClientSocketPoolBaseHelper::DecrementIdleCount() { 704 void ClientSocketPoolBaseHelper::DecrementIdleCount() {
705 if (--idle_socket_count_ == 0) 705 if (--idle_socket_count_ == 0)
706 timer_.Stop(); 706 timer_.Stop();
707 } 707 }
708 708
709 void ClientSocketPoolBaseHelper::ReleaseSocket(const std::string& group_name, 709 void ClientSocketPoolBaseHelper::ReleaseSocket(const std::string& group_name,
710 StreamSocket* socket, 710 StreamSocket* socket,
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 // Delete active jobs. 1123 // Delete active jobs.
1124 STLDeleteElements(&jobs_); 1124 STLDeleteElements(&jobs_);
1125 1125
1126 // Cancel pending backup job. 1126 // Cancel pending backup job.
1127 method_factory_.RevokeAll(); 1127 method_factory_.RevokeAll();
1128 } 1128 }
1129 1129
1130 } // namespace internal 1130 } // namespace internal
1131 1131
1132 } // namespace net 1132 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | net/socket/ssl_client_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698