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

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/CSSPrimitiveValueUnitTrie.cpp.tmpl

Issue 2002383002: Avoid string allocation when parsing CSSPrimitiveValue::UnitType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 {% from 'macros.tmpl' import trie_length_switch %}
2 // Copyright 2016 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #include "core/css/CSSPrimitiveValueUnitTrie.h"
7
8 namespace blink {
9
10 namespace {
11
12 template<typename CharacterType>
13 CSSPrimitiveValue::UnitType cssPrimitiveValueUnitFromTrie(const CharacterType* d ata, unsigned length)
14 {
15 DCHECK(data);
16 DCHECK(length);
17 {% macro trie_return_statement(unit_name) %}CSSPrimitiveValue::UnitType::{{u nit_name}}{% endmacro %}
18 {{ trie_length_switch(length_tries, trie_return_statement, True) | indent(4) }}
19 return CSSPrimitiveValue::UnitType::Unknown;
20 }
21
22 } // namespace
23
24 CSSPrimitiveValue::UnitType lookupCSSPrimitiveValueUnit(const LChar* characters8 , unsigned length)
25 {
26 return cssPrimitiveValueUnitFromTrie(characters8, length);
27 }
28
29 CSSPrimitiveValue::UnitType lookupCSSPrimitiveValueUnit(const UChar* characters1 6, unsigned length)
30 {
31 return cssPrimitiveValueUnitFromTrie(characters16, length);
32 }
33
34 } // namespace blink
35
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/build/scripts/make_css_primitive_value_unit_trie.py ('k') | third_party/WebKit/Source/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698