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

Issue 2785493004: Integrate RankerModelLoader with TranslateRanker. (Closed)

Created:
3 years, 8 months ago by Roger McFarlane (Chromium)
Modified:
3 years, 8 months ago
CC:
chromium-reviews, ios-reviews+chrome_chromium.org, ios-reviews_chromium.org, pkl (ping after 24h if needed), ios-reviews+web_chromium.org, noyau+watch_chromium.org, asvitkine+watch_chromium.org, marq+watch_chromium.org, sdefresne+watch_chromium.org, groby-ooo-7-16
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Integrate RankerModelLoader with TranslateRanker. This CL replaces the model loading code in the TranslateRanker with the use of the RankerModelLoader. * the TranslateRanker transitions to a KeyedService * the TranslateRanker is split into interface and implementation, facilitationt mocking the TranslateRanker in tests. * Browser-level TransalteRankerFactories are added in order to pass the appropriate model cache path and model url to the ranker and, in turn, the model loader. * Metrics providers have been promoted to browser level to allow for accessing it as a keyed servie across all loaded profiles. BUG=646711, 697665, 698057 Review-Url: https://codereview.chromium.org/2785493004 Cr-Commit-Position: refs/heads/master@{#462038} Committed: https://chromium.googlesource.com/chromium/src/+/95c5541219a088802bf259cc36ab7fd4a7ae98e7

Patch Set 1 #

Patch Set 2 : remove implicit handling of enforcement=>query #

Total comments: 4

Patch Set 3 : add fieldtrial test config to waterfall #

Patch Set 4 : comments from hamelphi (also revert field-trial config change for bot test) #

Patch Set 5 : re-enable field trial testing #

Patch Set 6 : fix download retry logic #

Patch Set 7 : DO NOT SUBMIT - skip loading from cache #

Patch Set 8 : no delay on post task for start #

Patch Set 9 : rebase #

Total comments: 26

Patch Set 10 : comments from droger and rkaplow #

Patch Set 11 : remove unneded GetInstance() from web_view_translate_client #

