Commit b4d9f58b authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

Move token vector on CSSVariableData construction

There seems to be no reason to copy it.

Change-Id: I89779533927d3b3d2a3ca912226eba723d9bc5c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2306149
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790353}
parent 0f155537
...@@ -38,7 +38,7 @@ class CORE_EXPORT CSSVariableData : public RefCounted<CSSVariableData> { ...@@ -38,7 +38,7 @@ class CORE_EXPORT CSSVariableData : public RefCounted<CSSVariableData> {
} }
static scoped_refptr<CSSVariableData> CreateResolved( static scoped_refptr<CSSVariableData> CreateResolved(
const Vector<CSSParserToken>& resolved_tokens, Vector<CSSParserToken> resolved_tokens,
Vector<String> backing_strings, Vector<String> backing_strings,
bool is_animation_tainted, bool is_animation_tainted,
bool has_font_units, bool has_font_units,
...@@ -46,8 +46,9 @@ class CORE_EXPORT CSSVariableData : public RefCounted<CSSVariableData> { ...@@ -46,8 +46,9 @@ class CORE_EXPORT CSSVariableData : public RefCounted<CSSVariableData> {
const String& base_url, const String& base_url,
const WTF::TextEncoding& charset) { const WTF::TextEncoding& charset) {
return base::AdoptRef(new CSSVariableData( return base::AdoptRef(new CSSVariableData(
resolved_tokens, std::move(backing_strings), is_animation_tainted, std::move(resolved_tokens), std::move(backing_strings),
has_font_units, has_root_font_units, base_url, charset)); is_animation_tainted, has_font_units, has_root_font_units, base_url,
charset));
} }
CSSParserTokenRange TokenRange() const { return tokens_; } CSSParserTokenRange TokenRange() const { return tokens_; }
...@@ -89,7 +90,7 @@ class CORE_EXPORT CSSVariableData : public RefCounted<CSSVariableData> { ...@@ -89,7 +90,7 @@ class CORE_EXPORT CSSVariableData : public RefCounted<CSSVariableData> {
const KURL& base_url, const KURL& base_url,
const WTF::TextEncoding& charset); const WTF::TextEncoding& charset);
CSSVariableData(const Vector<CSSParserToken>& resolved_tokens, CSSVariableData(Vector<CSSParserToken> resolved_tokens,
Vector<String> backing_strings, Vector<String> backing_strings,
bool is_animation_tainted, bool is_animation_tainted,
bool has_font_units, bool has_font_units,
...@@ -97,7 +98,7 @@ class CORE_EXPORT CSSVariableData : public RefCounted<CSSVariableData> { ...@@ -97,7 +98,7 @@ class CORE_EXPORT CSSVariableData : public RefCounted<CSSVariableData> {
const String& base_url, const String& base_url,
const WTF::TextEncoding& charset) const WTF::TextEncoding& charset)
: backing_strings_(std::move(backing_strings)), : backing_strings_(std::move(backing_strings)),
tokens_(resolved_tokens), tokens_(std::move(resolved_tokens)),
is_animation_tainted_(is_animation_tainted), is_animation_tainted_(is_animation_tainted),
needs_variable_resolution_(false), needs_variable_resolution_(false),
has_font_units_(has_font_units), has_font_units_(has_font_units),
......
...@@ -1976,8 +1976,8 @@ StyleBuilderConverter::ConvertRegisteredPropertyVariableData( ...@@ -1976,8 +1976,8 @@ StyleBuilderConverter::ConvertRegisteredPropertyVariableData(
const bool has_root_font_units = false; const bool has_root_font_units = false;
return CSSVariableData::CreateResolved( return CSSVariableData::CreateResolved(
tokens, std::move(backing_strings), is_animation_tainted, has_font_units, std::move(tokens), std::move(backing_strings), is_animation_tainted,
has_root_font_units, g_null_atom, WTF::TextEncoding()); has_font_units, has_root_font_units, g_null_atom, WTF::TextEncoding());
} }
LengthSize StyleBuilderConverter::ConvertIntrinsicSize( LengthSize StyleBuilderConverter::ConvertIntrinsicSize(
......
...@@ -530,9 +530,8 @@ void StyleCascade::TokenSequence::Append(const CSSParserToken& token) { ...@@ -530,9 +530,8 @@ void StyleCascade::TokenSequence::Append(const CSSParserToken& token) {
scoped_refptr<CSSVariableData> scoped_refptr<CSSVariableData>
StyleCascade::TokenSequence::BuildVariableData() { StyleCascade::TokenSequence::BuildVariableData() {
// TODO(andruud): Why not also std::move tokens?
return CSSVariableData::CreateResolved( return CSSVariableData::CreateResolved(
tokens_, std::move(backing_strings_), is_animation_tainted_, std::move(tokens_), std::move(backing_strings_), is_animation_tainted_,
has_font_units_, has_root_font_units_, base_url_, charset_); has_font_units_, has_root_font_units_, base_url_, charset_);
} }
......
...@@ -149,11 +149,12 @@ void StyleEnvironmentVariables::SetVariable(const AtomicString& name, ...@@ -149,11 +149,12 @@ void StyleEnvironmentVariables::SetVariable(const AtomicString& name,
Vector<String> backing_strings; Vector<String> backing_strings;
backing_strings.push_back(value); backing_strings.push_back(value);
SetVariable(name, SetVariable(
CSSVariableData::CreateResolved( name,
tokens, backing_strings, false /* is_animation_tainted */, CSSVariableData::CreateResolved(
false /* has_font_units */, false /* has_root_font_units*/, std::move(tokens), std::move(backing_strings),
g_null_atom, WTF::TextEncoding())); false /* is_animation_tainted */, false /* has_font_units */,
false /* has_root_font_units*/, g_null_atom, WTF::TextEncoding()));
} }
void StyleEnvironmentVariables::SetVariable(const UADefinedVariable name, void StyleEnvironmentVariables::SetVariable(const UADefinedVariable name,
......
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