diff options
author | csharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 16:34:50 +0000 |
---|---|---|
committer | csharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 16:34:50 +0000 |
commit | 36a5c4ceb49c0bb7ed8a5242688aa285429c03de (patch) | |
tree | 28bbabf54223513cd0cf486d7f4b55b4d5996b43 /chrome/common/string_ordinal.cc | |
parent | 2f814d30264d0ebcb5f452d3b0c785b72e240ead (diff) | |
download | chromium_src-36a5c4ceb49c0bb7ed8a5242688aa285429c03de.zip chromium_src-36a5c4ceb49c0bb7ed8a5242688aa285429c03de.tar.gz chromium_src-36a5c4ceb49c0bb7ed8a5242688aa285429c03de.tar.bz2 |
Convert app_launch_index and page_index from int to StringOrdinal.
This application icon index values are being changed from ints to StringOrdinals to decrease the potential number of syncs required when icons are moved, by only needing to change 1 StringOrdinal instead of all the integers. This include extra data verification that helps prevent an out of memory crash present in the earlier submission attempt.
BUG=61447,107376
TEST=Open up an instance of chromium with multiple application icons and ensure
that icons can still have their page and order changed. There should be no
behaviour change.
Review URL: http://codereview.chromium.org/8936010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114440 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/string_ordinal.cc')
-rw-r--r-- | chrome/common/string_ordinal.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/common/string_ordinal.cc b/chrome/common/string_ordinal.cc index f070026..069afd2 100644 --- a/chrome/common/string_ordinal.cc +++ b/chrome/common/string_ordinal.cc @@ -174,6 +174,10 @@ StringOrdinal::StringOrdinal() : string_ordinal_(""), is_valid_(false) { } +StringOrdinal StringOrdinal::CreateInitialOrdinal() { + return StringOrdinal(std::string(1, kMidDigit)); +} + bool StringOrdinal::IsValid() const { return is_valid_; } @@ -184,6 +188,12 @@ bool StringOrdinal::LessThan(const StringOrdinal& other) const { return string_ordinal_ < other.string_ordinal_; } +bool StringOrdinal::GreaterThan(const StringOrdinal& other) const { + CHECK(IsValid()); + CHECK(other.IsValid()); + return string_ordinal_ > other.string_ordinal_; +} + bool StringOrdinal::Equal(const StringOrdinal& other) const { CHECK(IsValid()); CHECK(other.IsValid()); @@ -238,3 +248,8 @@ std::string StringOrdinal::ToString() const { CHECK(IsValid()); return string_ordinal_; } + +bool StringOrdinalLessThan::operator() (const StringOrdinal& lhs, + const StringOrdinal& rhs) const { + return lhs.LessThan(rhs); +} |