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

Unified Diff: components/content_settings/core/browser/content_settings_origin_identifier_value_map.cc

Issue 1459973005: Reland of Use std::tie() for operator< in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
Index: components/content_settings/core/browser/content_settings_origin_identifier_value_map.cc
diff --git a/components/content_settings/core/browser/content_settings_origin_identifier_value_map.cc b/components/content_settings/core/browser/content_settings_origin_identifier_value_map.cc
index d51e624dcacd77770fffbfe3642e18c55dd7e22c..0c3ab90c6d50eea6f645def974c08e78126dd524 100644
--- a/components/content_settings/core/browser/content_settings_origin_identifier_value_map.cc
+++ b/components/content_settings/core/browser/content_settings_origin_identifier_value_map.cc
@@ -3,6 +3,8 @@
// found in the LICENSE file.
#include "components/content_settings/core/browser/content_settings_origin_identifier_value_map.h"
+
+#include <tuple>
#include "base/compiler_specific.h"
#include "base/logging.h"
@@ -61,9 +63,8 @@
bool OriginIdentifierValueMap::EntryMapKey::operator<(
const OriginIdentifierValueMap::EntryMapKey& other) const {
- if (content_type != other.content_type)
- return content_type < other.content_type;
- return (resource_identifier < other.resource_identifier);
+ return std::tie(content_type, resource_identifier) <
+ std::tie(other.content_type, other.resource_identifier);
}
OriginIdentifierValueMap::PatternPair::PatternPair(
@@ -78,11 +79,8 @@
// Note that this operator is the other way around than
// |ContentSettingsPattern::operator<|. It sorts patterns with higher
// precedence first.
- if (primary_pattern > other.primary_pattern)
- return true;
- else if (other.primary_pattern > primary_pattern)
- return false;
- return (secondary_pattern > other.secondary_pattern);
+ return std::tie(primary_pattern, secondary_pattern) >
+ std::tie(other.primary_pattern, other.secondary_pattern);
}
RuleIterator* OriginIdentifierValueMap::GetRuleIterator(
« no previous file with comments | « components/autofill/core/common/password_form_fill_data.cc ('k') | components/guest_view/browser/guest_view_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698