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

Unified Diff: ui/base/resource/data_pack_literal.cc

Issue 2969123002: Add deduplication logic to .pak files (Closed)
Patch Set: sizeof() Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/resource/data_pack_literal.h ('k') | ui/base/resource/data_pack_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/resource/data_pack_literal.cc
diff --git a/ui/base/resource/data_pack_literal.cc b/ui/base/resource/data_pack_literal.cc
index cf490868ccac8973d51986d064b911b032d1fe4e..3218f848e940b20e95e0585f50c898db2de7b3d3 100644
--- a/ui/base/resource/data_pack_literal.cc
+++ b/ui/base/resource/data_pack_literal.cc
@@ -4,57 +4,71 @@
#include <stddef.h>
+#include "ui/base/resource/data_pack_literal.h"
+
namespace ui {
-extern const char kSamplePakContents[] = {
- 0x04, 0x00, 0x00, 0x00, // header(version
- 0x04, 0x00, 0x00, 0x00, // no. entries
- 0x01, // encoding)
- 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, // index entry 1
- 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, // index entry 4
- 0x06, 0x00, 0x33, 0x00, 0x00, 0x00, // index entry 6
- 0x0a, 0x00, 0x3f, 0x00, 0x00, 0x00, // index entry 10
- 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // extra entry for the size of last
- 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '4',
- 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '6'
-};
+const char kSamplePakContentsV4[] = {
+ 0x04, 0x00, 0x00, 0x00, // header(version
+ 0x04, 0x00, 0x00, 0x00, // no. entries
+ 0x01, // encoding)
+ 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, // index entry 1
+ 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, // index entry 4
+ 0x06, 0x00, 0x33, 0x00, 0x00, 0x00, // index entry 6
+ 0x0a, 0x00, 0x3f, 0x00, 0x00, 0x00, // index entry 10
+ 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // extra entry for the size of last
+ 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '4',
+ 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '6'};
-extern const size_t kSamplePakSize = sizeof(kSamplePakContents);
-
-extern const char kSampleCorruptPakContents[] = {
- 0x04, 0x00, 0x00, 0x00, // header(version
- 0x04, 0x00, 0x00, 0x00, // no. entries
- 0x01, // encoding)
- 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, // index entry 1
- 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, // index entry 4
- 0x06, 0x00, 0x33, 0x00, 0x00, 0x00, // index entry 6
- 0x0a, 0x00, 0x3f, 0x00, 0x00, 0x00, // index entry 10
- 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // extra entry for the size of last,
- // extends past END OF FILE.
- 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '4',
- 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '6'
-};
+const size_t kSamplePakSizeV4 = sizeof(kSamplePakContentsV4);
-extern const size_t kSampleCorruptPakSize = sizeof(kSampleCorruptPakContents);
+const char kSamplePakContentsV5[] = {
+ 0x05, 0x00, 0x00, 0x00, // version
+ 0x01, 0x00, 0x00, 0x00, // encoding + padding
+ 0x03, 0x00, 0x01, 0x00, // num_resources, num_aliases
+ 0x01, 0x00, 0x28, 0x00, 0x00, 0x00, // index entry 1
+ 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, // index entry 4
+ 0x06, 0x00, 0x34, 0x00, 0x00, 0x00, // index entry 6
+ 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // extra entry for the size of last
+ 0x0a, 0x00, 0x01, 0x00, // alias table
+ 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '4',
+ 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '6'};
-extern const char kSamplePakContents2x[] = {
- 0x04, 0x00, 0x00, 0x00, // header(version
- 0x01, 0x00, 0x00, 0x00, // no. entries
- 0x01, // encoding)
- 0x04, 0x00, 0x15, 0x00, 0x00, 0x00, // index entry 4
- 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, // extra entry for the size of last
- 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '4', ' ', '2', 'x'
-};
+const size_t kSamplePakSizeV5 = sizeof(kSamplePakContentsV5);
+
+const char kSampleCorruptPakContents[] = {
+ 0x04, 0x00, 0x00, 0x00, // header(version
+ 0x04, 0x00, 0x00, 0x00, // no. entries
+ 0x01, // encoding)
+ 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, // index entry 1
+ 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, // index entry 4
+ 0x06, 0x00, 0x33, 0x00, 0x00, 0x00, // index entry 6
+ 0x0a, 0x00, 0x3f, 0x00, 0x00, 0x00, // index entry 10
+ 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // extra entry for the size of last,
+ // extends past END OF FILE.
+ 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '4', 't', 'h', 'i',
+ 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '6'};
+
+const size_t kSampleCorruptPakSize = sizeof(kSampleCorruptPakContents);
+
+const char kSamplePakContents2x[] = {
+ 0x04, 0x00, 0x00, 0x00, // header(version
+ 0x01, 0x00, 0x00, 0x00, // no. entries
+ 0x01, // encoding)
+ 0x04, 0x00, 0x15, 0x00, 0x00, 0x00, // index entry 4
+ 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, // extra entry for the size of last
+ 't', 'h', 'i', 's', ' ', 'i', 's', ' ',
+ 'i', 'd', ' ', '4', ' ', '2', 'x'};
-extern const size_t kSamplePakSize2x = sizeof(kSamplePakContents2x);
+const size_t kSamplePakSize2x = sizeof(kSamplePakContents2x);
-extern const char kEmptyPakContents[] = {
- 0x04, 0x00, 0x00, 0x00, // header(version
- 0x00, 0x00, 0x00, 0x00, // no. entries
- 0x01, // encoding)
- 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00 // extra entry for the size of last
+const char kEmptyPakContents[] = {
+ 0x04, 0x00, 0x00, 0x00, // header(version
+ 0x00, 0x00, 0x00, 0x00, // no. entries
+ 0x01, // encoding)
+ 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00 // extra entry for the size of last
};
-extern const size_t kEmptyPakSize = sizeof(kEmptyPakContents);
+const size_t kEmptyPakSize = sizeof(kEmptyPakContents);
} // namespace ui
« no previous file with comments | « ui/base/resource/data_pack_literal.h ('k') | ui/base/resource/data_pack_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698