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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp

Issue 2614123002: Use StringView for String and AtomicString operator==. (Closed)
Patch Set: Created 3 years, 11 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 | third_party/WebKit/Source/wtf/text/AtomicString.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
index db5b534047d62eba6e04f91b3045d27314f5dc6c..2511fed997fea08cadb67a20585b8969ea65230d 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
@@ -869,7 +869,8 @@ bool isValidEnum(const String& value,
const String& enumName,
ExceptionState& exceptionState) {
for (size_t i = 0; i < length; ++i) {
- if (value == validValues[i])
+ // Avoid the strlen inside String::operator== (because of the StringView).
+ if (WTF::equal(value.impl(), validValues[i]))
return true;
}
exceptionState.throwTypeError("The provided value '" + value +
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/text/AtomicString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698