New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 619390 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Migrate IPCs to Mojo interfaces for components/translate

Project Member Reported by leon....@intel.com, Jun 12 2016

Issue description

Mojofication target: components/translate/content/common/translate_messages.h

Hi, sorry I cc all translate OWNERs here, to confirm whether it makes sense if I'd like to start this work now, to avoid the possible conflict that someone has been working for this.
If OK I'll prepare a CL for your review. Thanks.
 
As far as I know, no one in the OWNER plan to work on Mojo IPC migration.
But, groby@ and his team is the member who is actively working on Chrome Translate at this point. It may be better to wait for his answer.

Comment 2 by groby@chromium.org, Jun 13 2016

Her answer :)

I'm perfectly fine with migrating to Mojo. Is there a particular need driving this, or is this part of a general mojofication drive?

Also: If you expect this to take a bit, it'd probably be helpful if you could just share a quick sketch of the service interfaces you plan to implement.

Comment 3 by leon....@intel.com, Jun 14 2016

Cc: amistry@chromium.org
Yeah I think this should be part of the general mojofication drive, the overall issue is tracked by https://bugs.chromium.org/p/chromium/issues/detail?id=577685.
Also cc Anand here to help confirm whether there is any conflict.

The interfaces definition will be like: https://codereview.chromium.org/2066483004/diff/1/components/translate/content/common/translate.mojom
And, as currently translate IPCs only happen between Main RFH(Render Frame Host) and Main RF(Render Frame), the draft interfaces impl sketch will be:
1, Put mojom.ContentTranslateDriver interface impl into ContentTranslateDriver, which would be registered into the service registry of Main RFH via ChromeContentBrowserClient::RegisterRenderFrameMojoServices().
2, Put mojom.TranslateHelper interface impl into TranslateHelper, which would be registered into the service registry of Main RF via ChromeRenderFrameObserver constructor or TranslateHelper constructor by itself.

Thanks all~
I think you can do something more Mojo-y and do away with the page sequence numbers. I'm thinking something along the lines of:

interface Page {
  Translate(string translate_script, string source_lang, string target_lang)
     => (string original_lang, string translated_lang, TranslateErrorsType error_type);
  RevertTranslation();
};

interface TranslateDriver {
  NewPage(Page page, LanguageDetectionDetails, bool page_needs_translation);
};


What happens when there's a new page is that first, the renderer destroys its existing Page service, if it exists. Then once the page has loaded, it detects language, creates a new Page service and sends the client to the browser via NewPage(). The browser can then translate and revert via the Page interface. Of course, this is based on a cursory look at the translate messages and my understanding of it could be completly wrong.

Comment 5 by leon....@intel.com, Jun 17 2016

Owner: leon....@intel.com
Status: Assigned (was: Untriaged)
Thanks Anand very much for analysis and suggestion. I like the idea! I'll dig down some more and try to figure out a better world ;-)
Re #2: Oops, I'm very sorry groby@. I of course knew your name and photo, but account wasn't tied with them in my memory.

Comment 7 by groby@chromium.org, Jun 21 2016

toyoshim@ no worries - I do the same all the time. It's hard to match people and LDAPs :)

Comment 8 by leon....@intel.com, Jun 24 2016

Hi, I tried to understand the wholesale logic of translate and I want to confirm some of my understandings and thoughts about the mojofication work:
1,
Only one page is supposed to be involved into translation process at anytime, once page navigated away, no translation anymore. So I'm considering maybe we don't need to create a new Page interface impl for every page(in renderer side) as we'll have to kill previous one when creating a new one.
2,
The page sequence number is handled in translate/core logic, so this involves translate/ios/browser logic, there I saw some more logic concerned with the page sequence number.

So I think maybe we'd better do the mojofication still aligning with current logic to make sure everything run correctly. WDYT? Thanks.

Comment 9 by leon....@intel.com, Jul 4 2016

Finally I understood that Anand's suggestion for the mojom definition makes great sense. I'll start to prepare a CL.
Status: Started (was: Assigned)
Project Member

Comment 11 by bugdroid1@chromium.org, Aug 10 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3134fc62afcbbc25e0deeb674e5252be9f458d7b

commit 3134fc62afcbbc25e0deeb674e5252be9f458d7b
Author: leon.han <leon.han@intel.com>
Date: Wed Aug 10 07:25:58 2016

[Translate] Migrate IPCs to Mojo interfaces.

BUG= 619390 
TEST=browser_tests, unit_tests

Review-Url: https://codereview.chromium.org/2143383002
Cr-Commit-Position: refs/heads/master@{#410992}

[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/chrome/browser/BUILD.gn
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/chrome/browser/chrome_content_browser_client.cc
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/chrome/browser/translate/chrome_translate_client.cc
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/chrome/browser/translate/chrome_translate_client.h
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/chrome/renderer/chrome_render_frame_observer_browsertest.cc
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/chrome/renderer/translate/translate_helper_browsertest.cc
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate.gypi
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/DEPS
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/browser/BUILD.gn
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/browser/content_translate_driver.cc
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/browser/content_translate_driver.h
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/common/BUILD.gn
[add] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/common/DEPS
[add] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/common/OWNERS
[add] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/common/translate.mojom
[add] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/common/translate.typemap
[delete] https://crrev.com/0402b9c04ec0dcbced39310a641e7b4fd8adc758/components/translate/content/common/translate_messages.cc
[delete] https://crrev.com/0402b9c04ec0dcbced39310a641e7b4fd8adc758/components/translate/content/common/translate_messages.h
[add] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/common/translate_struct_traits.cc
[add] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/common/translate_struct_traits.h
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/renderer/BUILD.gn
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/renderer/DEPS
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/renderer/translate_helper.cc
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/translate/content/renderer/translate_helper.h
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/components/typemaps.gni
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/ipc/ipc_message_start.h
[modify] https://crrev.com/3134fc62afcbbc25e0deeb674e5252be9f458d7b/tools/ipc_fuzzer/message_lib/all_messages.h

Comment 12 by leon....@intel.com, Aug 16 2016

Status: Fixed (was: Started)

Sign in to add a comment