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

Side by Side Diff: ui/base/sequential_id_generator.h

Issue 23654045: ui: Fix removing a number from the SequentialIDGenerator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/base/sequential_id_generator.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) 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
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_
OLDNEW
« no previous file with comments | « no previous file | ui/base/sequential_id_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698