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

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

Issue 2989443002: Revert of Add deduplication logic to .pak files (Closed)
Patch Set: 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;
80 class DataSource; 78 class DataSource;
81 class BufferDataSource; 79 class BufferDataSource;
82 class MemoryMappedDataSource; 80 class MemoryMappedDataSource;
83 81
84 // Does the actual loading of a pack file. 82 // Does the actual loading of a pack file.
85 // Called by Load and LoadFromFile and LoadFromBuffer. 83 // Called by Load and LoadFromFile and LoadFromBuffer.
86 bool LoadImpl(std::unique_ptr<DataSource> data_source); 84 bool LoadImpl(std::unique_ptr<DataSource> data_source);
87 const Entry* LookupEntryById(uint16_t resource_id) const;
88 85
89 std::unique_ptr<DataSource> data_source_; 86 std::unique_ptr<DataSource> data_source_;
90 87
91 const Entry* resource_table_; 88 // Number of resources in the data.
92 size_t resource_count_; 89 size_t resource_count_;
93 const Alias* alias_table_;
94 size_t alias_count_;
95 90
96 // Type of encoding for text resources. 91 // Type of encoding for text resources.
97 TextEncodingType text_encoding_type_; 92 TextEncodingType text_encoding_type_;
98 93
99 // The scale of the image in this resource pack relative to images in the 1x 94 // The scale of the image in this resource pack relative to images in the 1x
100 // resource pak. 95 // resource pak.
101 ui::ScaleFactor scale_factor_; 96 ui::ScaleFactor scale_factor_;
102 97
103 DISALLOW_COPY_AND_ASSIGN(DataPack); 98 DISALLOW_COPY_AND_ASSIGN(DataPack);
104 }; 99 };
105 100
106 } // namespace ui 101 } // namespace ui
107 102
108 #endif // UI_BASE_RESOURCE_DATA_PACK_H_ 103 #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