| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 UI_BASE_SEQUENTIAL_ID_GENERATOR_H_ | 5 #ifndef UI_BASE_SEQUENTIAL_ID_GENERATOR_H_ |
| 6 #define UI_BASE_SEQUENTIAL_ID_GENERATOR_H_ | 6 #define UI_BASE_SEQUENTIAL_ID_GENERATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // use this ID. | 35 // use this ID. |
| 36 void ReleaseGeneratedID(uint32 id); | 36 void ReleaseGeneratedID(uint32 id); |
| 37 | 37 |
| 38 // Removes the ID previously generated for |number| by calling | 38 // Removes the ID previously generated for |number| by calling |
| 39 // |GetGeneratedID()|. | 39 // |GetGeneratedID()|. |
| 40 void ReleaseNumber(uint32 number); | 40 void ReleaseNumber(uint32 number); |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 typedef base::hash_map<uint32, uint32> IDMap; | 43 typedef base::hash_map<uint32, uint32> IDMap; |
| 44 | 44 |
| 45 uint32 GetNextAvailableSlot(); | 45 uint32 GetNextAvailableID(); |
| 46 |
| 47 void UpdateNextAvailableIDAfterRelease(uint32 id); |
| 46 | 48 |
| 47 IDMap number_to_id_; | 49 IDMap number_to_id_; |
| 48 IDMap id_to_number_; | 50 IDMap id_to_number_; |
| 49 | 51 |
| 50 uint32 min_id_; | 52 uint32 min_id_; |
| 51 uint32 min_available_id_; | 53 uint32 min_available_id_; |
| 52 | 54 |
| 53 DISALLOW_COPY_AND_ASSIGN(SequentialIDGenerator); | 55 DISALLOW_COPY_AND_ASSIGN(SequentialIDGenerator); |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 } // namespace ui | 58 } // namespace ui |
| 57 | 59 |
| 58 #endif // UI_BASE_SEQUENTIAL_ID_GENERATOR_H_ | 60 #endif // UI_BASE_SEQUENTIAL_ID_GENERATOR_H_ |
| OLD | NEW |