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

Issue 2396783002: Add LanguageModel, a keyed service that collects language info from CLD. (Closed)

Created:
4 years, 2 months ago by jkrcal
Modified:
4 years, 2 months ago
CC:
blundell+watchlist_chromium.org, chromium-reviews, darin-cc_chromium.org, droger+watchlist_chromium.org, jam, sdefresne+watchlist_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add LanguageModel, a keyed service that collects language info from CLD. Before this CL, user's statistics about language detection from the CLD3 library were not accessible to Chrome. This CL introduces a new keyed service called LanguageModel that collects such statistics and builds a simple model on top of that. This allows other parts of Chrome to see top languages in which the user consumes web content. A design doc: https://docs.google.com/a/google.com/document/d/1FBD79CEBUKkMtSJKk3fnF1xnlrXd23z2fHgIGQUFOE8/edit?usp=sharing BUG=653058 Committed: https://crrev.com/c713e7093d3e93fabecd885f93c0522272325725 Cr-Commit-Position: refs/heads/master@{#423702}

Patch Set 1 #

Total comments: 21

Patch Set 2 : David's comments #

Patch Set 3 : Bernhard's comments #

Total comments: 22

Patch Set 4 : David's comments #2 #

Total comments: 4

Patch Set 5 : Bernhard's comments #2 #

Total comments: 2

Patch Set 6 : Paweł's comment #

Patch Set 7 : Fix the asan bug #

Patch Set 8 : Fixing incognito #

Unified diffs Side-by-side diffs Delta from patch set Stats (+384 lines, -1 line) Patch
M chrome/browser/BUILD.gn View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/prefs/browser_prefs.cc View 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/browser/translate/chrome_translate_client.h View 1 2 2 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/translate/chrome_translate_client.cc View 1 2 3 4 5 6 7 4 chunks +11 lines, -1 line 0 comments Download
A chrome/browser/translate/language_model_factory.h View 1 2 3 1 chunk +36 lines, -0 lines 0 comments Download
A chrome/browser/translate/language_model_factory.cc View 1 2 3 4 5 6 1 chunk +36 lines, -0 lines 0 comments Download
M components/translate/core/browser/BUILD.gn View 1 2 3 4 chunks +5 lines, -0 lines 0 comments Download
M components/translate/core/browser/DEPS View 1 chunk +1 line, -0 lines 0 comments Download
A components/translate/core/browser/language_model.h View 1 2 3 4 5 1 chunk +66 lines, -0 lines 0 comments Download
A components/translate/core/browser/language_model.cc View 1 2 3 1 chunk +127 lines, -0 lines 0 comments Download
A components/translate/core/browser/language_model_unittest.cc View 1 2 3 4 1 chunk +93 lines, -0 lines 0 comments Download

Messages

