DescriptionImplementing URL prefix match for history thumbnail cache.
We wish to make MostLikely URL recommendations use local thumbnail. To increase the likelihood of a hit, this CL enables a thumbnail request to perform URL prefix match. For example, if thumbnail is stored for
==> http://www.chromium.org/Home
but not
==> http://www.chromium.org/
then previously the request
==> chrome://thumb/http://www.chromium.org/
would fail. This CL aims to create a fallback, by adding "thumb2" that matches prefix, i.e.:
==> chrome://thumb2/http://www.chromium.org/
would match "http://www.chromium.org/Home" and display the corresponding thumbnail. Details:
- We consider "URL prefix" match, which is not same as "string prefix" match. Specifics:
--- Need identical protocol/scheme, host, and port (GURL is smart about this).
--- Query strings are ignored.
--- For path, we require entire path components to match. E.g., "base/test" is a prefix of "base/test/sub", but is NOT a prefix of "base/testing" or "best/test-case".
- If multiple matches exist, the first URL-lexicographical match is taken. This allows the "nearest" children to be matched, but favors siblings that are alphabetically closer. For example, "base" prefers "base/test" over "base/test/sub", but also prefers "base/deep/sub/dir/" over "base/test" (since "deep" < "test").
- To implement the above match, a new comparator is used in the thumbnail cache.
- Adding new test TopSitesCacheTest, which also tests existing code.
- Adding url_utils.cc in chrome\browser\history, along with unit tests.
- Adding the "chrome://thumb2" path, which causes most of the 1-2-line changes in files.
BUG=284634
TEST=TopSitesCacheTest.*
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=223508
Patch Set 1 #
Total comments: 10
Patch Set 2 : Comment fixes. #
Total comments: 22
Patch Set 3 : Added high-level comments; fixed tests to compare strings; added more test cases. #
Total comments: 16
Patch Set 4 : Comment fixes; making tests more data-driven. #Patch Set 5 : Sync. #Patch Set 6 : Adding url_utils.*; adding chrome://thumb2; refactoring. #
Total comments: 14
Patch Set 7 : Inlining; comment fixes. #
Total comments: 9
Patch Set 8 : Removing extra constructor of ThumbnailSource; comment fixes. #Patch Set 9 : Fixing mac_rel compile errors for new unit tests. #Patch Set 10 : Need to use const char * in tests. #Patch Set 11 : Need to use ARRAYSIZE_UNSAFE() instead of arraysize() for test data with anonymous type for g++ to … #Patch Set 12 : Need to update Android counterpart. Just use old behavior. #Patch Set 13 : Replacing ASSERT_TRUE() << ... to NOTREACHED() << ... #Messages
Total messages: 27 (0 generated)
|