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

Issue 187393005: Make it possible to read CLD data from a file (Closed)

Created:
6 years, 9 months ago by Andrew Hayden (chromium.org)
Modified:
6 years, 9 months ago
CC:
chromium-reviews, aurimas (slooooooooow), Miguel Garcia
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Make it possible to read CLD data from a file. Note that this change DOES NOT "opt-in" any platform at this time, it merely makes it possible to read the CLD data in from a file if cld_version=2 and cld_dynamic=1. Subsequent changes will be required for platforms to "opt-in" to using this approach; e.g., each platform will have to generate their data file and package it appropriately before turning this feature on in compile flags. IMPORTANT: Can't be enabled on on Android until the SIGBUS in CLD is fixed: https://code.google.com/p/cld2/issues/detail?id=11 BUG=326023 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=259900

Patch Set 1 #

Patch Set 2 : Incrementally approaching a working implementation. #

Patch Set 3 : Now fully functional and debugged, but we need to package the file. #

Total comments: 27

Patch Set 4 : Rebase onto the CLD2 deps roll change, update readme #

Total comments: 10

Patch Set 5 : Address Marcus' and Jochen's comments #

Total comments: 39

Patch Set 6 : Fix typo in gyp file #

Patch Set 7 : Address Palmer's comments #

Patch Set 8 : toyoshim@'s comments #

Patch Set 9 : Hack around lack of common IsTranslatableURL #

Total comments: 15

Patch Set 10 : Rebase atop the cld_2 DEPS roll #

Patch Set 11 : Rebase onto latest master #

Total comments: 1

Patch Set 12 : Instantiate file lock lazily #

Patch Set 13 : Moar threadsafety #

Patch Set 14 : Rebase onto latest master (incl CLD2 size options commit) #

Patch Set 15 : Fix gyp grammar and missing comma #

Patch Set 16 : Rebase onto latest master #

Total comments: 43

Patch Set 17 : Rebase onto latest master #

Patch Set 18 : Address Marcus' comments #

Total comments: 40

Patch Set 19 : Add offset/length at Ulas' request #

Patch Set 20 : Address bulach@'s and palmer@'s comments #

Patch Set 21 : Use LazyInstance::Leaky for the mmap pointer #

Total comments: 4

Patch Set 22 : Marcus' comments, and "cld_dynamic"->"cld2_dynamic" #

Patch Set 23 : Guard static initialization with #ifdef #

Total comments: 3

Patch Set 24 : Consistently guard #includes with #ifdef #

Patch Set 25 : Final rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+686 lines, -5 lines) Patch
M build/common.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 5 chunks +14 lines, -1 line 0 comments Download
M chrome/browser/translate/translate_tab_helper.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 chunks +49 lines, -0 lines 0 comments Download
M chrome/browser/translate/translate_tab_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 4 chunks +175 lines, -0 lines 0 comments Download
M chrome/common/chrome_constants.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/chrome_constants.cc View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/render_messages.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +21 lines, -1 line 0 comments Download
M chrome/renderer/DEPS View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/renderer/chrome_render_view_observer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/renderer/translate/translate_helper.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 3 chunks +82 lines, -0 lines 0 comments Download
M chrome/renderer/translate/translate_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 8 chunks +186 lines, -1 line 0 comments Download
M third_party/cld_2/README.chromium View 1 2 3 1 chunk +39 lines, -0 lines 0 comments Download
M third_party/cld_2/cld_2.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +113 lines, -2 lines 0 comments Download

Messages

