diff options
author | brettw <brettw@chromium.org> | 2015-07-06 12:43:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-06 19:44:09 +0000 |
commit | 3a2c6907279aca02c1ecfa971237068338ba49d8 (patch) | |
tree | 635a77bc441a04a0c711d934d265f8cc09b64e86 /net/filter | |
parent | f3793eb89ee07a241d94bb26907041d1ede33fab (diff) | |
download | chromium_src-3a2c6907279aca02c1ecfa971237068338ba49d8.zip chromium_src-3a2c6907279aca02c1ecfa971237068338ba49d8.tar.gz chromium_src-3a2c6907279aca02c1ecfa971237068338ba49d8.tar.bz2 |
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}
Diffstat (limited to 'net/filter')
-rw-r--r-- | net/filter/filter.cc | 3 |
1 files changed, 2 insertions, 1 deletions
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()) { |