OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COURGETTE_LABEL_MANAGER_H_ | 5 #ifndef COURGETTE_LABEL_MANAGER_H_ |
6 #define COURGETTE_LABEL_MANAGER_H_ | 6 #define COURGETTE_LABEL_MANAGER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // Tracker for index usage to ensure uniqueness of indexes. | 74 // Tracker for index usage to ensure uniqueness of indexes. |
75 std::vector<bool> available_; | 75 std::vector<bool> available_; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(SimpleIndexAssigner); | 77 DISALLOW_COPY_AND_ASSIGN(SimpleIndexAssigner); |
78 }; | 78 }; |
79 | 79 |
80 LabelManager(); | 80 LabelManager(); |
81 ~LabelManager(); | 81 ~LabelManager(); |
82 | 82 |
83 // Returns an exclusive upper bound for all existing indexes in |labels_map|. | |
84 // TODO(huangs): Remove once all callers are gone. | |
85 static int GetIndexBound(const RVAToLabel& labels_map); | |
86 | |
87 // Returns an exclusive upper bound for all assigned indexes in |labels|. | 83 // Returns an exclusive upper bound for all assigned indexes in |labels|. |
88 static int GetLabelIndexBound(const LabelVector& labels); | 84 static int GetLabelIndexBound(const LabelVector& labels); |
89 | 85 |
90 // Accessor to stored Label instances. | 86 // Accessor to stored Label instances. |
91 const LabelVector& Labels() const { return labels_; } | 87 const LabelVector& Labels() const { return labels_; } |
92 | 88 |
93 // Efficiently searches for a Label that targets |rva|. Returns the pointer to | 89 // Efficiently searches for a Label that targets |rva|. Returns the pointer to |
94 // the stored Label instance if found, or null otherwise. Non-const to support | 90 // the stored Label instance if found, or null otherwise. Non-const to support |
95 // implementations that allocate-on-read. | 91 // implementations that allocate-on-read. |
96 Label* Find(RVA rva); | 92 Label* Find(RVA rva); |
(...skipping 22 matching lines...) Expand all Loading... |
119 // The main list of Label instances, sorted by the |rva_| member. | 115 // The main list of Label instances, sorted by the |rva_| member. |
120 LabelVector labels_; | 116 LabelVector labels_; |
121 | 117 |
122 private: | 118 private: |
123 DISALLOW_COPY_AND_ASSIGN(LabelManager); | 119 DISALLOW_COPY_AND_ASSIGN(LabelManager); |
124 }; | 120 }; |
125 | 121 |
126 } // namespace courgette | 122 } // namespace courgette |
127 | 123 |
128 #endif // COURGETTE_LABEL_MANAGER_H_ | 124 #endif // COURGETTE_LABEL_MANAGER_H_ |
OLD | NEW |