Total messages: 56 (0 generated)
Andrew Hayden (chromium.org)
https://codereview.chromium.org/187393005/diff/40001/build/common.gypi File build/common.gypi (right): https://codereview.chromium.org/187393005/diff/40001/build/common.gypi#newcode633 build/common.gypi:633: 'cld_dynamic%': 1, Make sure to disable dynamic mode on ...
6 years, 9 months ago (2014-03-11 17:03:10 UTC) #1
Andrew Hayden (chromium.org)
Hi folks, This patch is almost ready to land, and is now ready for some ...
6 years, 9 months ago (2014-03-11 17:06:57 UTC) #2
bulach
thanks andrew! a few initial comments below. I also added palmer@, better get the security ...
6 years, 9 months ago (2014-03-11 18:56:10 UTC) #3
Andrew Hayden (chromium.org)
https://codereview.chromium.org/187393005/diff/40001/chrome/renderer/translate/translate_helper.h File chrome/renderer/translate/translate_helper.h (right): https://codereview.chromium.org/187393005/diff/40001/chrome/renderer/translate/translate_helper.h#newcode166 chrome/renderer/translate/translate_helper.h:166: void DeferPageCaptured(const int page_id, const base::string16& contents); Needs a ...
6 years, 9 months ago (2014-03-12 09:15:48 UTC) #4
Andrew Hayden (chromium.org)
FWIW here is the review for the CLD2 roll, which is a prerequisite for landing ...
6 years, 9 months ago (2014-03-12 10:48:11 UTC) #5
Andrew Hayden (chromium.org)
+jochen for changes to constants
6 years, 9 months ago (2014-03-12 12:44:42 UTC) #6
jochen (gone - plz use gerrit)
constant changes lgtm also some nits https://codereview.chromium.org/187393005/diff/60001/build/common.gypi File build/common.gypi (right): https://codereview.chromium.org/187393005/diff/60001/build/common.gypi#newcode622 build/common.gypi:622: # 'cld_version%': 1, ...
6 years, 9 months ago (2014-03-12 13:08:27 UTC) #7
Andrew Hayden (chromium.org)
Addressing Marcus' comments, and will upload a new rev shortly. https://codereview.chromium.org/187393005/diff/40001/chrome/browser/translate/translate_tab_helper.cc File chrome/browser/translate/translate_tab_helper.cc (right): https://codereview.chromium.org/187393005/diff/40001/chrome/browser/translate/translate_tab_helper.cc#newcode147 ...
6 years, 9 months ago (2014-03-13 16:33:33 UTC) #8
Andrew Hayden (chromium.org)
Addressing jochen@'s comments. https://codereview.chromium.org/187393005/diff/60001/build/common.gypi File build/common.gypi (right): https://codereview.chromium.org/187393005/diff/60001/build/common.gypi#newcode622 build/common.gypi:622: # 'cld_version%': 1, On 2014/03/12 13:08:27, ...
6 years, 9 months ago (2014-03-13 16:39:48 UTC) #9
Andrew Hayden (chromium.org)
I have addressed all the issues raised and modified the commit comment quite heavily to ...
6 years, 9 months ago (2014-03-13 16:48:14 UTC) #10
Andrew Hayden (chromium.org)
I should note that the DEPS change is present here because I'm rebased on top ...
6 years, 9 months ago (2014-03-13 17:24:38 UTC) #11
palmer
https://codereview.chromium.org/187393005/diff/80001/chrome/browser/translate/translate_tab_helper.cc File chrome/browser/translate/translate_tab_helper.cc (right): https://codereview.chromium.org/187393005/diff/80001/chrome/browser/translate/translate_tab_helper.cc#newcode157 chrome/browser/translate/translate_tab_helper.cc:157: if (!s_file_lock_.Try()) return; // We'll get another request later, ...
6 years, 9 months ago (2014-03-13 17:59:50 UTC) #12
Takashi Toyoshima
https://codereview.chromium.org/187393005/diff/80001/chrome/renderer/translate/translate_helper.cc File chrome/renderer/translate/translate_helper.cc (right): https://codereview.chromium.org/187393005/diff/80001/chrome/renderer/translate/translate_helper.cc#newcode62 chrome/renderer/translate/translate_helper.cc:62: // finished.cld2_data_file = NULL; paste it mistakenly? https://codereview.chromium.org/187393005/diff/80001/chrome/renderer/translate/translate_helper.cc#newcode98 chrome/renderer/translate/translate_helper.cc:98: ...
6 years, 9 months ago (2014-03-13 18:37:36 UTC) #13
Andrew Hayden (chromium.org)
toyoshim@: Thanks for finding IsTranslatableURL! That's exactly what I want, you're right. I see no ...
6 years, 9 months ago (2014-03-13 23:17:39 UTC) #14
Andrew Hayden (chromium.org)
Addressed Palmer's comments. Next up toyoshim@'s comments. Thanks for the attention to detail, guys. https://codereview.chromium.org/187393005/diff/80001/chrome/browser/translate/translate_tab_helper.cc ...
6 years, 9 months ago (2014-03-13 23:20:20 UTC) #15
Andrew Hayden (chromium.org)
Everything from toyoshim@'s comments EXCEPT using isTranslatableURL. I'll get that momentarily. https://codereview.chromium.org/187393005/diff/80001/chrome/renderer/translate/translate_helper.cc File chrome/renderer/translate/translate_helper.cc (right): ...
6 years, 9 months ago (2014-03-14 10:10:51 UTC) #16
Andrew Hayden (chromium.org)
toyoshim@: Can you explain why in IsTranslatableURL we only exclude extensions if CHROMEOS is defined? ...
6 years, 9 months ago (2014-03-14 10:28:38 UTC) #17
Andrew Hayden (chromium.org)
So, I looked into the IsTranslatableURL work. It will require not just moving the function ...
6 years, 9 months ago (2014-03-14 10:47:22 UTC) #18
Andrew Hayden (chromium.org)
Filed https://code.google.com/p/chromium/issues/detail?id=352578 to track the refactor of IsTranslatableURL, which can be independent of this change.
6 years, 9 months ago (2014-03-14 10:54:57 UTC) #19
Takashi Toyoshima
> toyoshim@: Can you explain why in IsTranslatableURL we only exclude extensions > if CHROMEOS ...
6 years, 9 months ago (2014-03-14 11:51:12 UTC) #20
Takashi Toyoshima
Ah, if you want to discuss IsTranslatableURL() in separate CL, this change LGTM on translate.
6 years, 9 months ago (2014-03-14 11:52:38 UTC) #21
Andrew Hayden (chromium.org)
Great! Thanks to everyone for the time and attention on this. I've submitted the CLD2 ...
6 years, 9 months ago (2014-03-14 13:21:34 UTC) #22
Andrew Hayden (chromium.org)
I note that Palmer didn't LGTM, so I'll also wait for a review from security ...
6 years, 9 months ago (2014-03-14 13:32:40 UTC) #23
bulach
https://codereview.chromium.org/187393005/diff/150001/chrome/browser/translate/translate_tab_helper.cc File chrome/browser/translate/translate_tab_helper.cc (right): https://codereview.chromium.org/187393005/diff/150001/chrome/browser/translate/translate_tab_helper.cc#newcode39 chrome/browser/translate/translate_tab_helper.cc:39: base::PlatformFile TranslateTabHelper::s_cached_platform_file_ = 0; nit: NULL is probably cleaerer ...
6 years, 9 months ago (2014-03-14 15:30:58 UTC) #24
bulach
https://codereview.chromium.org/187393005/diff/150001/chrome/browser/translate/translate_tab_helper.cc File chrome/browser/translate/translate_tab_helper.cc (right): https://codereview.chromium.org/187393005/diff/150001/chrome/browser/translate/translate_tab_helper.cc#newcode176 chrome/browser/translate/translate_tab_helper.cc:176: weak_pointer_factory_.GetWeakPtr())); On 2014/03/14 15:30:58, bulach wrote: > hmm... WeakPtr ...
6 years, 9 months ago (2014-03-19 11:18:50 UTC) #25
Andrew Hayden (chromium.org)
Partial answer to Marcus' comments about the locking. Regarding the weakptr stuff, I'll reconsider based ...
6 years, 9 months ago (2014-03-19 12:22:22 UTC) #26
Philippe
https://codereview.chromium.org/187393005/diff/190001/chrome/browser/translate/translate_tab_helper.h File chrome/browser/translate/translate_tab_helper.h (right): https://codereview.chromium.org/187393005/diff/190001/chrome/browser/translate/translate_tab_helper.h#newcode132 chrome/browser/translate/translate_tab_helper.h:132: static base::Lock s_file_lock_; JFYI, this static member would generate ...
6 years, 9 months ago (2014-03-19 16:42:34 UTC) #27
Andrew Hayden (chromium.org)
Marcus's remaining comments from previous patchsets around lazy pointer. https://codereview.chromium.org/187393005/diff/150001/chrome/browser/translate/translate_tab_helper.cc File chrome/browser/translate/translate_tab_helper.cc (right): https://codereview.chromium.org/187393005/diff/150001/chrome/browser/translate/translate_tab_helper.cc#newcode39 chrome/browser/translate/translate_tab_helper.cc:39: ...
6 years, 9 months ago (2014-03-20 16:12:52 UTC) #28
Andrew Hayden (chromium.org)
On 2014/03/19 16:42:34, Philippe wrote: > https://codereview.chromium.org/187393005/diff/190001/chrome/browser/translate/translate_tab_helper.h > File chrome/browser/translate/translate_tab_helper.h (right): > > https://codereview.chromium.org/187393005/diff/190001/chrome/browser/translate/translate_tab_helper.h#newcode132 > ...
6 years, 9 months ago (2014-03-20 16:24:44 UTC) #29
Andrew Hayden (chromium.org)
On 2014/03/19 11:18:50, bulach wrote: > https://codereview.chromium.org/187393005/diff/150001/chrome/browser/translate/translate_tab_helper.cc > File chrome/browser/translate/translate_tab_helper.cc (right): > > https://codereview.chromium.org/187393005/diff/150001/chrome/browser/translate/translate_tab_helper.cc#newcode176 > ...
6 years, 9 months ago (2014-03-20 16:25:26 UTC) #30
Andrew Hayden (chromium.org)
Threadsafety issues proactively addressed. Thanks, Marcus. OK, as far as I'm concerned at this point ...
6 years, 9 months ago (2014-03-20 17:22:33 UTC) #31
Andrew Hayden (chromium.org)
Important note: This patch will work on Linux desktops, but it will crash when cld_dynamic ...
6 years, 9 months ago (2014-03-21 19:25:45 UTC) #32
ulas
https://codereview.chromium.org/187393005/diff/280001/chrome/browser/translate/translate_tab_helper.cc File chrome/browser/translate/translate_tab_helper.cc (right): https://codereview.chromium.org/187393005/diff/280001/chrome/browser/translate/translate_tab_helper.cc#newcode212 chrome/browser/translate/translate_tab_helper.cc:212: handle, Pls also allow offset+length for flexibility. Perhaps the ...
6 years, 9 months ago (2014-03-21 21:08:31 UTC) #33
bulach
thanks andrew! I'm not an owner in any of these files, but a few more ...
6 years, 9 months ago (2014-03-23 20:57:01 UTC) #34
Andrew Hayden (chromium.org)
All of Marcus' comments addressed. Marcus, PTYAL. https://codereview.chromium.org/187393005/diff/280001/build/common.gypi File build/common.gypi (right): https://codereview.chromium.org/187393005/diff/280001/build/common.gypi#newcode428 build/common.gypi:428: # Only ...
6 years, 9 months ago (2014-03-24 15:18:24 UTC) #35
Andrew Hayden (chromium.org)
Compiled this all up and verified that it continues to work as expected on Android ...
6 years, 9 months ago (2014-03-24 15:26:49 UTC) #36
palmer
IPC security LGTM but some concerns remain. Why the src/internal? https://codereview.chromium.org/187393005/diff/320001/chrome/browser/translate/translate_tab_helper.cc File chrome/browser/translate/translate_tab_helper.cc (right): https://codereview.chromium.org/187393005/diff/320001/chrome/browser/translate/translate_tab_helper.cc#newcode200 ...
6 years, 9 months ago (2014-03-24 19:01:47 UTC) #37
bulach
lgtm but I'm not in the OWNERS, thanks andrew! mostly nits and some more suggestions ...
6 years, 9 months ago (2014-03-25 09:29:25 UTC) #38
Andrew Hayden (chromium.org)
Answering Palmer's and Marcus' comments. Outstanding issues: 1. Do we need a fuzzer for CLD2? ...
6 years, 9 months ago (2014-03-26 15:34:10 UTC) #39
Andrew Hayden (chromium.org)
Marcus, Palmer, PTAL. I believe I've addressed all your concerns now.
6 years, 9 months ago (2014-03-26 16:42:18 UTC) #40
Andrew Hayden (chromium.org)
PS - thanks to Marcus for the excellent example on using LazyInstance::Leaky. This code is ...
6 years, 9 months ago (2014-03-26 16:42:58 UTC) #41
bulach
still lgtm, just tiny nits.. https://codereview.chromium.org/187393005/diff/280001/build/common.gypi File build/common.gypi (right): https://codereview.chromium.org/187393005/diff/280001/build/common.gypi#newcode428 build/common.gypi:428: # Only evaluated if ...
6 years, 9 months ago (2014-03-26 19:06:45 UTC) #42
gubalav
6 years, 9 months ago (2014-03-27 06:00:09 UTC) #43
gubalav
6 years, 9 months ago (2014-03-27 06:00:09 UTC) #44
andrewhayden
And the >80 cols thing was fixed till I "git checkout"'d my common.gypi file again, ...
6 years, 9 months ago (2014-03-27 09:36:58 UTC) #45
Philippe
https://chromiumcodereview.appspot.com/187393005/diff/440001/chrome/renderer/translate/translate_helper.cc File chrome/renderer/translate/translate_helper.cc (right): https://chromiumcodereview.appspot.com/187393005/diff/440001/chrome/renderer/translate/translate_helper.cc#newcode666 chrome/renderer/translate/translate_helper.cc:666: uint64 max_int32 = (static_cast<uint64>(1) << 31) - 1; Nit: ...
6 years, 9 months ago (2014-03-27 09:52:25 UTC) #46
Philippe
https://chromiumcodereview.appspot.com/187393005/diff/440001/chrome/renderer/translate/translate_helper.cc File chrome/renderer/translate/translate_helper.cc (right): https://chromiumcodereview.appspot.com/187393005/diff/440001/chrome/renderer/translate/translate_helper.cc#newcode666 chrome/renderer/translate/translate_helper.cc:666: uint64 max_int32 = (static_cast<uint64>(1) << 31) - 1; On ...
6 years, 9 months ago (2014-03-27 09:52:57 UTC) #47
andrewhayden
https://chromiumcodereview.appspot.com/187393005/diff/440001/chrome/renderer/translate/translate_helper.cc File chrome/renderer/translate/translate_helper.cc (right): https://chromiumcodereview.appspot.com/187393005/diff/440001/chrome/renderer/translate/translate_helper.cc#newcode666 chrome/renderer/translate/translate_helper.cc:666: uint64 max_int32 = (static_cast<uint64>(1) << 31) - 1; On ...
6 years, 9 months ago (2014-03-27 10:41:43 UTC) #48
andrewhayden
Final version, as far as I'm concerned. Everything appears to work on Android and Linux, ...
6 years, 9 months ago (2014-03-27 10:43:33 UTC) #49
andrewhayden
The CQ bit was checked by andrewhayden@google.com
6 years, 9 months ago (2014-03-27 11:01:19 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/andrewhayden@chromium.org/187393005/470001
6 years, 9 months ago (2014-03-27 11:01:27 UTC) #51
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-27 13:28:34 UTC) #52
commit-bot: I haz the power
Retried try job too often on win_rel for step(s) base_unittests, browser_tests, interactive_ui_tests, net_unittests, unit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_rel&number=289340
6 years, 9 months ago (2014-03-27 13:28:34 UTC) #53
Andrew Hayden (chromium.org)
The CQ bit was checked by andrewhayden@chromium.org
6 years, 9 months ago (2014-03-27 13:34:25 UTC) #54
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/andrewhayden@chromium.org/187393005/470001
6 years, 9 months ago (2014-03-27 13:34:44 UTC) #55
commit-bot: I haz the power
6 years, 9 months ago (2014-03-27 16:16:06 UTC) #56
Message was sent while issue was closed.
Change committed as 259900

Powered by Google App Engine
This is Rietveld 408576698