Total messages: 43 (21 generated)
jkrcal
David, could you PTAL at my implementation? Thanks for all your help, so far!
4 years, 2 months ago (2016-10-05 11:54:01 UTC) #2
jkrcal
Bernhard, could you PTAL at browser_prefs.cc? Paweł, could you PTAL at keyed_service dependency?
4 years, 2 months ago (2016-10-05 11:59:02 UTC) #4
droger
Some nits below, but I'll do another pass. Do you need this feature on iOS ...
4 years, 2 months ago (2016-10-05 13:11:32 UTC) #9
droger
https://codereview.chromium.org/2396783002/diff/1/components/translate/content/browser/language_model_observer.cc File components/translate/content/browser/language_model_observer.cc (right): https://codereview.chromium.org/2396783002/diff/1/components/translate/content/browser/language_model_observer.cc#newcode22 components/translate/content/browser/language_model_observer.cc:22: language_model_->OnPageVisited(details.cld_language); Actually you can probably simplify here: get rid ...
4 years, 2 months ago (2016-10-05 13:37:27 UTC) #10
Bernhard Bauer
I agree with David's comment about moving the counting to ChromeTranslateClient. https://codereview.chromium.org/2396783002/diff/1/components/translate/content/browser/language_model_observer.h File components/translate/content/browser/language_model_observer.h (right): ...
4 years, 2 months ago (2016-10-05 14:48:16 UTC) #11
jkrcal
Thanks to both of you! David, LanguageModel will not be used on iOS in the ...
4 years, 2 months ago (2016-10-05 15:14:47 UTC) #16
droger
https://codereview.chromium.org/2396783002/diff/1/components/translate/core/browser/language_model_unittest.cc File components/translate/core/browser/language_model_unittest.cc (right): https://codereview.chromium.org/2396783002/diff/1/components/translate/core/browser/language_model_unittest.cc#newcode63 components/translate/core/browser/language_model_unittest.cc:63: EXPECT_THAT(model.GetLanguageFrequency(kLang1), 0.75); On 2016/10/05 15:14:47, jkrcal wrote: > On ...
4 years, 2 months ago (2016-10-05 15:24:31 UTC) #17
droger
On 2016/10/05 15:14:47, jkrcal wrote: > David, LanguageModel will not be used on iOS in ...
4 years, 2 months ago (2016-10-05 15:25:34 UTC) #18
droger
Thanks, only nits. https://codereview.chromium.org/2396783002/diff/40001/chrome/browser/translate/chrome_translate_client.cc File chrome/browser/translate/chrome_translate_client.cc (right): https://codereview.chromium.org/2396783002/diff/40001/chrome/browser/translate/chrome_translate_client.cc#newcode54 chrome/browser/translate/chrome_translate_client.cc:54: web_contents->GetBrowserContext())) { DCHECK(language_model_) ? https://codereview.chromium.org/2396783002/diff/40001/chrome/browser/translate/language_model_factory.cc File ...
4 years, 2 months ago (2016-10-05 15:40:00 UTC) #19
jkrcal
Thanks, David! https://codereview.chromium.org/2396783002/diff/40001/chrome/browser/translate/chrome_translate_client.cc File chrome/browser/translate/chrome_translate_client.cc (right): https://codereview.chromium.org/2396783002/diff/40001/chrome/browser/translate/chrome_translate_client.cc#newcode54 chrome/browser/translate/chrome_translate_client.cc:54: web_contents->GetBrowserContext())) { On 2016/10/05 15:39:59, droger wrote: ...
4 years, 2 months ago (2016-10-06 08:50:58 UTC) #24
droger
lgtm
4 years, 2 months ago (2016-10-06 08:54:02 UTC) #25
Bernhard Bauer
https://codereview.chromium.org/2396783002/diff/60001/components/translate/core/browser/language_model.cc File components/translate/core/browser/language_model.cc (right): https://codereview.chromium.org/2396783002/diff/60001/components/translate/core/browser/language_model.cc#newcode22 components/translate/core/browser/language_model.cc:22: const float kCutoffRatio = 0.005f; Is the f necessary ...
4 years, 2 months ago (2016-10-06 08:58:49 UTC) #26
jkrcal
Thanks, Bernhard! Bernhard, I still need your lgtm for browser_prefs.cc. Paweł, could you PTAL at ...
4 years, 2 months ago (2016-10-06 09:38:37 UTC) #27
Bernhard Bauer
lgtm
4 years, 2 months ago (2016-10-06 12:29:54 UTC) #28
jkrcal
Elliot, since Paweł is not responding, could you PTAL at the new keyed_service dependency?
4 years, 2 months ago (2016-10-06 14:37:43 UTC) #30
Paweł Hajdan Jr.
LGTM w/nit https://codereview.chromium.org/2396783002/diff/80001/components/translate/core/browser/language_model.h File components/translate/core/browser/language_model.h (right): https://codereview.chromium.org/2396783002/diff/80001/components/translate/core/browser/language_model.h#newcode60 components/translate/core/browser/language_model.h:60: }; nit: Shouldn't this have DISALLOW_COPY_AND_ASSIGN?
4 years, 2 months ago (2016-10-06 14:42:49 UTC) #31
jkrcal
Thanks! https://codereview.chromium.org/2396783002/diff/80001/components/translate/core/browser/language_model.h File components/translate/core/browser/language_model.h (right): https://codereview.chromium.org/2396783002/diff/80001/components/translate/core/browser/language_model.h#newcode60 components/translate/core/browser/language_model.h:60: }; On 2016/10/06 14:42:48, Paweł Hajdan Jr. wrote: ...
4 years, 2 months ago (2016-10-06 14:50:10 UTC) #32
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/2396783002/100001
4 years, 2 months ago (2016-10-06 14:50:46 UTC) #35
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/238994)
4 years, 2 months ago (2016-10-06 16:23:55 UTC) #37
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/2396783002/140001
4 years, 2 months ago (2016-10-06 20:45:42 UTC) #40
commit-bot: I haz the power
Committed patchset #8 (id:140001)
4 years, 2 months ago (2016-10-06 21:54:06 UTC) #41
commit-bot: I haz the power
4 years, 2 months ago (2016-10-06 21:56:54 UTC) #43
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/c713e7093d3e93fabecd885f93c0522272325725
Cr-Commit-Position: refs/heads/master@{#423702}

Powered by Google App Engine
This is Rietveld 408576698