summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2022-11-17 14:02:11 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2022-11-22 11:38:28 +0000
commit22907bc4b5fac4632cd9b30e88c421a9ff31e94c (patch)
treefce9eceaad49a20e127e4fdc349679cc46a61353
parent77b1780b06153db6abcc05bb78ce69100a91c28c (diff)
downloadqtwebengine-chromium-22907bc4b5fac4632cd9b30e88c421a9ff31e94c.tar.gz
[Revert] HLS: Use base::ranges instead of std algorithms library
The reverted patch is https://chromium-review.googlesource.com/c/chromium/src/+/3758498 base::ranges solution doesn't build with MSVC. Switch back to the std algorithms solution to fix the build temporarily. Change-Id: I36ba53b88565b74557db83c74df9e273b4fff247 Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/443948 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--chromium/media/formats/hls/types.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/chromium/media/formats/hls/types.cc b/chromium/media/formats/hls/types.cc
index ca4590b6efb..acb3d8bedac 100644
--- a/chromium/media/formats/hls/types.cc
+++ b/chromium/media/formats/hls/types.cc
@@ -4,8 +4,8 @@
#include "media/formats/hls/types.h"
+#include <algorithm>
#include <cmath>
-#include <functional>
#include <limits>
#include "base/containers/contains.h"
@@ -45,7 +45,8 @@ absl::optional<SourceString> ExtractAttributeName(SourceString* source_str) {
};
// Extract the substring where `is_char_valid` succeeds
- const char* end = base::ranges::find_if_not(str.Str(), is_char_valid);
+ const char* end =
+ std::find_if_not(str.Str().cbegin(), str.Str().cend(), is_char_valid);
const auto name = str.Consume(end - str.Str().cbegin());
// At least one character must have matched
@@ -101,6 +102,16 @@ absl::optional<SourceString> ExtractAttributeValue(SourceString* source_str) {
return result;
}
+struct AttributeMapComparator {
+ bool operator()(const AttributeMap::Item& left,
+ const AttributeMap::Item& right) {
+ return left.first < right.first;
+ }
+ bool operator()(const AttributeMap::Item& left, SourceString right) {
+ return left.first < right.Str();
+ }
+};
+
} // namespace
ParseStatus::Or<DecimalInteger> ParseDecimalInteger(
@@ -344,7 +355,7 @@ AttributeMap::AttributeMap(base::span<Item> sorted_items)
// tries to access the stored value after filling by the index of a subsequent
// duplicate key, rather than the first.
DCHECK(
- base::ranges::is_sorted(items_, std::less(), &AttributeMap::Item::first));
+ std::is_sorted(items_.begin(), items_.end(), AttributeMapComparator()));
}
ParseStatus::Or<AttributeListIterator::Item> AttributeMap::Fill(
@@ -360,11 +371,10 @@ ParseStatus::Or<AttributeListIterator::Item> AttributeMap::Fill(
auto item = std::move(result).value();
- // Look up the item. `base::ranges::lower_bound` performs a binary search to
- // find the first entry where the name does not compare less than the given
- // value.
- auto entry = base::ranges::lower_bound(items_, item.name.Str(), std::less(),
- &AttributeMap::Item::first);
+ // Look up the item. std::lower_bound performs a binary search to find the
+ // first item where the name comparison function fails.
+ auto entry = std::lower_bound(items_.begin(), items_.end(), item.name,
+ AttributeMapComparator());
if (entry == items_.end()) {
return item;
}