| 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_GFX_SEQUENTIAL_ID_GENERATOR_H_ | 5 #ifndef UI_GFX_SEQUENTIAL_ID_GENERATOR_H_ |
| 6 #define UI_GFX_SEQUENTIAL_ID_GENERATOR_H_ | 6 #define UI_GFX_SEQUENTIAL_ID_GENERATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "ui/base/ui_export.h" | 12 #include "ui/gfx/gfx_export.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 | 15 |
| 16 // This is used to generate a series of sequential ID numbers in a way that a | 16 // This is used to generate a series of sequential ID numbers in a way that a |
| 17 // new ID is always the lowest possible ID in the sequence. | 17 // new ID is always the lowest possible ID in the sequence. |
| 18 class UI_EXPORT SequentialIDGenerator { | 18 class GFX_EXPORT SequentialIDGenerator { |
| 19 public: | 19 public: |
| 20 // Creates a new generator with the specified lower bound for the IDs. | 20 // Creates a new generator with the specified lower bound for the IDs. |
| 21 explicit SequentialIDGenerator(uint32 min_id); | 21 explicit SequentialIDGenerator(uint32 min_id); |
| 22 ~SequentialIDGenerator(); | 22 ~SequentialIDGenerator(); |
| 23 | 23 |
| 24 // Generates a unique ID to represent |number|. The generated ID is the | 24 // Generates a unique ID to represent |number|. The generated ID is the |
| 25 // smallest available ID greater than or equal to the |min_id| specified | 25 // smallest available ID greater than or equal to the |min_id| specified |
| 26 // during creation of the generator. | 26 // during creation of the generator. |
| 27 uint32 GetGeneratedID(uint32 number); | 27 uint32 GetGeneratedID(uint32 number); |
| 28 | 28 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 51 | 51 |
| 52 uint32 min_id_; | 52 uint32 min_id_; |
| 53 uint32 min_available_id_; | 53 uint32 min_available_id_; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(SequentialIDGenerator); | 55 DISALLOW_COPY_AND_ASSIGN(SequentialIDGenerator); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 } // namespace ui | 58 } // namespace ui |
| 59 | 59 |
| 60 #endif // UI_GFX_SEQUENTIAL_ID_GENERATOR_H_ | 60 #endif // UI_GFX_SEQUENTIAL_ID_GENERATOR_H_ |
| OLD | NEW |