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

Unified Diff: ui/gfx/sequential_id_generator.cc

Issue 1543183002: Switch to standard integer types in ui/gfx/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/sequential_id_generator.h ('k') | ui/gfx/sequential_id_generator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/sequential_id_generator.cc
diff --git a/ui/gfx/sequential_id_generator.cc b/ui/gfx/sequential_id_generator.cc
index 4b9c8de74287b8e64c161577fa7b5dbda247cc2f..cdfc62c5b21e3b06611823f9fb58efaf45c9d14b 100644
--- a/ui/gfx/sequential_id_generator.cc
+++ b/ui/gfx/sequential_id_generator.cc
@@ -9,13 +9,13 @@
namespace {
// Removes |key| from |first|, and |first[key]| from |second|.
-template<typename T>
-void Remove(uint32 key, T* first, T* second) {
+template <typename T>
+void Remove(uint32_t key, T* first, T* second) {
typename T::iterator iter = first->find(key);
if (iter == first->end())
return;
- uint32 second_key = iter->second;
+ uint32_t second_key = iter->second;
first->erase(iter);
iter = second->find(second_key);
@@ -27,15 +27,13 @@ void Remove(uint32 key, T* first, T* second) {
namespace ui {
-SequentialIDGenerator::SequentialIDGenerator(uint32 min_id)
- : min_id_(min_id),
- min_available_id_(min_id) {
-}
+SequentialIDGenerator::SequentialIDGenerator(uint32_t min_id)
+ : min_id_(min_id), min_available_id_(min_id) {}
SequentialIDGenerator::~SequentialIDGenerator() {
}
-uint32 SequentialIDGenerator::GetGeneratedID(uint32 number) {
+uint32_t SequentialIDGenerator::GetGeneratedID(uint32_t number) {
IDMap::iterator find = number_to_id_.find(number);
if (find != number_to_id_.end())
return find->second;
@@ -46,16 +44,16 @@ uint32 SequentialIDGenerator::GetGeneratedID(uint32 number) {
return id;
}
-bool SequentialIDGenerator::HasGeneratedIDFor(uint32 number) const {
+bool SequentialIDGenerator::HasGeneratedIDFor(uint32_t number) const {
return number_to_id_.find(number) != number_to_id_.end();
}
-void SequentialIDGenerator::ReleaseGeneratedID(uint32 id) {
+void SequentialIDGenerator::ReleaseGeneratedID(uint32_t id) {
UpdateNextAvailableIDAfterRelease(id);
Remove(id, &id_to_number_, &number_to_id_);
}
-void SequentialIDGenerator::ReleaseNumber(uint32 number) {
+void SequentialIDGenerator::ReleaseNumber(uint32_t number) {
DCHECK_GT(number_to_id_.count(number), 0U);
UpdateNextAvailableIDAfterRelease(number_to_id_[number]);
Remove(number, &number_to_id_, &id_to_number_);
@@ -67,8 +65,8 @@ void SequentialIDGenerator::ResetForTest() {
min_available_id_ = min_id_;
}
-uint32 SequentialIDGenerator::GetNextAvailableID() {
- const uint32 kMaxID = 128;
+uint32_t SequentialIDGenerator::GetNextAvailableID() {
+ const uint32_t kMaxID = 128;
while (id_to_number_.count(min_available_id_) > 0 &&
min_available_id_ < kMaxID) {
++min_available_id_;
@@ -78,7 +76,7 @@ uint32 SequentialIDGenerator::GetNextAvailableID() {
return min_available_id_;
}
-void SequentialIDGenerator::UpdateNextAvailableIDAfterRelease(uint32 id) {
+void SequentialIDGenerator::UpdateNextAvailableIDAfterRelease(uint32_t id) {
if (id < min_available_id_) {
min_available_id_ = id;
DCHECK_GE(min_available_id_, min_id_);
« no previous file with comments | « ui/gfx/sequential_id_generator.h ('k') | ui/gfx/sequential_id_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698