Commit b5565efe authored by Kuang-che Wu's avatar Kuang-che Wu Committed by Commit Bot

Improve speed of WebIconSizesParser

Reduce time complexity from O(n^2) to O(n)

Bug: chromium:855272, chromium:1009098
Change-Id: I9365c7ae7135ec694a5b83ef47674461fc7f353e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1854104Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Kuang-che Wu <kcwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705091}
parent 2e7caa35
......@@ -65,7 +65,7 @@ WebVector<WebSize> WebIconSizesParser::ParseIconSizes(
break;
// See if the current size is "any".
if (sizes_string.FindIgnoringCase("any", i) == i &&
if (sizes_string.Substring(i, 3).StartsWithIgnoringCase("any") &&
(i + 3 == length || IsWhitespace(sizes_string[i + 3]))) {
icon_sizes.push_back(WebSize(0, 0));
i = i + 3;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment