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

Side by Side Diff: Source/core/html/parser/HTMLEntityParser.cpp

Issue 120393003: HTMLEntityTable could use char to reduce binary size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: For review Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/html/parser/HTMLEntityTable.h » ('j') | 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/
4 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 4 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 unconsumeCharacters(source, consumedCharacters); 124 unconsumeCharacters(source, consumedCharacters);
125 return false; 125 return false;
126 } 126 }
127 if (entitySearch.mostRecentMatch()->length != entitySearch.currentLength()) { 127 if (entitySearch.mostRecentMatch()->length != entitySearch.currentLength()) {
128 // We've consumed too many characters. We need to walk the 128 // We've consumed too many characters. We need to walk the
129 // source back to the point at which we had consumed an 129 // source back to the point at which we had consumed an
130 // actual entity. 130 // actual entity.
131 unconsumeCharacters(source, consumedCharacters); 131 unconsumeCharacters(source, consumedCharacters);
132 consumedCharacters.clear(); 132 consumedCharacters.clear();
133 const int length = entitySearch.mostRecentMatch()->length; 133 const int length = entitySearch.mostRecentMatch()->length;
134 const UChar* reference = entitySearch.mostRecentMatch()->entity; 134 const LChar* reference = entitySearch.mostRecentMatch()->entity;
135 for (int i = 0; i < length; ++i) { 135 for (int i = 0; i < length; ++i) {
136 cc = source.currentChar(); 136 cc = source.currentChar();
137 ASSERT_UNUSED(reference, cc == *reference++); 137 ASSERT_UNUSED(reference, cc == *reference++);
138 consumedCharacters.append(cc); 138 consumedCharacters.append(cc);
139 source.advanceAndASSERT(cc); 139 source.advanceAndASSERT(cc);
140 ASSERT(!source.isEmpty()); 140 ASSERT(!source.isEmpty());
141 } 141 }
142 cc = source.currentChar(); 142 cc = source.currentChar();
143 } 143 }
144 if (entitySearch.mostRecentMatch()->lastCharacter() == ';' 144 if (entitySearch.mostRecentMatch()->lastCharacter() == ';'
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 if (!search.isEntityPrefix()) 295 if (!search.isEntityPrefix())
296 return 0; 296 return 0;
297 297
298 size_t numberOfCodePoints = appendUChar32ToUCharArray(search.mostRecentMatch ()->firstValue, result); 298 size_t numberOfCodePoints = appendUChar32ToUCharArray(search.mostRecentMatch ()->firstValue, result);
299 if (!search.mostRecentMatch()->secondValue) 299 if (!search.mostRecentMatch()->secondValue)
300 return numberOfCodePoints; 300 return numberOfCodePoints;
301 return numberOfCodePoints + appendUChar32ToUCharArray(search.mostRecentMatch ()->secondValue, result + numberOfCodePoints); 301 return numberOfCodePoints + appendUChar32ToUCharArray(search.mostRecentMatch ()->secondValue, result + numberOfCodePoints);
302 } 302 }
303 303
304 } // namespace WebCore 304 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/parser/HTMLEntityTable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698