From 3a2c6907279aca02c1ecfa971237068338ba49d8 Mon Sep 17 00:00:00 2001 From: brettw Date: Mon, 6 Jul 2015 12:43:29 -0700 Subject: New new versions of Starts/EndsWith and SplitString in net. The new calls are longer but more explicit and also more general. I didn't want change the semantics. The old SplitString maps to TRIM_WHITESPACE, SPLIT_WANT_ALL so I generally kept that even if it's not clear if the calling code wants that particular behavior. In places that obviously didn't need copies, use the StringPiece variant to avoid copies. I didn't expend too much effort in this area, especially in unit test code. It's like that more copies could be deleted with more effort. Many places just used SplitString to fill a vector that is iterated over. In these places I updated it to use a range-based for loop over the result of the function call. Add StringPiece versions of TrimWhitesace to match the existing Trim functions. Update IPLiteralToNumber to take a string piece. This is commonly used in places that have string pieces so this saves a copy. In net/dns/dns_config_service_win.cc I replaced a UTF16TOASCII call with assign(). This is what UTF16ToASCII actually does and avoids a copy because the current UTF16ToASCII doesn't support StringPiece. Updating this function call or adding an override is a big project due to the way it's use with Blink's WebString. Removed parts of StringPieceUtils that duplicate base code. Made the remaining functions in that file not locale dependent (tolower is basically always wrong for non-ASCII). BUG=506920,506255 Review URL: https://codereview.chromium.org/1215933004 Cr-Commit-Position: refs/heads/master@{#337445} --- net/filter/filter.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'net/filter') diff --git a/net/filter/filter.cc b/net/filter/filter.cc index 0e6544b..708ad81 100644 --- a/net/filter/filter.cc +++ b/net/filter/filter.cc @@ -267,7 +267,8 @@ void Filter::FixupEncodingTypes( // supported server side on paths that only send HTML content, this mode has // never surfaced in the wild (and is unlikely to). // We will gather a lot of stats as we perform the fixups - if (base::StartsWithASCII(mime_type, kTextHtml, false)) { + if (base::StartsWith(mime_type, kTextHtml, + base::CompareCase::INSENSITIVE_ASCII)) { // Suspicious case: Advertised dictionary, but server didn't use sdch, and // we're HTML tagged. if (encoding_types->empty()) { -- cgit v1.1