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

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

Issue 363025: Improve the display of LoadLogs when truncation occurs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Change -1 to be a constant instead Created 11 years, 1 month 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "net/base/load_log.h" 11 #include "net/base/load_log.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "net/socket/client_socket_handle.h" 13 #include "net/socket/client_socket_handle.h"
14 14
15 using base::TimeDelta; 15 using base::TimeDelta;
16 16
17 namespace { 17 namespace {
18 18
19 // The timeout value, in seconds, used to clean up idle sockets that can't be 19 // The timeout value, in seconds, used to clean up idle sockets that can't be
20 // reused. 20 // reused.
21 // 21 //
22 // Note: It's important to close idle sockets that have received data as soon 22 // Note: It's important to close idle sockets that have received data as soon
23 // as possible because the received data may cause BSOD on Windows XP under 23 // as possible because the received data may cause BSOD on Windows XP under
24 // some conditions. See http://crbug.com/4606. 24 // some conditions. See http://crbug.com/4606.
25 const int kCleanupInterval = 10; // DO NOT INCREASE THIS TIMEOUT. 25 const int kCleanupInterval = 10; // DO NOT INCREASE THIS TIMEOUT.
26 26
27 // The maximum size of the ConnectJob's LoadLog.
28 const int kMaxNumLoadLogEntries = 50;
29
27 } // namespace 30 } // namespace
28 31
29 namespace net { 32 namespace net {
30 33
31 ConnectJob::ConnectJob(const std::string& group_name, 34 ConnectJob::ConnectJob(const std::string& group_name,
32 const ClientSocketHandle* key_handle, 35 const ClientSocketHandle* key_handle,
33 base::TimeDelta timeout_duration, 36 base::TimeDelta timeout_duration,
34 Delegate* delegate, 37 Delegate* delegate,
35 LoadLog* load_log) 38 LoadLog* load_log)
36 : group_name_(group_name), 39 : group_name_(group_name),
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 return OK; 195 return OK;
193 } 196 }
194 delete idle_socket.socket; 197 delete idle_socket.socket;
195 } 198 }
196 199
197 // We couldn't find a socket to reuse, so allocate and connect a new one. 200 // We couldn't find a socket to reuse, so allocate and connect a new one.
198 201
199 // If we aren't using late binding, the job lines up with a request so 202 // If we aren't using late binding, the job lines up with a request so
200 // just write directly into the request's LoadLog. 203 // just write directly into the request's LoadLog.
201 scoped_refptr<LoadLog> job_load_log = g_late_binding ? 204 scoped_refptr<LoadLog> job_load_log = g_late_binding ?
202 new LoadLog : request->load_log(); 205 new LoadLog(kMaxNumLoadLogEntries) : request->load_log();
203 206
204 scoped_ptr<ConnectJob> connect_job( 207 scoped_ptr<ConnectJob> connect_job(
205 connect_job_factory_->NewConnectJob(group_name, *request, this, 208 connect_job_factory_->NewConnectJob(group_name, *request, this,
206 job_load_log)); 209 job_load_log));
207 210
208 int rv = connect_job->Connect(); 211 int rv = connect_job->Connect();
209 212
210 if (g_late_binding && rv != ERR_IO_PENDING && request->load_log()) 213 if (g_late_binding && rv != ERR_IO_PENDING && request->load_log())
211 request->load_log()->Append(job_load_log); 214 request->load_log()->Append(job_load_log);
212 215
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 return total == max_sockets_; 651 return total == max_sockets_;
649 } 652 }
650 653
651 } // namespace internal 654 } // namespace internal
652 655
653 void EnableLateBindingOfSockets(bool enabled) { 656 void EnableLateBindingOfSockets(bool enabled) {
654 internal::ClientSocketPoolBaseHelper::EnableLateBindingOfSockets(enabled); 657 internal::ClientSocketPoolBaseHelper::EnableLateBindingOfSockets(enabled);
655 } 658 }
656 659
657 } // namespace net 660 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/single_threaded_proxy_resolver_unittest.cc ('k') | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698