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

Side by Side Diff: third_party/WebKit/Source/platform/text/CharacterPropertyDataGenerator.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 | « third_party/WebKit/Source/platform/text/Character.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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // TODO(kojii): This file is compiled with $host_toolchain, which cannot find 5 // TODO(kojii): This file is compiled with $host_toolchain, which cannot find
6 // include files in platform/fonts. The build scripts should include this 6 // include files in platform/fonts. The build scripts should include this
7 // directory, and fix these #include's to "platform/fonts/...". 7 // directory, and fix these #include's to "platform/fonts/...".
8 #include "CharacterPropertyDataGenerator.h" 8 #include "CharacterPropertyDataGenerator.h"
9 9
10 #include "CharacterProperty.h" 10 #include "CharacterProperty.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 for (; begin != end; begin++) { 47 for (; begin != end; begin++) {
48 assert(*begin <= kMaxCodepoint); 48 assert(*begin <= kMaxCodepoint);
49 values[*begin] |= value; 49 values[*begin] |= value;
50 } 50 }
51 } 51 }
52 52
53 static void generateUTrieSerialized(FILE* fp, int32_t size, uint8_t* array) { 53 static void generateUTrieSerialized(FILE* fp, int32_t size, uint8_t* array) {
54 fprintf(fp, 54 fprintf(fp,
55 "#include <cstdint>\n\n" 55 "#include <cstdint>\n\n"
56 "namespace blink {\n\n" 56 "namespace blink {\n\n"
57 "int32_t serializedCharacterDataSize = %d;\n" 57 "extern const int32_t serializedCharacterDataSize = %d;\n"
58 "uint8_t serializedCharacterData[] = {", 58 "extern const uint8_t serializedCharacterData[] = {",
59 size); 59 size);
60 for (int32_t i = 0; i < size;) { 60 for (int32_t i = 0; i < size;) {
61 fprintf(fp, "\n "); 61 fprintf(fp, "\n ");
62 for (int col = 0; col < 16 && i < size; col++, i++) 62 for (int col = 0; col < 16 && i < size; col++, i++)
63 fprintf(fp, " 0x%02X,", array[i]); 63 fprintf(fp, " 0x%02X,", array[i]);
64 } 64 }
65 fprintf(fp, 65 fprintf(fp,
66 "\n};\n\n" 66 "\n};\n\n"
67 "} // namespace blink\n"); 67 "} // namespace blink\n");
68 } 68 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (argc <= 1) { 124 if (argc <= 1) {
125 generate(stdout); 125 generate(stdout);
126 } else { 126 } else {
127 FILE* fp = fopen(argv[1], "wb"); 127 FILE* fp = fopen(argv[1], "wb");
128 generate(fp); 128 generate(fp);
129 fclose(fp); 129 fclose(fp);
130 } 130 }
131 131
132 return 0; 132 return 0;
133 } 133 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/Character.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698