OLD | NEW |
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/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/leak_tracker.h" | 10 #include "base/debug/leak_tracker.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } else { | 63 } else { |
64 LOG(ERROR) << "Invalid switch for host resolver parallelism: " << s; | 64 LOG(ERROR) << "Invalid switch for host resolver parallelism: " << s; |
65 } | 65 } |
66 } else { | 66 } else { |
67 // Set up a field trial to see what impact the total number of concurrent | 67 // Set up a field trial to see what impact the total number of concurrent |
68 // resolutions have on DNS resolutions. | 68 // resolutions have on DNS resolutions. |
69 base::FieldTrial::Probability kDivisor = 1000; | 69 base::FieldTrial::Probability kDivisor = 1000; |
70 // For each option (i.e., non-default), we have a fixed probability. | 70 // For each option (i.e., non-default), we have a fixed probability. |
71 base::FieldTrial::Probability kProbabilityPerGroup = 100; // 10%. | 71 base::FieldTrial::Probability kProbabilityPerGroup = 100; // 10%. |
72 | 72 |
| 73 // After June 30, 2011 builds, it will always be in default group |
| 74 // (parallel_default). |
73 scoped_refptr<base::FieldTrial> trial( | 75 scoped_refptr<base::FieldTrial> trial( |
74 new base::FieldTrial("DnsParallelism", kDivisor)); | 76 new base::FieldTrial( |
| 77 "DnsParallelism", kDivisor, "parallel_default", 2011, 6, 30)); |
75 | 78 |
76 // List options with different counts. | 79 // List options with different counts. |
77 // Firefox limits total to 8 in parallel, and default is currently 50. | 80 // Firefox limits total to 8 in parallel, and default is currently 50. |
78 int parallel_6 = trial->AppendGroup("parallel_6", kProbabilityPerGroup); | 81 int parallel_6 = trial->AppendGroup("parallel_6", kProbabilityPerGroup); |
79 int parallel_7 = trial->AppendGroup("parallel_7", kProbabilityPerGroup); | 82 int parallel_7 = trial->AppendGroup("parallel_7", kProbabilityPerGroup); |
80 int parallel_8 = trial->AppendGroup("parallel_8", kProbabilityPerGroup); | 83 int parallel_8 = trial->AppendGroup("parallel_8", kProbabilityPerGroup); |
81 int parallel_9 = trial->AppendGroup("parallel_9", kProbabilityPerGroup); | 84 int parallel_9 = trial->AppendGroup("parallel_9", kProbabilityPerGroup); |
82 int parallel_10 = trial->AppendGroup("parallel_10", kProbabilityPerGroup); | 85 int parallel_10 = trial->AppendGroup("parallel_10", kProbabilityPerGroup); |
83 int parallel_14 = trial->AppendGroup("parallel_14", kProbabilityPerGroup); | 86 int parallel_14 = trial->AppendGroup("parallel_14", kProbabilityPerGroup); |
84 int parallel_20 = trial->AppendGroup("parallel_20", kProbabilityPerGroup); | 87 int parallel_20 = trial->AppendGroup("parallel_20", kProbabilityPerGroup); |
85 | 88 |
86 trial->AppendGroup("parallel_default", | |
87 base::FieldTrial::kAllRemainingProbability); | |
88 | |
89 if (trial->group() == parallel_6) | 89 if (trial->group() == parallel_6) |
90 parallelism = 6; | 90 parallelism = 6; |
91 else if (trial->group() == parallel_7) | 91 else if (trial->group() == parallel_7) |
92 parallelism = 7; | 92 parallelism = 7; |
93 else if (trial->group() == parallel_8) | 93 else if (trial->group() == parallel_8) |
94 parallelism = 8; | 94 parallelism = 8; |
95 else if (trial->group() == parallel_9) | 95 else if (trial->group() == parallel_9) |
96 parallelism = 9; | 96 parallelism = 9; |
97 else if (trial->group() == parallel_10) | 97 else if (trial->group() == parallel_10) |
98 parallelism = 10; | 98 parallelism = 10; |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 net::HostCache* host_cache = | 506 net::HostCache* host_cache = |
507 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 507 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
508 if (host_cache) | 508 if (host_cache) |
509 host_cache->clear(); | 509 host_cache->clear(); |
510 } | 510 } |
511 // Clear all of the passively logged data. | 511 // Clear all of the passively logged data. |
512 // TODO(eroman): this is a bit heavy handed, really all we need to do is | 512 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
513 // clear the data pertaining to off the record context. | 513 // clear the data pertaining to off the record context. |
514 net_log_->ClearAllPassivelyCapturedEvents(); | 514 net_log_->ClearAllPassivelyCapturedEvents(); |
515 } | 515 } |
OLD | NEW |