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

Unified Diff: base/strings/string_util.h

Issue 543043002: Implement fast path in UTF8ToUTF16 for pure ASCII strings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | base/strings/string_util.cc » ('j') | base/strings/string_util.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/string_util.h
diff --git a/base/strings/string_util.h b/base/strings/string_util.h
index e20bbf0a40c59f9440a23812ca7e8723dd2c9dec..21e0d72acb8e7fe6ee88687b4251025e7d0e67f0 100644
--- a/base/strings/string_util.h
+++ b/base/strings/string_util.h
@@ -245,9 +245,14 @@ BASE_EXPORT bool ContainsOnlyChars(const StringPiece16& input,
// to have the maximum 'discriminating' power from other encodings. If
// there's a use case for just checking the structural validity, we have to
// add a new function for that.
+//
+// IsStringASCII assumes the input is likely all ASCII, and does not leave early
+// if it is not the case.
BASE_EXPORT bool IsStringUTF8(const std::string& str);
BASE_EXPORT bool IsStringASCII(const StringPiece& str);
BASE_EXPORT bool IsStringASCII(const string16& str);
+BASE_EXPORT bool IsStringASCII(const char* src, size_t src_len);
brettw 2014/09/16 17:14:28 The string piece version should cover this case. A
mnaganov (inactive) 2014/09/17 15:15:01 You are right, I didn't think about this, thanks!
+BASE_EXPORT bool IsStringASCII(const char16* src, size_t src_len);
// Converts the elements of the given string. This version uses a pointer to
// clearly differentiate it from the non-pointer variant.
« no previous file with comments | « no previous file | base/strings/string_util.cc » ('j') | base/strings/string_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698