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

Side by Side Diff: net/proxy/proxy_resolver_v8.cc

Issue 102843002: Move RemoveChars, ReplaceChars, TrimString, and TruncateUTF8ToByteSize to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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) 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/proxy/proxy_resolver_v8.h" 5 #include "net/proxy/proxy_resolver_v8.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdio> 8 #include <cstdio>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // IP addresses or an empty string if unable to sort the IP address list. 269 // IP addresses or an empty string if unable to sort the IP address list.
270 // Returns 'true' if the sorting was successful, and 'false' if the input was an 270 // Returns 'true' if the sorting was successful, and 'false' if the input was an
271 // empty string, a string of separators (";" in this case), or if any of the IP 271 // empty string, a string of separators (";" in this case), or if any of the IP
272 // addresses in the input list failed to parse. 272 // addresses in the input list failed to parse.
273 bool SortIpAddressList(const std::string& ip_address_list, 273 bool SortIpAddressList(const std::string& ip_address_list,
274 std::string* sorted_ip_address_list) { 274 std::string* sorted_ip_address_list) {
275 sorted_ip_address_list->clear(); 275 sorted_ip_address_list->clear();
276 276
277 // Strip all whitespace (mimics IE behavior). 277 // Strip all whitespace (mimics IE behavior).
278 std::string cleaned_ip_address_list; 278 std::string cleaned_ip_address_list;
279 RemoveChars(ip_address_list, " \t", &cleaned_ip_address_list); 279 base::RemoveChars(ip_address_list, " \t", &cleaned_ip_address_list);
280 if (cleaned_ip_address_list.empty()) 280 if (cleaned_ip_address_list.empty())
281 return false; 281 return false;
282 282
283 // Split-up IP addresses and store them in a vector. 283 // Split-up IP addresses and store them in a vector.
284 std::vector<IPAddress> ip_vector; 284 std::vector<IPAddress> ip_vector;
285 IPAddressNumber ip_num; 285 IPAddressNumber ip_num;
286 base::StringTokenizer str_tok(cleaned_ip_address_list, ";"); 286 base::StringTokenizer str_tok(cleaned_ip_address_list, ";");
287 while (str_tok.GetNext()) { 287 while (str_tok.GetNext()) {
288 if (!ParseIPLiteralToNumber(str_tok.token(), &ip_num)) 288 if (!ParseIPLiteralToNumber(str_tok.token(), &ip_num))
289 return false; 289 return false;
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 return 0; 822 return 0;
823 823
824 v8::Locker locked(g_default_isolate_); 824 v8::Locker locked(g_default_isolate_);
825 v8::Isolate::Scope isolate_scope(g_default_isolate_); 825 v8::Isolate::Scope isolate_scope(g_default_isolate_);
826 v8::HeapStatistics heap_statistics; 826 v8::HeapStatistics heap_statistics;
827 g_default_isolate_->GetHeapStatistics(&heap_statistics); 827 g_default_isolate_->GetHeapStatistics(&heap_statistics);
828 return heap_statistics.used_heap_size(); 828 return heap_statistics.used_heap_size();
829 } 829 }
830 830
831 } // namespace net 831 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698