| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/dns/host_resolver.h" | 5 #include "net/dns/host_resolver.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // Parallelism is determined by the field trial. | 40 // Parallelism is determined by the field trial. |
| 41 std::string group = base::FieldTrialList::FindFullName( | 41 std::string group = base::FieldTrialList::FindFullName( |
| 42 "HostResolverDispatch"); | 42 "HostResolverDispatch"); |
| 43 | 43 |
| 44 if (group.empty()) | 44 if (group.empty()) |
| 45 return limits; | 45 return limits; |
| 46 | 46 |
| 47 // The format of the group name is a list of non-negative integers separated | 47 // The format of the group name is a list of non-negative integers separated |
| 48 // by ':'. Each of the elements in the list corresponds to an element in | 48 // by ':'. Each of the elements in the list corresponds to an element in |
| 49 // |reserved_slots|, except the last one which is the |total_jobs|. | 49 // |reserved_slots|, except the last one which is the |total_jobs|. |
| 50 | 50 std::vector<base::StringPiece> group_parts = base::SplitStringPiece( |
| 51 std::vector<std::string> group_parts; | 51 group, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 52 base::SplitString(group, ':', &group_parts); | |
| 53 if (group_parts.size() != NUM_PRIORITIES + 1) { | 52 if (group_parts.size() != NUM_PRIORITIES + 1) { |
| 54 NOTREACHED(); | 53 NOTREACHED(); |
| 55 return limits; | 54 return limits; |
| 56 } | 55 } |
| 57 | 56 |
| 58 std::vector<size_t> parsed(group_parts.size()); | 57 std::vector<size_t> parsed(group_parts.size()); |
| 59 size_t total_reserved_slots = 0; | 58 size_t total_reserved_slots = 0; |
| 60 | 59 |
| 61 for (size_t i = 0; i < group_parts.size(); ++i) { | 60 for (size_t i = 0; i < group_parts.size(); ++i) { |
| 62 if (!base::StringToSizeT(group_parts[i], &parsed[i])) { | 61 if (!base::StringToSizeT(group_parts[i], &parsed[i])) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 119 |
| 121 // static | 120 // static |
| 122 scoped_ptr<HostResolver> HostResolver::CreateDefaultResolver(NetLog* net_log) { | 121 scoped_ptr<HostResolver> HostResolver::CreateDefaultResolver(NetLog* net_log) { |
| 123 return scoped_ptr<HostResolver>(new HostResolverImpl(Options(), net_log)); | 122 return scoped_ptr<HostResolver>(new HostResolverImpl(Options(), net_log)); |
| 124 } | 123 } |
| 125 | 124 |
| 126 HostResolver::HostResolver() { | 125 HostResolver::HostResolver() { |
| 127 } | 126 } |
| 128 | 127 |
| 129 } // namespace net | 128 } // namespace net |
| OLD | NEW |