Patch Set 12 : disable logging on IOS Web View builds (attempt #1) #

Total comments: 7

Patch Set 13 : disable logging for ios chrome web view (attempt #2) #

Patch Set 14 : rebase and adjust to updated web_view BUILD.gn #

Patch Set 15 : fix bogus compile error #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+1478 lines, -784 lines) Patch
M chrome/browser/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/metrics/chrome_metrics_service_client.cc View 1 2 3 4 5 6 7 8 2 chunks +1 line, -1 line 0 comments Download
M chrome/browser/translate/chrome_translate_client.cc View 1 2 3 4 5 6 7 8 9 2 chunks +8 lines, -5 lines 0 comments Download
A chrome/browser/translate/translate_ranker_factory.h View 1 2 3 4 5 6 7 8 9 1 chunk +43 lines, -0 lines 0 comments Download
A chrome/browser/translate/translate_ranker_factory.cc View 1 2 3 4 5 6 7 8 9 1 chunk +46 lines, -0 lines 0 comments Download
A + chrome/browser/translate/translate_ranker_metrics_provider.h View 1 2 3 4 5 6 7 8 9 3 chunks +6 lines, -6 lines 0 comments Download
A chrome/browser/translate/translate_ranker_metrics_provider.cc View 1 2 3 4 5 6 7 8 9 1 chunk +35 lines, -0 lines 0 comments Download
M components/translate/core/browser/BUILD.gn View 2 chunks +5 lines, -4 lines 0 comments Download
A components/translate/core/browser/mock_translate_ranker.h View 1 2 3 4 5 6 7 8 9 1 chunk +66 lines, -0 lines 0 comments Download
A components/translate/core/browser/mock_translate_ranker.cc View 1 2 3 4 5 6 7 8 9 1 chunk +51 lines, -0 lines 0 comments Download
M components/translate/core/browser/ranker_model_loader.cc View 1 2 3 4 5 6 7 5 chunks +25 lines, -27 lines 0 comments Download
M components/translate/core/browser/translate_manager.h View 3 chunks +3 lines, -0 lines 0 comments Download
M components/translate/core/browser/translate_manager.cc View 1 2 3 4 chunks +25 lines, -21 lines 0 comments Download
M components/translate/core/browser/translate_manager_unittest.cc View 1 2 4 chunks +4 lines, -2 lines 0 comments Download
M components/translate/core/browser/translate_ranker.h View 1 chunk +20 lines, -83 lines 0 comments Download
D components/translate/core/browser/translate_ranker.cc View 1 chunk +0 lines, -311 lines 0 comments Download
A components/translate/core/browser/translate_ranker_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +149 lines, -0 lines 0 comments Download
A components/translate/core/browser/translate_ranker_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +301 lines, -0 lines 0 comments Download
A components/translate/core/browser/translate_ranker_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +378 lines, -0 lines 0 comments Download
D components/translate/core/browser/translate_ranker_metrics_provider.h View 1 chunk +0 lines, -28 lines 0 comments Download
D components/translate/core/browser/translate_ranker_metrics_provider.cc View 1 chunk +0 lines, -37 lines 0 comments Download
D components/translate/core/browser/translate_ranker_unittest.cc View 1 chunk +0 lines, -235 lines 0 comments Download
M components/translate/core/browser/translate_ui_delegate_unittest.cc View 4 chunks +7 lines, -3 lines 0 comments Download
M components/translate/core/browser/translate_url_fetcher.cc View 1 chunk +1 line, -1 line 0 comments Download
M ios/chrome/browser/metrics/BUILD.gn View 2 chunks +1 line, -1 line 0 comments Download
M ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm View 2 chunks +1 line, -1 line 0 comments Download
M ios/chrome/browser/translate/BUILD.gn View 2 chunks +6 lines, -0 lines 0 comments Download
M ios/chrome/browser/translate/chrome_ios_translate_client.mm View 1 2 3 4 5 6 7 8 9 3 chunks +8 lines, -2 lines 0 comments Download
A ios/chrome/browser/translate/translate_ranker_factory.h View 1 chunk +51 lines, -0 lines 0 comments Download
A ios/chrome/browser/translate/translate_ranker_factory.cc View 1 chunk +50 lines, -0 lines 0 comments Download
A + ios/chrome/browser/translate/translate_ranker_metrics_provider.h View 1 2 3 4 5 6 7 8 9 3 chunks +6 lines, -6 lines 0 comments Download
A ios/chrome/browser/translate/translate_ranker_metrics_provider.cc View 1 chunk +37 lines, -0 lines 0 comments Download
M ios/web_view/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -0 lines 0 comments Download
M ios/web_view/internal/translate/web_view_translate_client.mm View 1 2 3 4 5 6 7 8 9 10 2 chunks +4 lines, -0 lines 0 comments Download
A ios/web_view/internal/translate/web_view_translate_ranker_factory.h View 1 chunk +48 lines, -0 lines 0 comments Download
A ios/web_view/internal/translate/web_view_translate_ranker_factory.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +53 lines, -0 lines 2 comments Download
M testing/variations/fieldtrial_testing_config.json View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +23 lines, -0 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +10 lines, -10 lines 0 comments Download

Messages

Total messages: 69 (42 generated)
Roger McFarlane (Chromium)
PTAL? The diffs between this CL and the last attempt to land this CL are ...
3 years, 8 months ago (2017-03-29 05:47:51 UTC) #4
hamelphi
lgtm https://codereview.chromium.org/2785493004/diff/20001/components/translate/core/browser/translate_manager.cc File components/translate/core/browser/translate_manager.cc (right): https://codereview.chromium.org/2785493004/diff/20001/components/translate/core/browser/translate_manager.cc#newcode609 components/translate/core/browser/translate_manager.cc:609: if (translate_ranker_->IsLoggingEnabled()) We already gate on this in ...
3 years, 8 months ago (2017-03-29 19:23:56 UTC) #13
Roger McFarlane (Chromium)
Thanks. https://codereview.chromium.org/2785493004/diff/20001/components/translate/core/browser/translate_manager.cc File components/translate/core/browser/translate_manager.cc (right): https://codereview.chromium.org/2785493004/diff/20001/components/translate/core/browser/translate_manager.cc#newcode609 components/translate/core/browser/translate_manager.cc:609: if (translate_ranker_->IsLoggingEnabled()) On 2017/03/29 19:23:56, hamelphi wrote: > ...
3 years, 8 months ago (2017-03-30 15:32:58 UTC) #14
Roger McFarlane (Chromium)
PTAL? This is an attempt to re-land the translate ranker model download and caching code. ...
3 years, 8 months ago (2017-03-31 16:03:44 UTC) #18
Roger McFarlane (Chromium)
Partial diff from https://codereview.chromium.org/2726203002/ follows ********************************************************** diff --git a/chrome/browser/translate/translate_ranker_metrics_provider.cc b/chrome/browser/translate/translate_ranker_metrics_provider.cc index 7790108b1d05..2feb883eae05 100644 --- a/chrome/browser/translate/translate_ranker_metrics_provider.cc ...
3 years, 8 months ago (2017-03-31 16:07:02 UTC) #19
Roger McFarlane (Chromium)
Remaining diff, follows... ********************************************************** diff --git a/components/translate/core/browser/translate_ranker_impl_unittest.cc b/components/translate/core/browser/translate_ranker_impl_unittest.cc index 7a665be6627c..ae7c64c65308 100644 --- a/components/translate/core/browser/translate_ranker_impl_unittest.cc +++ b/components/translate/core/browser/translate_ranker_impl_unittest.cc ...
3 years, 8 months ago (2017-03-31 16:07:54 UTC) #20
rkaplow
https://codereview.chromium.org/2785493004/diff/160001/tools/metrics/histograms/histograms.xml File tools/metrics/histograms/histograms.xml (left): https://codereview.chromium.org/2785493004/diff/160001/tools/metrics/histograms/histograms.xml#oldcode113366 tools/metrics/histograms/histograms.xml:113366: - <int value="4" label="Validation Failed"/> you can actually leave ...
3 years, 8 months ago (2017-04-03 03:14:25 UTC) #25
droger
Only did a quick pass since this was already mostly reviewed. LGTM with comments. https://codereview.chromium.org/2785493004/diff/160001/chrome/browser/translate/chrome_translate_client.cc ...
3 years, 8 months ago (2017-04-03 09:18:08 UTC) #26
Roger McFarlane (Chromium)
Thanks. rkaplow@... another look? sdefresne@... ping? rkaplow@ and sdefresne@... should I have a metrics provider ...
3 years, 8 months ago (2017-04-03 17:44:55 UTC) #29
Roger McFarlane (Chromium)
+emaxx@... re: crbug/698057 - switched to using GetLoadedProfiles() instead of GetLastOpenedProfiles() to avoid CHECK on ...
3 years, 8 months ago (2017-04-03 17:50:28 UTC) #32
Roger McFarlane (Chromium)
+emaxx@... re: crbug/698057 - switched to using GetLoadedProfiles() instead of GetLastOpenedProfiles() to avoid CHECK on ...
3 years, 8 months ago (2017-04-03 17:50:33 UTC) #33
rkaplow
lgtm oh ok, missed that the intention was for the rename for the enum. For ...
3 years, 8 months ago (2017-04-03 19:22:52 UTC) #38
Roger McFarlane (Chromium)
+eugenebut for ios/web_view specific question... eugenebut/sdefresne: I was looking through the Chrome Translate Ranker Event ...
3 years, 8 months ago (2017-04-03 20:17:00 UTC) #40
Eugene But (OOO till 7-30)
On 2017/04/03 20:17:00, Roger McFarlane (Chromium) wrote: > +eugenebut for ios/web_view specific question... > > ...
3 years, 8 months ago (2017-04-03 20:59:23 UTC) #41
droger
On 2017/04/03 20:17:00, Roger McFarlane (Chromium) wrote: > +eugenebut for ios/web_view specific question... > > ...
3 years, 8 months ago (2017-04-04 08:57:16 UTC) #42
sdefresne
https://codereview.chromium.org/2785493004/diff/220001/components/translate/core/browser/translate_ranker_impl.cc File components/translate/core/browser/translate_ranker_impl.cc (right): https://codereview.chromium.org/2785493004/diff/220001/components/translate/core/browser/translate_ranker_impl.cc#newcode82 components/translate/core/browser/translate_ranker_impl.cc:82: #if defined(CWV_IMPLEMENTATION) This macro will not be defined when ...
3 years, 8 months ago (2017-04-04 09:40:23 UTC) #43
emaxx
https://codereview.chromium.org/2785493004/diff/220001/chrome/browser/translate/translate_ranker_metrics_provider.cc File chrome/browser/translate/translate_ranker_metrics_provider.cc (right): https://codereview.chromium.org/2785493004/diff/220001/chrome/browser/translate/translate_ranker_metrics_provider.cc#newcode19 chrome/browser/translate/translate_ranker_metrics_provider.cc:19: g_browser_process->profile_manager()->GetLoadedProfiles(); Note that on Chrome OS there is a ...
3 years, 8 months ago (2017-04-04 13:22:38 UTC) #44
Roger McFarlane (Chromium)
droger@: The question isn't about Chrome iOS, it's with the iOS Web View, which seems ...
3 years, 8 months ago (2017-04-04 17:03:06 UTC) #45
emaxx
LGTM regarding the use of GetLoadedProfiles for avoiding misbehavior on Chrome OS https://codereview.chromium.org/2785493004/diff/220001/chrome/browser/translate/translate_ranker_metrics_provider.cc File chrome/browser/translate/translate_ranker_metrics_provider.cc ...
3 years, 8 months ago (2017-04-04 17:12:38 UTC) #46
Eugene But (OOO till 7-30)
https://codereview.chromium.org/2785493004/diff/220001/components/translate/core/browser/translate_ranker_impl.cc File components/translate/core/browser/translate_ranker_impl.cc (right): https://codereview.chromium.org/2785493004/diff/220001/components/translate/core/browser/translate_ranker_impl.cc#newcode82 components/translate/core/browser/translate_ranker_impl.cc:82: #if defined(CWV_IMPLEMENTATION) On 2017/04/04 17:03:06, Roger McFarlane (Chromium) wrote: ...
3 years, 8 months ago (2017-04-04 18:19:00 UTC) #47
Eugene But (OOO till 7-30)
https://codereview.chromium.org/2785493004/diff/220001/components/translate/core/browser/translate_ranker_impl.cc File components/translate/core/browser/translate_ranker_impl.cc (right): https://codereview.chromium.org/2785493004/diff/220001/components/translate/core/browser/translate_ranker_impl.cc#newcode82 components/translate/core/browser/translate_ranker_impl.cc:82: #if defined(CWV_IMPLEMENTATION) On 2017/04/04 17:03:06, Roger McFarlane (Chromium) wrote: ...
3 years, 8 months ago (2017-04-04 18:19:00 UTC) #48
Roger McFarlane (Chromium)
Thanks. eugenebut@ and/or sdefresne@: Another look? I explicitly disable translate ranker event logging from the ...
3 years, 8 months ago (2017-04-04 19:16:06 UTC) #49
Eugene But (OOO till 7-30)
ios lgtm
3 years, 8 months ago (2017-04-04 19:51:57 UTC) #50
sdefresne
lgtm https://codereview.chromium.org/2785493004/diff/340001/ios/web_view/internal/translate/web_view_translate_ranker_factory.cc File ios/web_view/internal/translate/web_view_translate_ranker_factory.cc (right): https://codereview.chromium.org/2785493004/diff/340001/ios/web_view/internal/translate/web_view_translate_ranker_factory.cc#newcode50 ios/web_view/internal/translate/web_view_translate_ranker_factory.cc:50: return std::move(ranker); // Fails xcode-clang compile without the ...
3 years, 8 months ago (2017-04-05 09:33:43 UTC) #62
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2785493004/340001
3 years, 8 months ago (2017-04-05 12:05:43 UTC) #65
commit-bot: I haz the power
Committed patchset #15 (id:340001) as https://chromium.googlesource.com/chromium/src/+/95c5541219a088802bf259cc36ab7fd4a7ae98e7
3 years, 8 months ago (2017-04-05 12:12:49 UTC) #68
Roger McFarlane (Chromium)
3 years, 8 months ago (2017-04-07 02:35:07 UTC) #69
Message was sent while issue was closed.
https://codereview.chromium.org/2785493004/diff/340001/ios/web_view/internal/...
File ios/web_view/internal/translate/web_view_translate_ranker_factory.cc
(right):

https://codereview.chromium.org/2785493004/diff/340001/ios/web_view/internal/...
ios/web_view/internal/translate/web_view_translate_ranker_factory.cc:50: return
std::move(ranker);  // Fails xcode-clang compile without the move.
On 2017/04/05 09:33:43, sdefresne wrote:
> Please change to the following so we can clean this once the xcode-clang issue
> is fixed:
> 
>   // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required.
>   return std::move(ranker);

Oops! Missed this.

Created and landed https://codereview.chromium.org/2800833002

Powered by Google App Engine
This is Rietveld 408576698