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

Unified Diff: third_party/WebKit/Source/wtf/text/WTFString.h

Issue 2225173002: Use StringView for String::find. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing null check. Created 4 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringImpl.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/text/WTFString.h
diff --git a/third_party/WebKit/Source/wtf/text/WTFString.h b/third_party/WebKit/Source/wtf/text/WTFString.h
index 9236f86866d90fdb5e5d899bed877bc195f63e6b..7fd2772c4a35f2938971d569a9aee46de092842d 100644
--- a/third_party/WebKit/Source/wtf/text/WTFString.h
+++ b/third_party/WebKit/Source/wtf/text/WTFString.h
@@ -169,23 +169,18 @@ public:
static String numberToStringECMAScript(double);
static String numberToStringFixedWidth(double, unsigned decimalPlaces);
- // Find a single character or string, also with match function & latin1
- // forms.
+ // Find characters.
size_t find(UChar c, unsigned start = 0) const
{ return m_impl ? m_impl->find(c, start) : kNotFound; }
size_t find(LChar c, unsigned start = 0) const
{ return m_impl ? m_impl->find(c, start) : kNotFound; }
size_t find(char c, unsigned start = 0) const { return find(static_cast<LChar>(c), start); }
-
- size_t find(const String& str) const
- { return m_impl ? m_impl->find(str.impl()) : kNotFound; }
- size_t find(const String& str, unsigned start) const
- { return m_impl ? m_impl->find(str.impl(), start) : kNotFound; }
-
size_t find(CharacterMatchFunctionPtr matchFunction, unsigned start = 0) const
{ return m_impl ? m_impl->find(matchFunction, start) : kNotFound; }
- size_t find(const LChar* str, unsigned start = 0) const
- { return m_impl ? m_impl->find(str, start) : kNotFound; }
+
+ // Find substrings.
+ size_t find(const StringView& value, unsigned start = 0, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const
+ { return m_impl ? DISPATCH_CASE_OP(caseSensitivity, m_impl->find, (value, start)) : kNotFound; }
// Find the last instance of a single character or string.
size_t reverseFind(UChar c, unsigned start = UINT_MAX) const
@@ -203,12 +198,6 @@ public:
size_t findIgnoringASCIICase(const String& str, unsigned start = 0) const
{ return m_impl ? m_impl->findIgnoringASCIICase(str.impl(), start) : kNotFound; }
- // Wrappers for find adding dynamic sensitivity check.
- size_t find(const LChar* str, unsigned start, TextCaseSensitivity caseSensitivity) const
- { return DISPATCH_CASE_OP(caseSensitivity, find, (str, start)); }
- size_t find(const String& str, unsigned start, TextCaseSensitivity caseSensitivity) const
- { return DISPATCH_CASE_OP(caseSensitivity, find, (str, start)); }
-
unsigned copyTo(UChar* buffer, unsigned pos, unsigned maxLength) const;
template<typename BufferType>
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698