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

Side by Side Diff: chrome/browser/browser_main.cc

Issue 7255002: Revert 90373 - Warmth of a connection (cwnd) is estimated by the amount of data written to the so... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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 | « chrome/browser/browser_main.h ('k') | chrome/browser/browser_main_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
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 "chrome/browser/browser_main.h" 5 #include "chrome/browser/browser_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 #include "content/common/hi_res_timer_manager.h" 93 #include "content/common/hi_res_timer_manager.h"
94 #include "content/common/main_function_params.h" 94 #include "content/common/main_function_params.h"
95 #include "content/common/result_codes.h" 95 #include "content/common/result_codes.h"
96 #include "grit/app_locale_settings.h" 96 #include "grit/app_locale_settings.h"
97 #include "grit/chromium_strings.h" 97 #include "grit/chromium_strings.h"
98 #include "grit/generated_resources.h" 98 #include "grit/generated_resources.h"
99 #include "grit/platform_locale_settings.h" 99 #include "grit/platform_locale_settings.h"
100 #include "net/base/cookie_monster.h" 100 #include "net/base/cookie_monster.h"
101 #include "net/base/net_module.h" 101 #include "net/base/net_module.h"
102 #include "net/base/network_change_notifier.h" 102 #include "net/base/network_change_notifier.h"
103 #include "net/http/http_basic_stream.h"
104 #include "net/http/http_network_layer.h" 103 #include "net/http/http_network_layer.h"
105 #include "net/http/http_stream_factory.h" 104 #include "net/http/http_stream_factory.h"
106 #include "net/socket/client_socket_pool_base.h" 105 #include "net/socket/client_socket_pool_base.h"
107 #include "net/socket/client_socket_pool_manager.h" 106 #include "net/socket/client_socket_pool_manager.h"
108 #include "net/socket/tcp_client_socket.h" 107 #include "net/socket/tcp_client_socket.h"
109 #include "net/spdy/spdy_session.h" 108 #include "net/spdy/spdy_session.h"
110 #include "net/spdy/spdy_session_pool.h" 109 #include "net/spdy/spdy_session_pool.h"
111 #include "net/url_request/url_request.h" 110 #include "net/url_request/url_request.h"
112 #include "net/url_request/url_request_throttler_manager.h" 111 #include "net/url_request/url_request_throttler_manager.h"
113 #include "net/websockets/websocket_job.h" 112 #include "net/websockets/websocket_job.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 #endif 201 #endif
203 202
204 #if defined(TOOLKIT_USES_GTK) 203 #if defined(TOOLKIT_USES_GTK)
205 #include "ui/gfx/gtk_util.h" 204 #include "ui/gfx/gtk_util.h"
206 #endif 205 #endif
207 206
208 #if defined(TOUCH_UI) && defined(HAVE_XINPUT2) 207 #if defined(TOUCH_UI) && defined(HAVE_XINPUT2)
209 #include "views/touchui/touch_factory.h" 208 #include "views/touchui/touch_factory.h"
210 #endif 209 #endif
211 210
212 namespace {
213 void SetSocketReusePolicy(int warmest_socket_trial_group,
214 const int socket_policy[],
215 int num_groups) {
216 const int* result = std::find(socket_policy, socket_policy + num_groups,
217 warmest_socket_trial_group);
218 DCHECK_NE(result, socket_policy + num_groups)
219 << "Not a valid socket reuse policy group";
220 net::SetSocketReusePolicy(result - socket_policy);
221 }
222 }
223
224 namespace net { 211 namespace net {
225 class NetLog; 212 class NetLog;
226 } // namespace net 213 } // namespace net
227 214
228 // BrowserMainParts ------------------------------------------------------------ 215 // BrowserMainParts ------------------------------------------------------------
229 216
230 BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters) 217 BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters)
231 : parameters_(parameters), 218 : parameters_(parameters),
232 parsed_command_line_(parameters.command_line_) { 219 parsed_command_line_(parameters.command_line_) {
233 } 220 }
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 if (parsed_command_line().HasSwitch(switches::kMaxSpdyConcurrentStreams)) { 467 if (parsed_command_line().HasSwitch(switches::kMaxSpdyConcurrentStreams)) {
481 int value = 0; 468 int value = 0;
482 base::StringToInt(parsed_command_line().GetSwitchValueASCII( 469 base::StringToInt(parsed_command_line().GetSwitchValueASCII(
483 switches::kMaxSpdyConcurrentStreams), 470 switches::kMaxSpdyConcurrentStreams),
484 &value); 471 &value);
485 if (value > 0) 472 if (value > 0)
486 net::SpdySession::set_max_concurrent_streams(value); 473 net::SpdySession::set_max_concurrent_streams(value);
487 } 474 }
488 } 475 }
489 476
490 // If --socket-reuse-policy is not specified, run an A/B test for choosing the
491 // warmest socket.
492 void BrowserMainParts::WarmConnectionFieldTrial() {
493 const CommandLine& command_line = parsed_command_line();
494 if (command_line.HasSwitch(switches::kSocketReusePolicy)) {
495 std::string socket_reuse_policy_str = command_line.GetSwitchValueASCII(
496 switches::kSocketReusePolicy);
497 int policy = -1;
498 base::StringToInt(socket_reuse_policy_str, &policy);
499
500 const int policy_list[] = { 0, 1, 2 };
501 VLOG(1) << "Setting socket_reuse_policy = " << policy;
502 SetSocketReusePolicy(policy, policy_list, arraysize(policy_list));
503 return;
504 }
505
506 const base::FieldTrial::Probability kWarmSocketDivisor = 100;
507 const base::FieldTrial::Probability kWarmSocketProbability = 33;
508
509 // After January 30, 2013 builds, it will always be in default group.
510 scoped_refptr<base::FieldTrial> warmest_socket_trial(
511 new base::FieldTrial(
512 "WarmSocketImpact", kWarmSocketDivisor, "last_accessed_socket",
513 2013, 1, 30));
514
515 // Default value is USE_LAST_ACCESSED_SOCKET.
516 const int last_accessed_socket = warmest_socket_trial->kDefaultGroupNumber;
517 const int warmest_socket = warmest_socket_trial->AppendGroup(
518 "warmest_socket", kWarmSocketProbability);
519 const int warm_socket = warmest_socket_trial->AppendGroup(
520 "warm_socket", kWarmSocketProbability);
521
522 const int warmest_socket_trial_group = warmest_socket_trial->group();
523
524 const int policy_list[] = { warmest_socket, warm_socket,
525 last_accessed_socket };
526 SetSocketReusePolicy(warmest_socket_trial_group, policy_list,
527 arraysize(policy_list));
528 }
529
530 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is 477 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is
531 // specified, run an A/B test for automatically establishing backup TCP 478 // specified, run an A/B test for automatically establishing backup TCP
532 // connections when a certain timeout value is exceeded. 479 // connections when a certain timeout value is exceeded.
533 void BrowserMainParts::ConnectBackupJobsFieldTrial() { 480 void BrowserMainParts::ConnectBackupJobsFieldTrial() {
534 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) { 481 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) {
535 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( 482 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(
536 true); 483 true);
537 } else if (parsed_command_line().HasSwitch( 484 } else if (parsed_command_line().HasSwitch(
538 switches::kDisableConnectBackupJobs)) { 485 switches::kDisableConnectBackupJobs)) {
539 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( 486 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Start(); 586 chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Start();
640 587
641 // Note: make sure to call ConnectionFieldTrial() before 588 // Note: make sure to call ConnectionFieldTrial() before
642 // ProxyConnectionsFieldTrial(). 589 // ProxyConnectionsFieldTrial().
643 ConnectionFieldTrial(); 590 ConnectionFieldTrial();
644 SocketTimeoutFieldTrial(); 591 SocketTimeoutFieldTrial();
645 ProxyConnectionsFieldTrial(); 592 ProxyConnectionsFieldTrial();
646 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); 593 prerender::ConfigurePrefetchAndPrerender(parsed_command_line());
647 SpdyFieldTrial(); 594 SpdyFieldTrial();
648 ConnectBackupJobsFieldTrial(); 595 ConnectBackupJobsFieldTrial();
649 WarmConnectionFieldTrial();
650 } 596 }
651 597
652 // ----------------------------------------------------------------------------- 598 // -----------------------------------------------------------------------------
653 // TODO(viettrungluu): move more/rest of BrowserMain() into above structure 599 // TODO(viettrungluu): move more/rest of BrowserMain() into above structure
654 600
655 namespace { 601 namespace {
656 602
657 // This function provides some ways to test crash and assertion handling 603 // This function provides some ways to test crash and assertion handling
658 // behavior of the program. 604 // behavior of the program.
659 void HandleTestParameters(const CommandLine& command_line) { 605 void HandleTestParameters(const CommandLine& command_line) {
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 #if defined(OS_CHROMEOS) 1998 #if defined(OS_CHROMEOS)
2053 // To be precise, logout (browser shutdown) is not yet done, but the 1999 // To be precise, logout (browser shutdown) is not yet done, but the
2054 // remaining work is negligible, hence we say LogoutDone here. 2000 // remaining work is negligible, hence we say LogoutDone here.
2055 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 2001 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
2056 false); 2002 false);
2057 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 2003 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
2058 #endif 2004 #endif
2059 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); 2005 TRACE_EVENT_END_ETW("BrowserMain", 0, 0);
2060 return result_code; 2006 return result_code;
2061 } 2007 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_main.h ('k') | chrome/browser/browser_main_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698