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

Issue 23477033: Implementing URL prefix match for history thumbnail cache. (Closed)

Created:
7 years, 3 months ago by huangs
Modified:
7 years, 2 months ago
Reviewers:
beaudoin, sky
CC:
chromium-reviews, browser-components-watch_chromium.org, Mathieu
Visibility:
Public.

Description

Implementing 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() << ... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+521 lines, -39 lines) Patch
M chrome/browser/android/dev_tools_server.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/android/most_visited_sites.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/android/provider/chrome_browser_provider.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/devtools/browser_list_tabcontents_provider.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_service.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/history/expire_history_backend_unittest.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/history/top_sites.h View 1 2 3 4 5 6 1 chunk +6 lines, -1 line 0 comments Download
M chrome/browser/history/top_sites_cache.h View 1 2 3 4 5 6 7 4 chunks +31 lines, -2 lines 0 comments Download
M chrome/browser/history/top_sites_cache.cc View 1 2 3 4 5 6 3 chunks +27 lines, -2 lines 0 comments Download
A chrome/browser/history/top_sites_cache_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +175 lines, -0 lines 0 comments Download
M chrome/browser/history/top_sites_impl.h View 1 2 3 4 5 1 chunk +3 lines, -1 line 0 comments Download
M chrome/browser/history/top_sites_impl.cc View 1 2 3 4 5 2 chunks +16 lines, -1 line 0 comments Download
M chrome/browser/history/top_sites_impl_unittest.cc View 1 2 3 4 5 10 chunks +14 lines, -12 lines 0 comments Download
A chrome/browser/history/url_utils.h View 1 2 3 4 5 6 7 1 chunk +42 lines, -0 lines 0 comments Download
A chrome/browser/history/url_utils.cc View 1 2 3 4 5 1 chunk +73 lines, -0 lines 0 comments Download
A chrome/browser/history/url_utils_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +92 lines, -0 lines 0 comments Download
M chrome/browser/search/instant_service.cc View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/thumbnails/thumbnail_service.h View 1 2 3 4 5 2 chunks +4 lines, -1 line 0 comments Download
M chrome/browser/thumbnails/thumbnail_service_impl.h View 1 2 3 4 5 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/thumbnails/thumbnail_service_impl.cc View 1 2 3 4 5 2 chunks +4 lines, -3 lines 0 comments Download
M chrome/browser/ui/webui/ntp/most_visited_handler.cc View 1 2 3 4 5 1 chunk +5 lines, -2 lines 0 comments Download
M chrome/browser/ui/webui/ntp/suggestions_page_handler.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/ntp/thumbnail_source.h View 1 2 3 4 5 6 7 2 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/ntp/thumbnail_source.cc View 1 2 3 4 5 6 7 2 chunks +6 lines, -4 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/url_constants.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/url_constants.cc View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 27 (0 generated)
huangs
PTAL.
7 years, 3 months ago (2013-09-03 19:07:18 UTC) #1
beaudoin
- If multiple matches exist, the first URL-lexicographical match is taken. This allows the "nearest" ...
7 years, 3 months ago (2013-09-03 23:22:39 UTC) #2
huangs
Good catch; the particular comment you mentioned was plagued with 2 typos... PTAL. https://codereview.chromium.org/23477033/diff/1/chrome/browser/history/top_sites_cache.h File ...
7 years, 3 months ago (2013-09-04 02:02:05 UTC) #3
beaudoin
I made a more thorough pass this time around. A couple of comments still, but ...
7 years, 3 months ago (2013-09-04 16:46:10 UTC) #4
huangs
Hmm, I think I found a bug with TopSitesCache::UrlIsPrefix(). We'll get a false-negative for http://www.google.com/?test ...
7 years, 3 months ago (2013-09-04 18:39:47 UTC) #5
huangs
Oh wait, I got confused with TopSitesCache::CanonicalURLComparator::CompareString(); we're ignoring queries, so no bug there. :)
7 years, 3 months ago (2013-09-04 18:42:45 UTC) #6
huangs
Lots of comment writing. PTAL. https://codereview.chromium.org/23477033/diff/6001/chrome/browser/history/top_sites_cache.cc File chrome/browser/history/top_sites_cache.cc (right): https://codereview.chromium.org/23477033/diff/6001/chrome/browser/history/top_sites_cache.cc#newcode186 chrome/browser/history/top_sites_cache.cc:186: canonical_urls_.lower_bound(entry); Wrote big tl;dr ...
7 years, 3 months ago (2013-09-04 23:27:39 UTC) #7
beaudoin
LGTM with some suggestions to improve comments. You can send to owners. https://codereview.chromium.org/23477033/diff/6001/chrome/browser/history/top_sites_cache_unittest.cc File chrome/browser/history/top_sites_cache_unittest.cc ...
7 years, 3 months ago (2013-09-05 01:41:18 UTC) #8
huangs
Updated. OWNER review to sky@ (all files), PTAL. https://codereview.chromium.org/23477033/diff/16001/chrome/browser/history/top_sites_cache.h File chrome/browser/history/top_sites_cache.h (right): https://codereview.chromium.org/23477033/diff/16001/chrome/browser/history/top_sites_cache.h#newcode31 chrome/browser/history/top_sites_cache.h:31: // ...
7 years, 3 months ago (2013-09-05 15:24:46 UTC) #9
sky
Why are we doing this? The thumbnails with/without the path and typically entirely different.
7 years, 3 months ago (2013-09-05 20:19:13 UTC) #10
huangs
Sorry for the delay; I've been having Chrome sync problems. *** For context *** beaudoin@: ...
7 years, 3 months ago (2013-09-12 18:38:17 UTC) #11
sky
https://codereview.chromium.org/23477033/diff/33001/chrome/browser/history/top_sites.h File chrome/browser/history/top_sites.h (right): https://codereview.chromium.org/23477033/diff/33001/chrome/browser/history/top_sites.h#newcode77 chrome/browser/history/top_sites.h:77: // not to try harder by matching the query ...
7 years, 3 months ago (2013-09-12 21:22:18 UTC) #12
huangs
Please let me know if you want me to move TopSitesCache::GetCanonicalURLsIteratorForPrefix() outside of TopSiteCache. In ...
7 years, 3 months ago (2013-09-12 23:33:47 UTC) #13
sky
On Thu, Sep 12, 2013 at 4:33 PM, <huangs@chromium.org> wrote: > Please let me know ...
7 years, 3 months ago (2013-09-12 23:42:32 UTC) #14
huangs
https://codereview.chromium.org/23477033/diff/40001/chrome/browser/history/top_sites_cache.h File chrome/browser/history/top_sites_cache.h (right): https://codereview.chromium.org/23477033/diff/40001/chrome/browser/history/top_sites_cache.h#newcode81 chrome/browser/history/top_sites_cache.h:81: // Comparator used for CanonicalURLs. Its main purpose Oops, ...
7 years, 3 months ago (2013-09-12 23:45:33 UTC) #15
sky
https://codereview.chromium.org/23477033/diff/40001/chrome/browser/history/top_sites_cache_unittest.cc File chrome/browser/history/top_sites_cache_unittest.cc (right): https://codereview.chromium.org/23477033/diff/40001/chrome/browser/history/top_sites_cache_unittest.cc#newcode29 chrome/browser/history/top_sites_cache_unittest.cc:29: }; private: DIALLOW_... https://codereview.chromium.org/23477033/diff/40001/chrome/browser/history/url_utils.h File chrome/browser/history/url_utils.h (right): https://codereview.chromium.org/23477033/diff/40001/chrome/browser/history/url_utils.h#newcode17 chrome/browser/history/url_utils.h:17: ...
7 years, 3 months ago (2013-09-12 23:51:41 UTC) #16
huangs
Please note that "chrome://thumb2" is just a placeholder. What do you prefer instead? I'm suggesting ...
7 years, 3 months ago (2013-09-13 02:30:36 UTC) #17
sky
LGTM - I'm fine with either name (thumb2 or prefixthumb) as it's my understanding long ...
7 years, 3 months ago (2013-09-13 17:06:02 UTC) #18
huangs
Okay. Going with thumb2, since it sticks out like a sore thumb2, so easier to ...
7 years, 3 months ago (2013-09-13 20:20:11 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/huangs@chromium.org/23477033/33002
7 years, 3 months ago (2013-09-13 20:51:06 UTC) #20
commit-bot: I haz the power
Retried try job too often on linux_rel for step(s) cacheinvalidation_unittests, cc_unittests, check_deps, chromedriver2_unittests, components_unittests, content_browsertests, ...
7 years, 3 months ago (2013-09-13 21:22:26 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/huangs@chromium.org/23477033/33002
7 years, 3 months ago (2013-09-16 14:31:54 UTC) #22
commit-bot: I haz the power
Step "update" is always a major failure. Look at the try server FAQ for more ...
7 years, 3 months ago (2013-09-16 14:38:38 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/huangs@chromium.org/23477033/78001
7 years, 3 months ago (2013-09-16 17:34:48 UTC) #24
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 3 months ago (2013-09-16 18:12:07 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/huangs@chromium.org/23477033/100001
7 years, 3 months ago (2013-09-16 21:41:33 UTC) #26
commit-bot: I haz the power
7 years, 3 months ago (2013-09-17 01:48:54 UTC) #27
Message was sent while issue was closed.
Change committed as 223508

Powered by Google App Engine
This is Rietveld 408576698