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

Side by Side Diff: third_party/WebKit/Source/platform/text/Character.cpp

Issue 2608823002: Move blink::serializedCharacterData array to read-only data segment (Closed)
Patch Set: Might as well mark serializedCharacterDataSize as const also Created 3 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 | third_party/WebKit/Source/platform/text/CharacterPropertyDataGenerator.cpp » ('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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 createUnicodeSet(name##Array, WTF_ARRAY_LENGTH(name##Array), name##Ranges, \ 68 createUnicodeSet(name##Array, WTF_ARRAY_LENGTH(name##Array), name##Ranges, \
69 WTF_ARRAY_LENGTH(name##Ranges)) 69 WTF_ARRAY_LENGTH(name##Ranges))
70 70
71 #define RETURN_HAS_PROPERTY(c, name) \ 71 #define RETURN_HAS_PROPERTY(c, name) \
72 static icu::UnicodeSet* unicodeSet = nullptr; \ 72 static icu::UnicodeSet* unicodeSet = nullptr; \
73 if (!unicodeSet) \ 73 if (!unicodeSet) \
74 unicodeSet = CREATE_UNICODE_SET(name); \ 74 unicodeSet = CREATE_UNICODE_SET(name); \
75 return unicodeSet->contains(c); 75 return unicodeSet->contains(c);
76 #else 76 #else
77 // Freezed trie tree, see CharacterDataGenerator.cpp. 77 // Freezed trie tree, see CharacterDataGenerator.cpp.
78 extern int32_t serializedCharacterDataSize; 78 extern const int32_t serializedCharacterDataSize;
79 extern uint8_t serializedCharacterData[]; 79 extern const uint8_t serializedCharacterData[];
80 80
81 static UTrie2* createTrie() { 81 static UTrie2* createTrie() {
82 // Create a Trie from the value array. 82 // Create a Trie from the value array.
83 ICUError error; 83 ICUError error;
84 UTrie2* trie = utrie2_openFromSerialized( 84 UTrie2* trie = utrie2_openFromSerialized(
85 UTrie2ValueBits::UTRIE2_16_VALUE_BITS, serializedCharacterData, 85 UTrie2ValueBits::UTRIE2_16_VALUE_BITS, serializedCharacterData,
86 serializedCharacterDataSize, nullptr, &error); 86 serializedCharacterDataSize, nullptr, &error);
87 ASSERT(error == U_ZERO_ERROR); 87 ASSERT(error == U_ZERO_ERROR);
88 return trie; 88 return trie;
89 } 89 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 254 }
255 255
256 bool Character::isCommonOrInheritedScript(UChar32 character) { 256 bool Character::isCommonOrInheritedScript(UChar32 character) {
257 ICUError status; 257 ICUError status;
258 UScriptCode script = uscript_getScript(character, &status); 258 UScriptCode script = uscript_getScript(character, &status);
259 return U_SUCCESS(status) && 259 return U_SUCCESS(status) &&
260 (script == USCRIPT_COMMON || script == USCRIPT_INHERITED); 260 (script == USCRIPT_COMMON || script == USCRIPT_INHERITED);
261 } 261 }
262 262
263 } // namespace blink 263 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/text/CharacterPropertyDataGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698