Commit 12b9159e authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Simplify DocumentStyleEnvironmentVariables::GenerateHashFromName

Use the StringHasher::ComputeHash() helper.

Change-Id: Ic43c19467a9d15f1b82c4ac586ebe7b80f937c60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1762220Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#688709}
parent a5c811fb
...@@ -15,17 +15,9 @@ namespace blink { ...@@ -15,17 +15,9 @@ namespace blink {
// static // static
unsigned DocumentStyleEnvironmentVariables::GenerateHashFromName( unsigned DocumentStyleEnvironmentVariables::GenerateHashFromName(
const AtomicString& name) { const AtomicString& name) {
StringHasher hasher; if (name.Is8Bit())
return StringHasher::ComputeHash(name.Characters8(), name.length());
if (name.Is8Bit()) { return StringHasher::ComputeHash(name.Characters16(), name.length());
String name_str = String(name);
name_str.Ensure16Bit();
hasher.AddCharacters(name_str.Characters16(), name_str.length());
} else {
hasher.AddCharacters(name.Characters16(), name.length());
}
return hasher.GetHash();
} }
// static // static
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment