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

Side by Side Diff: ui/base/resource/data_pack.h

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 unified diff | Download patch
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/resource/data_pack.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // DataPack represents a read-only view onto an on-disk file that contains 5 // DataPack represents a read-only view onto an on-disk file that contains
6 // (key, value) pairs of data. It's used to store static resources like 6 // (key, value) pairs of data. It's used to store static resources like
7 // translation strings and images. 7 // translation strings and images.
8 8
9 #ifndef UI_BASE_RESOURCE_DATA_PACK_H_ 9 #ifndef UI_BASE_RESOURCE_DATA_PACK_H_
10 #define UI_BASE_RESOURCE_DATA_PACK_H_ 10 #define UI_BASE_RESOURCE_DATA_PACK_H_
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 ui::ScaleFactor GetScaleFactor() const override; 68 ui::ScaleFactor GetScaleFactor() const override;
69 69
70 #if DCHECK_IS_ON() 70 #if DCHECK_IS_ON()
71 // Checks to see if any resource in this DataPack already exists in the list 71 // Checks to see if any resource in this DataPack already exists in the list
72 // of resources. 72 // of resources.
73 void CheckForDuplicateResources( 73 void CheckForDuplicateResources(
74 const std::vector<std::unique_ptr<ResourceHandle>>& packs); 74 const std::vector<std::unique_ptr<ResourceHandle>>& packs);
75 #endif 75 #endif
76 76
77 private: 77 private:
78 struct Entry;
79 struct Alias;
78 class DataSource; 80 class DataSource;
79 class BufferDataSource; 81 class BufferDataSource;
80 class MemoryMappedDataSource; 82 class MemoryMappedDataSource;
81 83
82 // Does the actual loading of a pack file. 84 // Does the actual loading of a pack file.
83 // Called by Load and LoadFromFile and LoadFromBuffer. 85 // Called by Load and LoadFromFile and LoadFromBuffer.
84 bool LoadImpl(std::unique_ptr<DataSource> data_source); 86 bool LoadImpl(std::unique_ptr<DataSource> data_source);
87 const Entry* LookupEntryById(uint16_t resource_id) const;
85 88
86 std::unique_ptr<DataSource> data_source_; 89 std::unique_ptr<DataSource> data_source_;
87 90
88 // Number of resources in the data. 91 const Entry* resource_table_;
89 size_t resource_count_; 92 size_t resource_count_;
93 const Alias* alias_table_;
94 size_t alias_count_;
90 95
91 // Type of encoding for text resources. 96 // Type of encoding for text resources.
92 TextEncodingType text_encoding_type_; 97 TextEncodingType text_encoding_type_;
93 98
94 // The scale of the image in this resource pack relative to images in the 1x 99 // The scale of the image in this resource pack relative to images in the 1x
95 // resource pak. 100 // resource pak.
96 ui::ScaleFactor scale_factor_; 101 ui::ScaleFactor scale_factor_;
97 102
98 DISALLOW_COPY_AND_ASSIGN(DataPack); 103 DISALLOW_COPY_AND_ASSIGN(DataPack);
99 }; 104 };
100 105
101 } // namespace ui 106 } // namespace ui
102 107
103 #endif // UI_BASE_RESOURCE_DATA_PACK_H_ 108 #endif // UI_BASE_RESOURCE_DATA_PACK_H_
OLDNEW
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/resource/data_pack.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698