diff options
author | brettw <brettw@chromium.org> | 2015-07-23 14:56:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-23 21:57:37 +0000 |
commit | 85111674b30562ab0ba3a0f7d3b09761fdc09e00 (patch) | |
tree | a8ac1e3a51e6322156244b9b86516ccaccb2507d /components/history | |
parent | 666686c757e8c17d47ec2036e718eb85ca26fb1c (diff) | |
download | chromium_src-85111674b30562ab0ba3a0f7d3b09761fdc09e00.zip chromium_src-85111674b30562ab0ba3a0f7d3b09761fdc09e00.tar.gz chromium_src-85111674b30562ab0ba3a0f7d3b09761fdc09e00.tar.bz2 |
Unify LowerCaseEqualsASCII and EqualsASCII functions.
This removes the many overrides and unifies on StringPIece implementations.
StringPiece did not exist when these functions were written. The lack of
StringPiece versions make it difficult to use when (typically newer) code has a
StringPiece (for example, see affiliation_utils.cc), and StringPiece versions
can't be added because it will be ambiguous with the std::string versions.
There are a few dozen places where a WebString is passed into these functions.
A WebString can not be implicitly converted into a StringPiece, so I added
explicit base::StringPiece16 wrappers around the necessary parameters. This is
actually nice because it emphasizes that a temporary is created. In a few
places it does this redundantly and I pulled a string16 out (for example,
drop_data_builder.cc).
Callers that were using the iterator versions got converted to constructing
a StringPiece with iterators. This was the case mostly for net where this
pattern seems common.
A few cases, such as data_reduction_proxy_config.cc were actually trying to
do prefix matches. I converted these to StartsWith (cur current, more-
convenient version of StartsWith is relatively new). Theoretically these
aren't equivalent because StartsWith doesn't assume a previously-lower-cased
2nd argument. But the strings are short and the convenience makes up for the
difference.
I converted the define HTTP_LWS to a constant kHttpLinearWhitespace to avoid
polluting the global namespace. This traces back to the original commit with
a vague comment about overriding at buildtime (which can't happen). I kept
the define in the .cc file because header pollution is less and C constant
concatenation is used with this in a few places that would require a
constant with confusing description or a temporary to be created.
http_response_headers.cc: changed some functions to StringPIeces that used
iterators for convenience and clarity.
Added a TrimLWSPiece to NetUtil for convenience in the header parsing code.
Significantly updated HttpUtil::ParseContentType to use StringPieces.
Review URL: https://codereview.chromium.org/1242673002
Cr-Commit-Position: refs/heads/master@{#340176}
Diffstat (limited to 'components/history')
-rw-r--r-- | components/history/core/browser/visitsegment_database.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/components/history/core/browser/visitsegment_database.cc b/components/history/core/browser/visitsegment_database.cc index 891c1b5..afeecb7 100644 --- a/components/history/core/browser/visitsegment_database.cc +++ b/components/history/core/browser/visitsegment_database.cc @@ -105,10 +105,9 @@ std::string VisitSegmentDatabase::ComputeSegmentName(const GURL& url) { const int kWWWDotLen = arraysize(kWWWDot) - 1; std::string host = url.host(); - const char* host_c = host.c_str(); // Remove www. to avoid some dups. if (static_cast<int>(host.size()) > kWWWDotLen && - base::LowerCaseEqualsASCII(host_c, host_c + kWWWDotLen, kWWWDot)) { + base::StartsWith(host, kWWWDot, base::CompareCase::INSENSITIVE_ASCII)) { r.SetHost(host.c_str(), url::Component(kWWWDotLen, static_cast<int>(host.size()) - kWWWDotLen)); |