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

Side by Side Diff: Source/core/css/parser/CSSParserValues.h

Issue 1161963002: Shrinking CSSParserToken for lower CSS parsing memory usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed unused union members. Created 5 years, 6 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
« no previous file with comments | « Source/core/css/parser/CSSParserToken.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 30 matching lines...) Expand all
41 m_is8Bit = true; 41 m_is8Bit = true;
42 } 42 }
43 43
44 void init(const UChar* characters, unsigned length) 44 void init(const UChar* characters, unsigned length)
45 { 45 {
46 m_data.characters16 = characters; 46 m_data.characters16 = characters;
47 m_length = length; 47 m_length = length;
48 m_is8Bit = false; 48 m_is8Bit = false;
49 } 49 }
50 50
51 void initRaw(const void* charactersRaw, unsigned length, bool is8Bit)
52 {
53 m_data.charactersRaw = charactersRaw;
54 m_length = length;
55 m_is8Bit = is8Bit;
56 }
57
51 void init(const String& string) 58 void init(const String& string)
52 { 59 {
53 m_length = string.length(); 60 m_length = string.length();
54 if (string.isNull()) { 61 if (string.isNull()) {
55 m_data.characters8 = 0; 62 m_data.characters8 = 0;
56 m_is8Bit = true; 63 m_is8Bit = true;
57 return; 64 return;
58 } 65 }
59 if (string.is8Bit()) { 66 if (string.is8Bit()) {
60 m_data.characters8 = const_cast<LChar*>(string.characters8()); 67 m_data.characters8 = const_cast<LChar*>(string.characters8());
(...skipping 26 matching lines...) Expand all
87 ASSERT(strlen(str) >= length()); 94 ASSERT(strlen(str) >= length());
88 return str[length()] == '\0'; 95 return str[length()] == '\0';
89 } 96 }
90 97
91 operator String() const { return is8Bit() ? String(m_data.characters8, m_len gth) : StringImpl::create8BitIfPossible(m_data.characters16, m_length); } 98 operator String() const { return is8Bit() ? String(m_data.characters8, m_len gth) : StringImpl::create8BitIfPossible(m_data.characters16, m_length); }
92 operator AtomicString() const { return is8Bit() ? AtomicString(m_data.charac ters8, m_length) : AtomicString(m_data.characters16, m_length); } 99 operator AtomicString() const { return is8Bit() ? AtomicString(m_data.charac ters8, m_length) : AtomicString(m_data.characters16, m_length); }
93 100
94 union { 101 union {
95 const LChar* characters8; 102 const LChar* characters8;
96 const UChar* characters16; 103 const UChar* characters16;
104 const void* charactersRaw;
97 } m_data; 105 } m_data;
98 unsigned m_length; 106 unsigned m_length;
99 bool m_is8Bit; 107 bool m_is8Bit;
100 }; 108 };
101 109
102 struct CSSParserFunction; 110 struct CSSParserFunction;
103 class CSSParserValueList; 111 class CSSParserValueList;
104 112
105 struct CSSParserValue { 113 struct CSSParserValue {
106 CSSValueID id; 114 CSSValueID id;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 { 274 {
267 id = CSSValueInvalid; 275 id = CSSValueInvalid;
268 this->valueList = valueList.leakPtr(); 276 this->valueList = valueList.leakPtr();
269 unit = ValueList; 277 unit = ValueList;
270 isInt = false; 278 isInt = false;
271 } 279 }
272 280
273 } 281 }
274 282
275 #endif 283 #endif
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParserToken.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698