| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 // Sets things up so that if we crash from this point on, a dialog will | 628 // Sets things up so that if we crash from this point on, a dialog will |
| 629 // popup asking the user to restart chrome. It is done this late to avoid | 629 // popup asking the user to restart chrome. It is done this late to avoid |
| 630 // testing against a bunch of special cases that are taken care early on. | 630 // testing against a bunch of special cases that are taken care early on. |
| 631 PrepareRestartOnCrashEnviroment(parsed_command_line); | 631 PrepareRestartOnCrashEnviroment(parsed_command_line); |
| 632 | 632 |
| 633 #if defined(OS_WIN) | 633 #if defined(OS_WIN) |
| 634 // Initialize Winsock. | 634 // Initialize Winsock. |
| 635 net::EnsureWinsockInit(); | 635 net::EnsureWinsockInit(); |
| 636 #endif // defined(OS_WIN) | 636 #endif // defined(OS_WIN) |
| 637 | 637 |
| 638 // Set up a field trial to see what disabling DNS pre-resolution does to | 638 // Initialize and maintain DNS prefetcher module. |
| 639 // latency of network transactions. | 639 chrome_browser_net::DnsPrefetcherInit dns_prefetch(user_prefs, local_state); |
| 640 FieldTrial::Probability kDIVISOR = 100; | |
| 641 FieldTrial::Probability k_PROBABILITY_PER_GROUP = 10; // 10% probability. | |
| 642 // For options we don't (currently) wish to test, we use zero probability. | |
| 643 FieldTrial::Probability k_PROBABILITY_DISABLED = 0; | |
| 644 scoped_refptr<FieldTrial> dns_trial = new FieldTrial("DnsImpact", kDIVISOR); | |
| 645 | |
| 646 // First option is to disable prefetching completele. | |
| 647 dns_trial->AppendGroup("_disabled_prefetch", k_PROBABILITY_PER_GROUP); | |
| 648 // Second option is to set parallel prefetch limit to 4 instead of default 8. | |
| 649 int parallel_4_prefetch = dns_trial->AppendGroup("_parallel_4_prefetch", | |
| 650 k_PROBABILITY_PER_GROUP); | |
| 651 | |
| 652 // Don't discard names (erase these lines) yet, as we may use them, and we | |
| 653 // have histogram data named for these options. | |
| 654 | |
| 655 // Next two options relate to the number of parallel http connections that can | |
| 656 // be made to a single host. The default is currently 6, and we wanted to see | |
| 657 // what would happen when we restricted this to 4. (Historically the limit | |
| 658 // was a mere 2, but several browsers including Chromium increased it to 6 | |
| 659 // recently). | |
| 660 int disabled_plus_4_connections = dns_trial->AppendGroup( | |
| 661 "_disabled_prefetch_4_connections", k_PROBABILITY_DISABLED); | |
| 662 int enabled_plus_4_connections = dns_trial->AppendGroup( | |
| 663 "_enabled_prefetch_4_connections", k_PROBABILITY_DISABLED); | |
| 664 | |
| 665 scoped_ptr<chrome_browser_net::DnsPrefetcherInit> dns_prefetch_init; | |
| 666 if (dns_trial->group() == FieldTrial::kNotParticipating || | |
| 667 dns_trial->group() == enabled_plus_4_connections || | |
| 668 dns_trial->group() == parallel_4_prefetch) { | |
| 669 // Initialize the DNS prefetch system | |
| 670 if (dns_trial->group() == parallel_4_prefetch) | |
| 671 dns_prefetch_init.reset(new chrome_browser_net::DnsPrefetcherInit( | |
| 672 4, user_prefs)); | |
| 673 else | |
| 674 dns_prefetch_init.reset(new chrome_browser_net::DnsPrefetcherInit( | |
| 675 chrome_browser_net::DnsPrefetcherInit::kMaxConcurrentLookups, | |
| 676 user_prefs)); | |
| 677 chrome_browser_net::DnsPrefetchHostNamesAtStartup(user_prefs, local_state); | |
| 678 chrome_browser_net::RestoreSubresourceReferrers(local_state); | |
| 679 } | |
| 680 | |
| 681 if (dns_trial->group() == disabled_plus_4_connections || | |
| 682 dns_trial->group() == enabled_plus_4_connections) { | |
| 683 net::HttpNetworkSession::set_max_sockets_per_group(4); | |
| 684 } | |
| 685 | 640 |
| 686 scoped_refptr<FieldTrial> http_prioritization_trial = | 641 scoped_refptr<FieldTrial> http_prioritization_trial = |
| 687 new FieldTrial("HttpPrioritization", 100); | 642 new FieldTrial("HttpPrioritization", 100); |
| 688 // Put 10% of people in the fallback experiment with the http prioritization | 643 // Put 10% of people in the fallback experiment with the http prioritization |
| 689 // code disabled. | 644 // code disabled. |
| 690 const int holdback_group = | 645 const int holdback_group = |
| 691 http_prioritization_trial->AppendGroup("_no_http_prioritization", 10); | 646 http_prioritization_trial->AppendGroup("_no_http_prioritization", 10); |
| 692 if (http_prioritization_trial->group() == holdback_group) { | 647 if (http_prioritization_trial->group() == holdback_group) { |
| 693 ResourceDispatcherHost::DisableHttpPrioritization(); | 648 ResourceDispatcherHost::DisableHttpPrioritization(); |
| 694 } | 649 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 if (metrics) | 773 if (metrics) |
| 819 metrics->Stop(); | 774 metrics->Stop(); |
| 820 | 775 |
| 821 // browser_shutdown takes care of deleting browser_process, so we need to | 776 // browser_shutdown takes care of deleting browser_process, so we need to |
| 822 // release it. | 777 // release it. |
| 823 browser_process.release(); | 778 browser_process.release(); |
| 824 browser_shutdown::Shutdown(); | 779 browser_shutdown::Shutdown(); |
| 825 | 780 |
| 826 return result_code; | 781 return result_code; |
| 827 } | 782 } |
| OLD | NEW |