|
|
Created:
4 years, 6 months ago by leonhsl(Using Gerrit) Modified:
4 years, 3 months ago Reviewers:
Ken Rockot(use gerrit already), jochen (gone - plz use gerrit), jam, dcheng, Sam McNally, tbansal1, agl, Anand Mistry (off Chromium) CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, blundell+watchlist_chromium.org, cbentzel+watch_chromium.org, chromium-reviews, darin (slow to review), darin-cc_chromium.org, droger+watchlist_chromium.org, qsr+mojo_chromium.org, sdefresne+watchlist_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionMigrate components/data_reduction_proxy to Mojo interfaces.
This CL also adds typemapping for net::HostPortPair.
BUG=577685
TEST=components_unittests --gtest_filter=DataReductionProxyHostImplTest*
Patch Set 1 : No gyp #Patch Set 2 : Add unit tests #Patch Set 3 : Add gyp #
Total comments: 3
Patch Set 4 : Rebase and move AddService call into RegisterRenderProcessMojoServices() #
Total comments: 7
Patch Set 5 : Avoid using DataReductionProxySettings on IO thread #Patch Set 6 : Rebase and add OWNERS file for security review #Patch Set 7 : Let DataReductionProxyHostImpl be a RenderProcessHostObserver #Patch Set 8 : Fix unit tests #Patch Set 9 : Add missing header file casued by another CL #Patch Set 10 : Fix trybots failure #
Total comments: 16
Patch Set 11 : Address comments from Anand #Patch Set 12 : Rebase only #Patch Set 13 : Use BindingSet instead of Binding #Patch Set 14 : Rebase only #
Total comments: 2
Patch Set 15 : Observe RenderProcessExited instead #Patch Set 16 : Rebase only #Patch Set 17 : Rebase only #
Total comments: 10
Patch Set 18 : Rebase and fix trybots #Patch Set 19 : Address comments from Daniel #Patch Set 20 : Fix unit tests #
Total comments: 8
Patch Set 21 : Address comments from tbansal1 #Patch Set 22 : Fix unit test #Patch Set 23 : Rebase only #Patch Set 24 : Rebase only #Patch Set 25 : Eliminate usage of RPH observer #
Total comments: 4
Messages
Total messages: 164 (79 generated)
leon.han@intel.com changed reviewers: + agl@chromium.org, amistry@chromium.org, megjablon@chromium.org
Hi, would you PTAL at this? If overall OK, I'll add gyp and unittest codes later. Thanks. amistry@: Mojo related overall megjablon@: OWNER review for data_reduction_proxy agl@: OWNER review for net
Rubber stamp LGTM for net/ if Mojo reviewers agree that this is correct.
Description was changed from ========== Migrate components/data_reduction_proxy to Mojo interfaces. This CL also adds typemapping for net::HostPortPair. BUG=577685 ========== to ========== Migrate components/data_reduction_proxy to Mojo interfaces. This CL also adds typemapping for net::HostPortPair. BUG=577685 TEST=components_unittests --gtest_filter=DataReductionProxyHostImplTest* ==========
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2063683002/40001
leon.han@intel.com changed reviewers: + sammc@chromium.org
+sammc@ Hi, Anand, Sam, would you PTAL at this CL and my inline question? Thanks. https://codereview.chromium.org/2063683002/diff/40001/chrome/browser/chrome_c... File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/2063683002/diff/40001/chrome/browser/chrome_c... chrome/browser/chrome_content_browser_client.cc:994: host->GetServiceRegistry()->AddService( Instead of here I think it's better to put the AddService call into ChromeContentBrowserClient::RegisterRenderProcessMojoServices(service_registry), but there we can't get the target RPH, which is necessary to get the attached DataReductionProxyChromeSettings instance. So how about we add one more parameter(the RPH) to the original function declaration, just as: ContentBrowserClient::RegisterRenderProcessMojoServices(service_registry, render_process_host)? This way will enable bind some RPH-specific information. WDYT?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Just responding to the question. Haven't had a chance to review yet. https://codereview.chromium.org/2063683002/diff/40001/chrome/browser/chrome_c... File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/2063683002/diff/40001/chrome/browser/chrome_c... chrome/browser/chrome_content_browser_client.cc:994: host->GetServiceRegistry()->AddService( On 2016/06/14 10:16:48, leonhsl wrote: > Instead of here I think it's better to put the AddService call into > ChromeContentBrowserClient::RegisterRenderProcessMojoServices(service_registry), > but there we can't get the target RPH, which is necessary to get the attached > DataReductionProxyChromeSettings instance. > So how about we add one more parameter(the RPH) to the original function > declaration, just as: > ContentBrowserClient::RegisterRenderProcessMojoServices(service_registry, > render_process_host)? This way will enable bind some RPH-specific information. > WDYT? I think that's reasonable given that the RenderFrameHost equivalent provides the host. I suggest doing it as a separate CL since it's orthogonal to this one and likely to be reviewed faster.
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2063683002/60001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Uploaded ps#4. https://codereview.chromium.org/2063683002/diff/40001/chrome/browser/chrome_c... File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/2063683002/diff/40001/chrome/browser/chrome_c... chrome/browser/chrome_content_browser_client.cc:994: host->GetServiceRegistry()->AddService( On 2016/06/15 08:09:40, Anand Mistry wrote: > On 2016/06/14 10:16:48, leonhsl wrote: > > Instead of here I think it's better to put the AddService call into > > > ChromeContentBrowserClient::RegisterRenderProcessMojoServices(service_registry), > > but there we can't get the target RPH, which is necessary to get the attached > > DataReductionProxyChromeSettings instance. > > So how about we add one more parameter(the RPH) to the original function > > declaration, just as: > > ContentBrowserClient::RegisterRenderProcessMojoServices(service_registry, > > render_process_host)? This way will enable bind some RPH-specific information. > > WDYT? > > I think that's reasonable given that the RenderFrameHost equivalent provides the > host. I suggest doing it as a separate CL since it's orthogonal to this one and > likely to be reviewed faster. Done. A separate CL https://codereview.chromium.org/2060943005/ has been landed and for this CL moved AddService call into ChromeContentBrowserClient::RegisterRenderProcessMojoServices(). Thanks!
https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h (right): https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:37: // Must outlive |this|. May be null. How can you guarantee this? The legacy IPC achieved this because the message filter is attached to the RenderProcessHost and will be destroyed when the RPH is gone. I'm assuming the RPH outlives the Profile. However, this class's lifecycle is disconnected from the RPH and instead governed by the life of the message pipe.
https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h (right): https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:37: // Must outlive |this|. May be null. On 2016/06/16 09:04:04, Anand Mistry wrote: > How can you guarantee this? The legacy IPC achieved this because the message > filter is attached to the RenderProcessHost and will be destroyed when the RPH > is gone. I'm assuming the RPH outlives the Profile. However, this class's > lifecycle is disconnected from the RPH and instead governed by the life of the > message pipe. Yeah it is, the lifecycle is the difference with before. Thanks a lot for pointing out this. I investigated around and I think we may have 2 options now: 1, Just for current use case, client side(PageLoadHistograms::Dump() on renderer thread) executes "Connect-->Sync call-->Disconnect" all at once, message pipe lifetime is just this timeslot, and the same to DataReductionProxyHostImpl, while within this timeslot the browser side RPH should just be keeping alive(because renderer thread is running one task). This means we're still achieving "RPH outlives DataReductionProxyHostImpl", so should have no problem.. Maybe I'm saying something stupid,, but just my understanding now ;-) 2, Let DataReductionProxyHostImpl be a RPH observer so that it can connect lifecycle with RPH. Once got RPH destroyed notification, post a task to IO thread to delete itself. WDYT? Thanks. If option1 is nonsense, I'll try option2.
https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc (right): https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:28: config_ = settings->Config(); DataReductionProxySettings can only be used on the UI thread. https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h (right): https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:37: // Must outlive |this|. May be null. On 2016/06/17 08:43:57, leonhsl wrote: > On 2016/06/16 09:04:04, Anand Mistry wrote: > > How can you guarantee this? The legacy IPC achieved this because the message > > filter is attached to the RenderProcessHost and will be destroyed when the RPH > > is gone. I'm assuming the RPH outlives the Profile. However, this class's > > lifecycle is disconnected from the RPH and instead governed by the life of the > > message pipe. > > Yeah it is, the lifecycle is the difference with before. Thanks a lot for > pointing out this. I investigated around and I think we may have 2 options now: > 1, > Just for current use case, client side(PageLoadHistograms::Dump() on renderer > thread) executes "Connect-->Sync call-->Disconnect" all at once, message pipe > lifetime is just this timeslot, and the same to DataReductionProxyHostImpl, > while within this timeslot the browser side RPH should just be keeping > alive(because renderer thread is running one task). This means we're still > achieving "RPH outlives DataReductionProxyHostImpl", so should have no problem.. > Maybe I'm saying something stupid,, but just my understanding now ;-) > 2, > Let DataReductionProxyHostImpl be a RPH observer so that it can connect > lifecycle with RPH. Once got RPH destroyed notification, post a task to IO > thread to delete itself. > > WDYT? Thanks. If option1 is nonsense, I'll try option2. The lifetime in the renderer doesn't directly correspond to lifetime in the browser. IsDataReductionProxy() won't be called synchronously when the pipe is bound and neither will the disconnect. On the other hand, using a RenderProcessHostObserver would be messy at destruction time if the StrongBinding still lives on the IO thread as the UI and IO threads could both decide to delete this at the same time.
https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc (right): https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:28: config_ = settings->Config(); On 2016/06/20 04:57:26, Sam McNally wrote: > DataReductionProxySettings can only be used on the UI thread. Oh yes, we can pass settings->Config() instead of settings into the constructor. https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h (right): https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:37: // Must outlive |this|. May be null. On 2016/06/20 04:57:26, Sam McNally wrote: > On 2016/06/17 08:43:57, leonhsl wrote: > > On 2016/06/16 09:04:04, Anand Mistry wrote: > > > How can you guarantee this? The legacy IPC achieved this because the message > > > filter is attached to the RenderProcessHost and will be destroyed when the > RPH > > > is gone. I'm assuming the RPH outlives the Profile. However, this class's > > > lifecycle is disconnected from the RPH and instead governed by the life of > the > > > message pipe. > > > > Yeah it is, the lifecycle is the difference with before. Thanks a lot for > > pointing out this. I investigated around and I think we may have 2 options > now: > > 1, > > Just for current use case, client side(PageLoadHistograms::Dump() on renderer > > thread) executes "Connect-->Sync call-->Disconnect" all at once, message pipe > > lifetime is just this timeslot, and the same to DataReductionProxyHostImpl, > > while within this timeslot the browser side RPH should just be keeping > > alive(because renderer thread is running one task). This means we're still > > achieving "RPH outlives DataReductionProxyHostImpl", so should have no > problem.. > > Maybe I'm saying something stupid,, but just my understanding now ;-) > > 2, > > Let DataReductionProxyHostImpl be a RPH observer so that it can connect > > lifecycle with RPH. Once got RPH destroyed notification, post a task to IO > > thread to delete itself. > > > > WDYT? Thanks. If option1 is nonsense, I'll try option2. > > The lifetime in the renderer doesn't directly correspond to lifetime in the > browser. IsDataReductionProxy() won't be called synchronously when the pipe is > bound and neither will the disconnect. > > On the other hand, using a RenderProcessHostObserver would be messy at > destruction time if the StrongBinding still lives on the IO thread as the UI and > IO threads could both decide to delete this at the same time. Option1, I think the renderer thread will block on calling IsDataReductionProxy() until pipe bound and IsDataReductionProxy() execution returned in browser side. Within this timeslot, browser side RPH should be alive and DataReductionProxyConfig should be guaranteed available. Option2, yes it would be messy and hard to solve the race. Let me think more..
On 2016/06/20 10:51:51, leonhsl wrote: > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > File > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc > (right): > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:28: > config_ = settings->Config(); > On 2016/06/20 04:57:26, Sam McNally wrote: > > DataReductionProxySettings can only be used on the UI thread. > > Oh yes, we can pass settings->Config() instead of settings into the constructor. > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > File > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h > (right): > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:37: > // Must outlive |this|. May be null. > On 2016/06/20 04:57:26, Sam McNally wrote: > > On 2016/06/17 08:43:57, leonhsl wrote: > > > On 2016/06/16 09:04:04, Anand Mistry wrote: > > > > How can you guarantee this? The legacy IPC achieved this because the > message > > > > filter is attached to the RenderProcessHost and will be destroyed when the > > RPH > > > > is gone. I'm assuming the RPH outlives the Profile. However, this class's > > > > lifecycle is disconnected from the RPH and instead governed by the life of > > the > > > > message pipe. > > > > > > Yeah it is, the lifecycle is the difference with before. Thanks a lot for > > > pointing out this. I investigated around and I think we may have 2 options > > now: > > > 1, > > > Just for current use case, client side(PageLoadHistograms::Dump() on > renderer > > > thread) executes "Connect-->Sync call-->Disconnect" all at once, message > pipe > > > lifetime is just this timeslot, and the same to DataReductionProxyHostImpl, > > > while within this timeslot the browser side RPH should just be keeping > > > alive(because renderer thread is running one task). This means we're still > > > achieving "RPH outlives DataReductionProxyHostImpl", so should have no > > problem.. > > > Maybe I'm saying something stupid,, but just my understanding now ;-) > > > 2, > > > Let DataReductionProxyHostImpl be a RPH observer so that it can connect > > > lifecycle with RPH. Once got RPH destroyed notification, post a task to IO > > > thread to delete itself. > > > > > > WDYT? Thanks. If option1 is nonsense, I'll try option2. > > > > The lifetime in the renderer doesn't directly correspond to lifetime in the > > browser. IsDataReductionProxy() won't be called synchronously when the pipe is > > bound and neither will the disconnect. > > > > On the other hand, using a RenderProcessHostObserver would be messy at > > destruction time if the StrongBinding still lives on the IO thread as the UI > and > > IO threads could both decide to delete this at the same time. > > Option1, I think the renderer thread will block on calling > IsDataReductionProxy() until pipe bound and IsDataReductionProxy() execution > returned in browser side. Within this timeslot, browser side RPH should be alive > and DataReductionProxyConfig should be guaranteed available. What you say only applies to the renderer process. If the profile in the browser is shut down right after the renderer sends that IPC, you may end up in a situation where the browser may receive and start processing that IPC after the profile and RPH has been deleted. This is because the binding lifecycle isn't bound in any way to the RPH. And receipt of the IPC does NOT imply the renderer is still alive. > > Option2, yes it would be messy and hard to solve the race. Let me think more..
On 2016/06/20 11:18:17, Anand Mistry wrote: > On 2016/06/20 10:51:51, leonhsl wrote: > > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > > File > > > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc > > (right): > > > > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > > > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:28: > > config_ = settings->Config(); > > On 2016/06/20 04:57:26, Sam McNally wrote: > > > DataReductionProxySettings can only be used on the UI thread. > > > > Oh yes, we can pass settings->Config() instead of settings into the > constructor. > > > > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > > File > > > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h > > (right): > > > > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > > > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:37: > > // Must outlive |this|. May be null. > > On 2016/06/20 04:57:26, Sam McNally wrote: > > > On 2016/06/17 08:43:57, leonhsl wrote: > > > > On 2016/06/16 09:04:04, Anand Mistry wrote: > > > > > How can you guarantee this? The legacy IPC achieved this because the > > message > > > > > filter is attached to the RenderProcessHost and will be destroyed when > the > > > RPH > > > > > is gone. I'm assuming the RPH outlives the Profile. However, this > class's > > > > > lifecycle is disconnected from the RPH and instead governed by the life > of > > > the > > > > > message pipe. > > > > > > > > Yeah it is, the lifecycle is the difference with before. Thanks a lot for > > > > pointing out this. I investigated around and I think we may have 2 options > > > now: > > > > 1, > > > > Just for current use case, client side(PageLoadHistograms::Dump() on > > renderer > > > > thread) executes "Connect-->Sync call-->Disconnect" all at once, message > > pipe > > > > lifetime is just this timeslot, and the same to > DataReductionProxyHostImpl, > > > > while within this timeslot the browser side RPH should just be keeping > > > > alive(because renderer thread is running one task). This means we're still > > > > achieving "RPH outlives DataReductionProxyHostImpl", so should have no > > > problem.. > > > > Maybe I'm saying something stupid,, but just my understanding now ;-) > > > > 2, > > > > Let DataReductionProxyHostImpl be a RPH observer so that it can connect > > > > lifecycle with RPH. Once got RPH destroyed notification, post a task to IO > > > > thread to delete itself. > > > > > > > > WDYT? Thanks. If option1 is nonsense, I'll try option2. > > > > > > The lifetime in the renderer doesn't directly correspond to lifetime in the > > > browser. IsDataReductionProxy() won't be called synchronously when the pipe > is > > > bound and neither will the disconnect. > > > > > > On the other hand, using a RenderProcessHostObserver would be messy at > > > destruction time if the StrongBinding still lives on the IO thread as the UI > > and > > > IO threads could both decide to delete this at the same time. > > > > Option1, I think the renderer thread will block on calling > > IsDataReductionProxy() until pipe bound and IsDataReductionProxy() execution > > returned in browser side. Within this timeslot, browser side RPH should be > alive > > and DataReductionProxyConfig should be guaranteed available. > > What you say only applies to the renderer process. If the profile in the browser > is shut down right after the renderer sends that IPC, you may end up in a > situation where the browser may receive and start processing that IPC after the > profile and RPH has been deleted. This is because the binding lifecycle isn't > bound in any way to the RPH. And receipt of the IPC does NOT imply the renderer > is still alive. > If that scenario happened, as RPH has already been deleted, so RPH's service registry has also disappeared, that means DataReductionProxyHost interface connection itself can't be established. This result is similar with legacy IPC, RPH disappeared, so did browser message filter, then received IsDataReductionProxy IPC will just be ignored. > > > > Option2, yes it would be messy and hard to solve the race. Let me think more..
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2063683002/80001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presub...)
On 2016/06/20 14:26:57, leonhsl wrote: > On 2016/06/20 11:18:17, Anand Mistry wrote: > > On 2016/06/20 10:51:51, leonhsl wrote: > > > > > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > > > File > > > > > > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc > > > (right): > > > > > > > > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > > > > > > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:28: > > > config_ = settings->Config(); > > > On 2016/06/20 04:57:26, Sam McNally wrote: > > > > DataReductionProxySettings can only be used on the UI thread. > > > > > > Oh yes, we can pass settings->Config() instead of settings into the > > constructor. > > > > > > > > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > > > File > > > > > > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h > > > (right): > > > > > > > > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > > > > > > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:37: > > > // Must outlive |this|. May be null. > > > On 2016/06/20 04:57:26, Sam McNally wrote: > > > > On 2016/06/17 08:43:57, leonhsl wrote: > > > > > On 2016/06/16 09:04:04, Anand Mistry wrote: > > > > > > How can you guarantee this? The legacy IPC achieved this because the > > > message > > > > > > filter is attached to the RenderProcessHost and will be destroyed when > > the > > > > RPH > > > > > > is gone. I'm assuming the RPH outlives the Profile. However, this > > class's > > > > > > lifecycle is disconnected from the RPH and instead governed by the > life > > of > > > > the > > > > > > message pipe. > > > > > > > > > > Yeah it is, the lifecycle is the difference with before. Thanks a lot > for > > > > > pointing out this. I investigated around and I think we may have 2 > options > > > > now: > > > > > 1, > > > > > Just for current use case, client side(PageLoadHistograms::Dump() on > > > renderer > > > > > thread) executes "Connect-->Sync call-->Disconnect" all at once, message > > > pipe > > > > > lifetime is just this timeslot, and the same to > > DataReductionProxyHostImpl, > > > > > while within this timeslot the browser side RPH should just be keeping > > > > > alive(because renderer thread is running one task). This means we're > still > > > > > achieving "RPH outlives DataReductionProxyHostImpl", so should have no > > > > problem.. > > > > > Maybe I'm saying something stupid,, but just my understanding now ;-) > > > > > 2, > > > > > Let DataReductionProxyHostImpl be a RPH observer so that it can connect > > > > > lifecycle with RPH. Once got RPH destroyed notification, post a task to > IO > > > > > thread to delete itself. > > > > > > > > > > WDYT? Thanks. If option1 is nonsense, I'll try option2. > > > > > > > > The lifetime in the renderer doesn't directly correspond to lifetime in > the > > > > browser. IsDataReductionProxy() won't be called synchronously when the > pipe > > is > > > > bound and neither will the disconnect. > > > > > > > > On the other hand, using a RenderProcessHostObserver would be messy at > > > > destruction time if the StrongBinding still lives on the IO thread as the > UI > > > and > > > > IO threads could both decide to delete this at the same time. > > > > > > Option1, I think the renderer thread will block on calling > > > IsDataReductionProxy() until pipe bound and IsDataReductionProxy() execution > > > returned in browser side. Within this timeslot, browser side RPH should be > > alive > > > and DataReductionProxyConfig should be guaranteed available. > > > > What you say only applies to the renderer process. If the profile in the > browser > > is shut down right after the renderer sends that IPC, you may end up in a > > situation where the browser may receive and start processing that IPC after > the > > profile and RPH has been deleted. This is because the binding lifecycle isn't > > bound in any way to the RPH. And receipt of the IPC does NOT imply the > renderer > > is still alive. > > > > If that scenario happened, as RPH has already been deleted, so RPH's service > registry has also disappeared, that means DataReductionProxyHost interface > connection itself can't be established. This result is similar with legacy IPC, > RPH disappeared, so did browser message filter, then received > IsDataReductionProxy IPC will just be ignored. Nope. The RPH can be deleted after the impl has been created, but before a method is called. This is good argument that StrongBinding<> is not appropriate here because the lifecycle isn't disconnected from the RPH (or profile). StrongBinding<> only works for things where the lifecycle of the impl is decoupled from anything else. > > > > > > > Option2, yes it would be messy and hard to solve the race. Let me think > more..
On 2016/06/22 05:49:26, Anand Mistry wrote: > On 2016/06/20 14:26:57, leonhsl wrote: > > On 2016/06/20 11:18:17, Anand Mistry wrote: > > > On 2016/06/20 10:51:51, leonhsl wrote: > > > > > > > > > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > > > > File > > > > > > > > > > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc > > > > (right): > > > > > > > > > > > > > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > > > > > > > > > > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:28: > > > > config_ = settings->Config(); > > > > On 2016/06/20 04:57:26, Sam McNally wrote: > > > > > DataReductionProxySettings can only be used on the UI thread. > > > > > > > > Oh yes, we can pass settings->Config() instead of settings into the > > > constructor. > > > > > > > > > > > > > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > > > > File > > > > > > > > > > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h > > > > (right): > > > > > > > > > > > > > > https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... > > > > > > > > > > components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:37: > > > > // Must outlive |this|. May be null. > > > > On 2016/06/20 04:57:26, Sam McNally wrote: > > > > > On 2016/06/17 08:43:57, leonhsl wrote: > > > > > > On 2016/06/16 09:04:04, Anand Mistry wrote: > > > > > > > How can you guarantee this? The legacy IPC achieved this because the > > > > message > > > > > > > filter is attached to the RenderProcessHost and will be destroyed > when > > > the > > > > > RPH > > > > > > > is gone. I'm assuming the RPH outlives the Profile. However, this > > > class's > > > > > > > lifecycle is disconnected from the RPH and instead governed by the > > life > > > of > > > > > the > > > > > > > message pipe. > > > > > > > > > > > > Yeah it is, the lifecycle is the difference with before. Thanks a lot > > for > > > > > > pointing out this. I investigated around and I think we may have 2 > > options > > > > > now: > > > > > > 1, > > > > > > Just for current use case, client side(PageLoadHistograms::Dump() on > > > > renderer > > > > > > thread) executes "Connect-->Sync call-->Disconnect" all at once, > message > > > > pipe > > > > > > lifetime is just this timeslot, and the same to > > > DataReductionProxyHostImpl, > > > > > > while within this timeslot the browser side RPH should just be keeping > > > > > > alive(because renderer thread is running one task). This means we're > > still > > > > > > achieving "RPH outlives DataReductionProxyHostImpl", so should have no > > > > > problem.. > > > > > > Maybe I'm saying something stupid,, but just my understanding now ;-) > > > > > > > 2, > > > > > > Let DataReductionProxyHostImpl be a RPH observer so that it can > connect > > > > > > lifecycle with RPH. Once got RPH destroyed notification, post a task > to > > IO > > > > > > thread to delete itself. > > > > > > > > > > > > WDYT? Thanks. If option1 is nonsense, I'll try option2. > > > > > > > > > > The lifetime in the renderer doesn't directly correspond to lifetime in > > the > > > > > browser. IsDataReductionProxy() won't be called synchronously when the > > pipe > > > is > > > > > bound and neither will the disconnect. > > > > > > > > > > On the other hand, using a RenderProcessHostObserver would be messy at > > > > > destruction time if the StrongBinding still lives on the IO thread as > the > > UI > > > > and > > > > > IO threads could both decide to delete this at the same time. > > > > > > > > Option1, I think the renderer thread will block on calling > > > > IsDataReductionProxy() until pipe bound and IsDataReductionProxy() > execution > > > > returned in browser side. Within this timeslot, browser side RPH should be > > > alive > > > > and DataReductionProxyConfig should be guaranteed available. > > > > > > What you say only applies to the renderer process. If the profile in the > > browser > > > is shut down right after the renderer sends that IPC, you may end up in a > > > situation where the browser may receive and start processing that IPC after > > the > > > profile and RPH has been deleted. This is because the binding lifecycle > isn't > > > bound in any way to the RPH. And receipt of the IPC does NOT imply the > > renderer > > > is still alive. > > > > > > > If that scenario happened, as RPH has already been deleted, so RPH's service > > registry has also disappeared, that means DataReductionProxyHost interface > > connection itself can't be established. This result is similar with legacy > IPC, > > RPH disappeared, so did browser message filter, then received > > IsDataReductionProxy IPC will just be ignored. > > Nope. The RPH can be deleted after the impl has been created, but before a > method is called. This is good argument that StrongBinding<> is not appropriate > here because the lifecycle isn't disconnected from the RPH (or profile). > StrongBinding<> only works for things where the lifecycle of the impl is > decoupled from anything else. > Ok this scenario is actually possible.. Thank you~ And I've got an idea which I think finally should have no problem anymore: 1, Let DataReductionProxyHostImpl be a RPH observer, once got RPH destroy notification, post a task to IO thread to delete self. This would ensure DataReductionProxyConfig always outlives our DataReductionProxyHostImpl, just like the case of RPH message filter before. Because DataReductionProxyConfig is also deleted on IO thread by the task posted from Profile destruction, but as Profile destruction is later than RPH destruction, DataReductionProxyConfig destruction will also be later than our DataReductionProxyHostImpl. 2, Just use Binding<> instead of StrongBinding<>, create DataReductionProxyHostImpl instance when we register the interface, keep its 1:1 relationship with RPH. WDYT? > > > > > > > > > > Option2, yes it would be messy and hard to solve the race. Let me think > > more..
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2063683002/120001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: mac_chromium_compile_dbg_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_comp...) mac_chromium_gn_rel on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_gn_r...) mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_...)
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2063683002/140001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_compile_dbg on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_comp...) chromeos_amd64-generic_chromium_compile_only_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-...)
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2063683002/160001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_asan_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Would you PTAnL at ps#9? Thanks. Now DataReductionProxyHostImpl is a RPH observer and ties its lifecycle with RPH instead of the message pipe bound. https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc (right): https://codereview.chromium.org/2063683002/diff/60001/components/data_reducti... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:28: config_ = settings->Config(); On 2016/06/20 10:51:51, leonhsl wrote: > On 2016/06/20 04:57:26, Sam McNally wrote: > > DataReductionProxySettings can only be used on the UI thread. > > Oh yes, we can pass settings->Config() instead of settings into the constructor. Done.
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2063683002/160001
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2063683002/180001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2063683002/diff/180001/chrome/browser/chrome_... File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/2063683002/diff/180001/chrome/browser/chrome_... chrome/browser/chrome_content_browser_client.cc:2723: DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile); I'm personally of the opinion that as much as possible, we should be lazily creating impls. However, others have differing views. I'll ask sam to comment on this. https://codereview.chromium.org/2063683002/diff/180001/chrome/browser/chrome_... chrome/browser/chrome_content_browser_client.cc:2730: // The data_reduction_proxy_host is a render process host observer, so here we I'm convinced this is technically correct. However, the reason why is subtle which makes me not like this approach. Basically, you're relying on PostTask ordering between the deletion in the RPH destruction observer and the bind in ServiceRegistryImpl. You're guaranteed that the service registry post will always happen before the destruction (because RPH destruction kills the service registry), and therefore any call to DRPHI::BindRequest will always happen before the DRPHI is deleted. Another approach is to always have the DataReductionProxyHostImpl live and service requests on the UI thread. That way, you can delete when the RPH observer fires and avoid any lifetime complexity. To service the IsDataReductionProxy() method, you'll need to post to the IO thread and post back to the UI thread to respond, but you can use a WeakPtr to ensure lifetime and this would make lifetime reasoning much simpler. https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... File chrome/common/chrome_content_client.cc (left): https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... chrome/common/chrome_content_client.cc:605: bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* message) { I honestly don't understand what's supposed to happen with swapped-out frames. Someone that understand the effect of this should really take a look. https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... File chrome/common/chrome_content_client.cc (right): https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... chrome/common/chrome_content_client.cc:16: #include "base/memory/ptr_util.h" Is this needed? I'm guessing the messages file brought this in transitively and now you need it. Is that right? https://codereview.chromium.org/2063683002/diff/180001/components/data_reduct... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h (right): https://codereview.chromium.org/2063683002/diff/180001/components/data_reduct... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:1: // Copyright 2015 The Chromium Authors. All rights reserved. Ahem! Unless you've got a time machine I can borrow :P https://codereview.chromium.org/2063683002/diff/180001/components/data_reduct... File components/data_reduction_proxy/content/common/data_reduction_proxy_messages.h (left): https://codereview.chromium.org/2063683002/diff/180001/components/data_reduct... components/data_reduction_proxy/content/common/data_reduction_proxy_messages.h:10: #define IPC_MESSAGE_START DataReductionProxyStart Also remove this from the main messages file.
https://codereview.chromium.org/2063683002/diff/180001/chrome/browser/chrome_... File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/2063683002/diff/180001/chrome/browser/chrome_... chrome/browser/chrome_content_browser_client.cc:2723: DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile); On 2016/06/24 07:12:28, Anand Mistry wrote: > I'm personally of the opinion that as much as possible, we should be lazily > creating impls. However, others have differing views. I'll ask sam to comment on > this. While it would be nicer to create them lazily, it's simpler to create them ahead of time. If we create something to abstract away this complexity, then I think we can recommend lazy creation. https://codereview.chromium.org/2063683002/diff/180001/chrome/browser/chrome_... chrome/browser/chrome_content_browser_client.cc:2730: // The data_reduction_proxy_host is a render process host observer, so here we On 2016/06/24 07:12:28, Anand Mistry wrote: > I'm convinced this is technically correct. However, the reason why is subtle > which makes me not like this approach. Basically, you're relying on PostTask > ordering between the deletion in the RPH destruction observer and the bind in > ServiceRegistryImpl. You're guaranteed that the service registry post will > always happen before the destruction (because RPH destruction kills the service > registry), and therefore any call to DRPHI::BindRequest will always happen > before the DRPHI is deleted. > > Another approach is to always have the DataReductionProxyHostImpl live and > service requests on the UI thread. That way, you can delete when the RPH > observer fires and avoid any lifetime complexity. To service the > IsDataReductionProxy() method, you'll need to post to the IO thread and post > back to the UI thread to respond, but you can use a WeakPtr to ensure lifetime > and this would make lifetime reasoning much simpler. This feels like a lot of unnecessary thread bouncing, and may not work for all MessageFilter conversions. I would prefer we find a way to do this nicely for interface implementations that don't live on the UI thread. That said, exposing this complexity in each converted MessageFilter does sound like an invitation for confusion and bugs further down the road.
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2063683002/220001
Hi, Anand, Sam, Thanks a lot for comments! Uploaded ps#11 to address comments and ps#12 to do rebase, PTAnL, Thanks. https://codereview.chromium.org/2063683002/diff/180001/chrome/browser/chrome_... File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/2063683002/diff/180001/chrome/browser/chrome_... chrome/browser/chrome_content_browser_client.cc:2730: // The data_reduction_proxy_host is a render process host observer, so here we On 2016/06/24 07:24:48, Sam McNally wrote: > On 2016/06/24 07:12:28, Anand Mistry wrote: > > I'm convinced this is technically correct. However, the reason why is subtle > > which makes me not like this approach. Basically, you're relying on PostTask > > ordering between the deletion in the RPH destruction observer and the bind in > > ServiceRegistryImpl. You're guaranteed that the service registry post will > > always happen before the destruction (because RPH destruction kills the > service > > registry), and therefore any call to DRPHI::BindRequest will always happen > > before the DRPHI is deleted. > > > > Another approach is to always have the DataReductionProxyHostImpl live and > > service requests on the UI thread. That way, you can delete when the RPH > > observer fires and avoid any lifetime complexity. To service the > > IsDataReductionProxy() method, you'll need to post to the IO thread and post > > back to the UI thread to respond, but you can use a WeakPtr to ensure lifetime > > and this would make lifetime reasoning much simpler. > > This feels like a lot of unnecessary thread bouncing, and may not work for all > MessageFilter conversions. I would prefer we find a way to do this nicely for > interface implementations that don't live on the UI thread. That said, exposing > this complexity in each converted MessageFilter does sound like an invitation > for confusion and bugs further down the road. En,, if let DataReductionProxyHostImpl live on UI thread, this maybe cause UI thread get blocked sometimes when IO thread is busy. As IsDataReductionProxy() is a sync call. https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... File chrome/common/chrome_content_client.cc (left): https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... chrome/common/chrome_content_client.cc:605: bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* message) { On 2016/06/24 07:12:28, Anand Mistry wrote: > I honestly don't understand what's supposed to happen with swapped-out frames. > Someone that understand the effect of this should really take a look. From my understanding, under swapped-out status RenderWidget::Send() can send only some explicitly announced IPCs, here is just the annunciation for DataReductionProxyViewHostMsg_IsDataReductionProxy. After switched to Mojo, the restriction itself does not exist anymore, so I think we need to do nothing for this. Anyway, I'll try to find someone familiar with this to take a look. https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... File chrome/common/chrome_content_client.cc (right): https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... chrome/common/chrome_content_client.cc:16: #include "base/memory/ptr_util.h" On 2016/06/24 07:12:28, Anand Mistry wrote: > Is this needed? I'm guessing the messages file brought this in transitively and > now you need it. Is that right? Actually it's not my codes need it ;-) https://codereview.chromium.org/2049783002 started to use base::WrapUnique but did not include this header file explicitly, it implicitly uses via the message file I delete here in this CL. To let all trybots happy I have to add this line here. I did a rebase on ps#12, which will show the usage of base::WrapUnique clearly. Although, I've created a separate CL https://codereview.chromium.org/2095473003/ to add this explicitly. https://codereview.chromium.org/2063683002/diff/180001/components/data_reduct... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h (right): https://codereview.chromium.org/2063683002/diff/180001/components/data_reduct... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:1: // Copyright 2015 The Chromium Authors. All rights reserved. On 2016/06/24 07:12:28, Anand Mistry wrote: > Ahem! Unless you've got a time machine I can borrow :P Ehh,, Done! Thank you ;-) https://codereview.chromium.org/2063683002/diff/180001/components/data_reduct... File components/data_reduction_proxy/content/common/data_reduction_proxy_messages.h (left): https://codereview.chromium.org/2063683002/diff/180001/components/data_reduct... components/data_reduction_proxy/content/common/data_reduction_proxy_messages.h:10: #define IPC_MESSAGE_START DataReductionProxyStart On 2016/06/24 07:12:28, Anand Mistry wrote: > Also remove this from the main messages file. Done.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2063683002/diff/180001/chrome/browser/chrome_... File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/2063683002/diff/180001/chrome/browser/chrome_... chrome/browser/chrome_content_browser_client.cc:2730: // The data_reduction_proxy_host is a render process host observer, so here we On 2016/06/24 09:59:21, leonhsl wrote: > On 2016/06/24 07:24:48, Sam McNally wrote: > > On 2016/06/24 07:12:28, Anand Mistry wrote: > > > I'm convinced this is technically correct. However, the reason why is subtle > > > which makes me not like this approach. Basically, you're relying on PostTask > > > ordering between the deletion in the RPH destruction observer and the bind > in > > > ServiceRegistryImpl. You're guaranteed that the service registry post will > > > always happen before the destruction (because RPH destruction kills the > > service > > > registry), and therefore any call to DRPHI::BindRequest will always happen > > > before the DRPHI is deleted. > > > > > > Another approach is to always have the DataReductionProxyHostImpl live and > > > service requests on the UI thread. That way, you can delete when the RPH > > > observer fires and avoid any lifetime complexity. To service the > > > IsDataReductionProxy() method, you'll need to post to the IO thread and post > > > back to the UI thread to respond, but you can use a WeakPtr to ensure > lifetime > > > and this would make lifetime reasoning much simpler. > > > > This feels like a lot of unnecessary thread bouncing, and may not work for all > > MessageFilter conversions. I would prefer we find a way to do this nicely for > > interface implementations that don't live on the UI thread. That said, > exposing > > this complexity in each converted MessageFilter does sound like an invitation > > for confusion and bugs further down the road. > > En,, if let DataReductionProxyHostImpl live on UI thread, this maybe cause UI > thread get blocked sometimes when IO thread is busy. As IsDataReductionProxy() > is a sync call. Sorry for my misunderstanding, you could just ignore my nonsense words.. I'll try to consider about the nicer way mentioned by Sam.
leon.han@intel.com changed reviewers: + tbansal@chromium.org
Hi, tbansal@, megjablon@, in addition to the following inline question, I want to confirm another one: As for 1 render process host, will there be multiple render frames sending the IsDataReductionProxy IPC to it? Thanks in advance. https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... File chrome/common/chrome_content_client.cc (left): https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... chrome/common/chrome_content_client.cc:605: bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* message) { On 2016/06/24 09:59:21, leonhsl wrote: > On 2016/06/24 07:12:28, Anand Mistry wrote: > > I honestly don't understand what's supposed to happen with swapped-out frames. > > Someone that understand the effect of this should really take a look. > > From my understanding, under swapped-out status RenderWidget::Send() can send > only some explicitly announced IPCs, here is just the annunciation for > DataReductionProxyViewHostMsg_IsDataReductionProxy. After switched to Mojo, the > restriction itself does not exist anymore, so I think we need to do nothing for > this. > Anyway, I'll try to find someone familiar with this to take a look. Hi, tbansal@, megjablon@, I found that you have touched these codes before, would you please help to take a look? Thanks.
On 2016/06/24 15:33:47, leonhsl wrote: > Hi, tbansal@, megjablon@, in addition to the following inline question, I want > to confirm another one: > As for 1 render process host, will there be multiple render frames sending the > IsDataReductionProxy IPC to it? Thanks in advance. The message is send once per page load. If the two render frames are part of same process (e.g., example.com loaded in two different tabs may share render process), then the render process host will get 2 IPCs. > > https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... > File chrome/common/chrome_content_client.cc (left): > > https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... > chrome/common/chrome_content_client.cc:605: bool > ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* message) { > On 2016/06/24 09:59:21, leonhsl wrote: > > On 2016/06/24 07:12:28, Anand Mistry wrote: > > > I honestly don't understand what's supposed to happen with swapped-out > frames. > > > Someone that understand the effect of this should really take a look. > > > > From my understanding, under swapped-out status RenderWidget::Send() can send > > only some explicitly announced IPCs, here is just the annunciation for > > DataReductionProxyViewHostMsg_IsDataReductionProxy. After switched to Mojo, > the > > restriction itself does not exist anymore, so I think we need to do nothing > for > > this. > > Anyway, I'll try to find someone familiar with this to take a look. > > Hi, tbansal@, megjablon@, I found that you have touched these codes before, > would you please help to take a look? Thanks.
https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... File chrome/common/chrome_content_client.cc (left): https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... chrome/common/chrome_content_client.cc:605: bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* message) { On 2016/06/24 15:33:47, leonhsl wrote: > On 2016/06/24 09:59:21, leonhsl wrote: > > On 2016/06/24 07:12:28, Anand Mistry wrote: > > > I honestly don't understand what's supposed to happen with swapped-out > frames. > > > Someone that understand the effect of this should really take a look. > > > > From my understanding, under swapped-out status RenderWidget::Send() can send > > only some explicitly announced IPCs, here is just the annunciation for > > DataReductionProxyViewHostMsg_IsDataReductionProxy. After switched to Mojo, > the > > restriction itself does not exist anymore, so I think we need to do nothing > for > > this. > > Anyway, I'll try to find someone familiar with this to take a look. > > Hi, tbansal@, megjablon@, I found that you have touched these codes before, > would you please help to take a look? Thanks. leonhsi@, you are right. By default the IPCs are blocked for swapped out frames. Here, we are trying to record page load metrics (e.g., page load time) if the page used the data reduction proxy. So, the renderer queries the browser if the page used the data reduction proxy. This code punches a hole in the IPC mechanism to allow this message to go through even after the swap out. I am not familiar with Mojo, but if the IPC restriction (messages are blocked after renderer is swapped out) is no longer there, then this code can be removed.
On 2016/06/24 15:57:08, tbansal1 wrote: > https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... > File chrome/common/chrome_content_client.cc (left): > > https://codereview.chromium.org/2063683002/diff/180001/chrome/common/chrome_c... > chrome/common/chrome_content_client.cc:605: bool > ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* message) { > On 2016/06/24 15:33:47, leonhsl wrote: > > On 2016/06/24 09:59:21, leonhsl wrote: > > > On 2016/06/24 07:12:28, Anand Mistry wrote: > > > > I honestly don't understand what's supposed to happen with swapped-out > > frames. > > > > Someone that understand the effect of this should really take a look. > > > > > > From my understanding, under swapped-out status RenderWidget::Send() can > send > > > only some explicitly announced IPCs, here is just the annunciation for > > > DataReductionProxyViewHostMsg_IsDataReductionProxy. After switched to Mojo, > > the > > > restriction itself does not exist anymore, so I think we need to do nothing > > for > > > this. > > > Anyway, I'll try to find someone familiar with this to take a look. > > > > Hi, tbansal@, megjablon@, I found that you have touched these codes before, > > would you please help to take a look? Thanks. > > leonhsi@, you are right. By default the IPCs are blocked for swapped out frames. > Here, we are trying to record page load metrics (e.g., page load time) if the > page used the data reduction proxy. > > So, the renderer queries the browser if the page used the data reduction proxy. > This code punches a hole in the IPC mechanism to allow this message to go > through even after the swap out. > > I am not familiar with Mojo, but if the IPC restriction (messages are blocked > after renderer is swapped out) is no longer there, then this code can be > removed. Got it. Thanks a lot for quick response!
On 2016/06/24 15:56:50, tbansal1 wrote: > On 2016/06/24 15:33:47, leonhsl wrote: > > Hi, tbansal@, megjablon@, in addition to the following inline question, I want > > to confirm another one: > > As for 1 render process host, will there be multiple render frames sending the > > IsDataReductionProxy IPC to it? Thanks in advance. > The message is send once per page load. > > If the two render frames are part of same process (e.g., http://example.com > loaded in two different tabs may share render process), then the > render process host will get 2 IPCs. > OK I see, then I need to enable our DataReductionProxyHostImpl serve multiple clients. Thanks! And, sorry for another question not related with this CL ;-) Can multiple render frames share 1 render frame host?
+creis to answer your last question
On 2016/06/24 16:20:59, leonhsl wrote: > On 2016/06/24 15:56:50, tbansal1 wrote: > > On 2016/06/24 15:33:47, leonhsl wrote: > > > Hi, tbansal@, megjablon@, in addition to the following inline question, I > want > > > to confirm another one: > > > As for 1 render process host, will there be multiple render frames sending > the > > > IsDataReductionProxy IPC to it? Thanks in advance. > > The message is send once per page load. > > > > If the two render frames are part of same process (e.g., http://example.com > > loaded in two different tabs may share render process), then the > > render process host will get 2 IPCs. > > > > OK I see, then I need to enable our DataReductionProxyHostImpl serve multiple > clients. Thanks! > And, sorry for another question not related with this CL ;-) Can multiple render > frames share 1 render frame host? No, each RenderFrame has its own RenderFrameHost (which share a routing ID). If multiple RenderFrames in the same process, then their respective RenderFrameHosts will have the same RenderProcessHost. Hope that helps!
On 2016/06/24 23:00:20, Charlie Reis wrote: > On 2016/06/24 16:20:59, leonhsl wrote: > > On 2016/06/24 15:56:50, tbansal1 wrote: > > > On 2016/06/24 15:33:47, leonhsl wrote: > > > > Hi, tbansal@, megjablon@, in addition to the following inline question, I > > want > > > > to confirm another one: > > > > As for 1 render process host, will there be multiple render frames sending > > the > > > > IsDataReductionProxy IPC to it? Thanks in advance. > > > The message is send once per page load. > > > > > > If the two render frames are part of same process (e.g., http://example.com > > > loaded in two different tabs may share render process), then the > > > render process host will get 2 IPCs. > > > > > > > OK I see, then I need to enable our DataReductionProxyHostImpl serve multiple > > clients. Thanks! > > And, sorry for another question not related with this CL ;-) Can multiple > render > > frames share 1 render frame host? > > No, each RenderFrame has its own RenderFrameHost (which share a routing ID). If > multiple RenderFrames in the same process, then their respective > RenderFrameHosts will have the same RenderProcessHost. > > Hope that helps! Understood and thank you~
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Pretty good looking at the Mojo side. Just one lifecycle thing. https://codereview.chromium.org/2063683002/diff/260001/components/data_reduct... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc (right): https://codereview.chromium.org/2063683002/diff/260001/components/data_reduct... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:42: void DataReductionProxyHostImpl::RenderProcessHostDestroyed( RenderProcessHosts can be reused. And every time, a new set of Mojo services is registered. This means you'll end up with zombie DataReductionProxyHostImpls until the RPH is finally destroyed. I think you want RenderProcessHostExited instead which runs when the renderer process exits.
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Uploaded ps#15 to address comments, PTAnL, Thanks~ https://codereview.chromium.org/2063683002/diff/260001/components/data_reduct... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc (right): https://codereview.chromium.org/2063683002/diff/260001/components/data_reduct... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:42: void DataReductionProxyHostImpl::RenderProcessHostDestroyed( On 2016/06/30 12:51:45, Anand Mistry wrote: > RenderProcessHosts can be reused. And every time, a new set of Mojo services is > registered. This means you'll end up with zombie DataReductionProxyHostImpls > until the RPH is finally destroyed. I think you want RenderProcessHostExited > instead which runs when the renderer process exits. Oh, yeah, I see now.. Thanks a lot for pointing out this! I really learned a lot from this CL! Done.
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
lgtm from a mojo perspective
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
leon.han@intel.com changed reviewers: + dcheng@chromium.org, jochen@chromium.org
Although trybots are still red, I checked and suppose it should not be because of changes of this CL. PTAL, Thanks. tbansal@, megjablon@ : OWNER review for data_reduction_proxy. dcheng@: Security review for mojom, ipc. jochen@: OWNER review for chrome/, components/ except data_reduction_proxy.
lgtm
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_androi...) linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
https://codereview.chromium.org/2063683002/diff/320001/chrome/browser/chrome_... File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/2063683002/diff/320001/chrome/browser/chrome_... chrome/browser/chrome_content_browser_client.cc:2784: Profile::FromBrowserContext(render_process_host->GetBrowserContext()); I think a BrowserContext here should be sufficient. (If it turns out other things need a Profile later, that's easy enough to change) https://codereview.chromium.org/2063683002/diff/320001/chrome/browser/chrome_... chrome/browser/chrome_content_browser_client.cc:2792: render_process_host); Lines 2789-2791 should probably just be inlined into the host ctor: it's an implementation detail of the host. https://codereview.chromium.org/2063683002/diff/320001/chrome/browser/chrome_... chrome/browser/chrome_content_browser_client.cc:2798: BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); I'm a bit sad about how the ownership here has become very loosely coupled: we have to bind an unretained pointer into the callback, and then add a comment (quite far away from the actual class and easy to become outdated) that it self-deletes due to being a RenderProcessHostObserver. As a strawman... how bad would it be: - Make this a base::Owned() pointer. - Have the InterfaceRegistry clear registered callbacks on the task runner the interface factory was registered with https://codereview.chromium.org/2063683002/diff/320001/chrome/renderer/page_l... File chrome/renderer/page_load_histograms.cc (right): https://codereview.chromium.org/2063683002/diff/320001/chrome/renderer/page_l... chrome/renderer/page_load_histograms.cc:895: bool handled = data_reduction_proxy_host->IsDataReductionProxy( How expensive is it to create / tear down a message pipe everytime we query this state? It definitely seems less efficient than legacy IPC, since we'd just route one message there. https://codereview.chromium.org/2063683002/diff/320001/components/data_reduct... File components/data_reduction_proxy/content/common/OWNERS (right): https://codereview.chromium.org/2063683002/diff/320001/components/data_reduct... components/data_reduction_proxy/content/common/OWNERS:4: per-file *_messages.cc=file://ipc/SECURITY_OWNERS Nit: I think you can delete lines 3-4.
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: mac_chromium_compile_dbg_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_comp...)
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
leon.han@intel.com changed reviewers: + rockot@chromium.org
Thanks Daniel a lot for review and add Ken to help take a look at such case. https://codereview.chromium.org/2063683002/diff/320001/chrome/browser/chrome_... File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/2063683002/diff/320001/chrome/browser/chrome_... chrome/browser/chrome_content_browser_client.cc:2784: Profile::FromBrowserContext(render_process_host->GetBrowserContext()); On 2016/07/08 05:50:53, dcheng wrote: > I think a BrowserContext here should be sufficient. > > (If it turns out other things need a Profile later, that's easy enough to > change) Done and thanks! https://codereview.chromium.org/2063683002/diff/320001/chrome/browser/chrome_... chrome/browser/chrome_content_browser_client.cc:2792: render_process_host); On 2016/07/08 05:50:53, dcheng wrote: > Lines 2789-2791 should probably just be inlined into the host ctor: it's an > implementation detail of the host. Done. https://codereview.chromium.org/2063683002/diff/320001/chrome/browser/chrome_... chrome/browser/chrome_content_browser_client.cc:2798: BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); On 2016/07/08 05:50:53, dcheng wrote: > I'm a bit sad about how the ownership here has become very loosely coupled: we > have to bind an unretained pointer into the callback, and then add a comment > (quite far away from the actual class and easy to become outdated) that it > self-deletes due to being a RenderProcessHostObserver. > > As a strawman... how bad would it be: > - Make this a base::Owned() pointer. > - Have the InterfaceRegistry clear registered callbacks on the task runner the > interface factory was registered with I'm also investigating around,, but I think Ken would have some insights about this concrete sample from mojo overall point of view. Thanks~ https://codereview.chromium.org/2063683002/diff/320001/chrome/renderer/page_l... File chrome/renderer/page_load_histograms.cc (right): https://codereview.chromium.org/2063683002/diff/320001/chrome/renderer/page_l... chrome/renderer/page_load_histograms.cc:895: bool handled = data_reduction_proxy_host->IsDataReductionProxy( On 2016/07/08 05:50:53, dcheng wrote: > How expensive is it to create / tear down a message pipe everytime we query this > state? It definitely seems less efficient than legacy IPC, since we'd just route > one message there. From my understanding this call will just happen once for each main render frame, and as I remember that a mojo message pipe should be cheap to create and destroy, so I made this choice. I referenced some other mojofication works which are also using mojo message pipes as if it's free ;-) https://codereview.chromium.org/2063683002/diff/320001/components/data_reduct... File components/data_reduction_proxy/content/common/OWNERS (right): https://codereview.chromium.org/2063683002/diff/320001/components/data_reduct... components/data_reduction_proxy/content/common/OWNERS:4: per-file *_messages.cc=file://ipc/SECURITY_OWNERS On 2016/07/08 05:50:53, dcheng wrote: > Nit: I think you can delete lines 3-4. Done.
Description was changed from ========== Migrate components/data_reduction_proxy to Mojo interfaces. This CL also adds typemapping for net::HostPortPair. BUG=577685 TEST=components_unittests --gtest_filter=DataReductionProxyHostImplTest* ========== to ========== Migrate components/data_reduction_proxy to Mojo interfaces. This CL also adds typemapping for net::HostPortPair. BUG=577685 TEST=components_unittests --gtest_filter=DataReductionProxyHostImplTest* ==========
megjablon@chromium.org changed reviewers: - megjablon@chromium.org
Ping tbansal1@, would you please take a OWNER review? Thanks.
Few nits. https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... File components/data_reduction_proxy/content/browser/BUILD.gn (right): https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... components/data_reduction_proxy/content/browser/BUILD.gn:42: "//mojo/public/cpp/bindings", Should not this be near line 22 above? https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc (right): https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:37: if (!config_) { Add DCHECK_CURRENTLY_ON(content::BrowserThread::IO); https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h (right): https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:25: // |config| may be null. Did you mean |settings|? https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:27: content::RenderProcessHost* host); Forward declare RenderProcessHost.
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Uploaded ps#21 and ps#22 to address comments, PTAnL, Thanks. https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... File components/data_reduction_proxy/content/browser/BUILD.gn (right): https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... components/data_reduction_proxy/content/browser/BUILD.gn:42: "//mojo/public/cpp/bindings", On 2016/07/13 17:35:18, tbansal1 wrote: > Should not this be near line 22 above? Ah this should be unnecessary. Removed and Thanks! https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc (right): https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:37: if (!config_) { On 2016/07/13 17:35:18, tbansal1 wrote: > Add DCHECK_CURRENTLY_ON(content::BrowserThread::IO); Tried to add in ps#21 but found DataReductionProxyHostImpl unit test failed, because unit test code is not running on BrowserThread::IO. As mojo is thread hostile, all mojo calls must run on the same thread on which the interface impl was bound, so I think as we have ensured BindRequest() running on BrowserThread::IO, here we can omit this check? https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h (right): https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:25: // |config| may be null. On 2016/07/13 17:35:18, tbansal1 wrote: > Did you mean |settings|? Done. https://codereview.chromium.org/2063683002/diff/380001/components/data_reduct... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h:27: content::RenderProcessHost* host); On 2016/07/13 17:35:18, tbansal1 wrote: > Forward declare RenderProcessHost. Done.
components/d_r_p lgtm. Thanks for doing this.
Ping Daniel, thanks. I think chromium-mojo@ discussions about interface impl lifecycle have already come out some conclusions.
On 2016/07/20 03:24:23, leonhsl wrote: > Ping Daniel, thanks. > I think chromium-mojo@ discussions about interface impl lifecycle have already > come out some conclusions. I thought tibell@ was working on something where we wouldn't need to use base::Unretained pointers so much? I still see that being used in this CL.
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
On 2016/07/20 10:31:46, dcheng wrote: > On 2016/07/20 03:24:23, leonhsl wrote: > > Ping Daniel, thanks. > > I think chromium-mojo@ discussions about interface impl lifecycle have already > > come out some conclusions. > > I thought tibell@ was working on something where we wouldn't need to use > base::Unretained pointers so much? I still see that being used in this CL. Oh yeah.. Uploaded ps#24 to use tibell's solution, PTAnL, Thanks.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
On 2016/07/21 11:59:15, leonhsl wrote: > On 2016/07/20 10:31:46, dcheng wrote: > > On 2016/07/20 03:24:23, leonhsl wrote: > > > Ping Daniel, thanks. > > > I think chromium-mojo@ discussions about interface impl lifecycle have > already > > > come out some conclusions. > > > > I thought tibell@ was working on something where we wouldn't need to use > > base::Unretained pointers so much? I still see that being used in this CL. > > Oh yeah.. Uploaded ps#24 to use tibell's solution, PTAnL, Thanks. I'm afraid I have to revert ps#24 because this solution does not fit the case of this CL. Our DataReductionProxyHostImpl's lifetime should be bound to the lifetime of each render process, but not the RPHI itself. We should still make DataReductionProxyHostImpl as RenderProcessHostObserver to observe exit notification of each render process via RenderProcessHostExited.
drive-by: please let's hold off on adding more usage of AddOwnedInterface until we reach consensus on that abstraction.
On 2016/07/22 05:24:13, jam wrote: > drive-by: please let's hold off on adding more usage of AddOwnedInterface until > we reach consensus on that abstraction. Yeah I realized that AddOwnedInterface does not fit the case of this CL and will revert ps#24. I'll pay attention on the chromium-dev@ discussions. Well for such case, I do think what ps#23 does(RPH observer) is 'sort of thing that can be established, learned, and understood with relative ease' and acceptable currently.
Patchset #24 (id:460001) has been deleted
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by leon.han@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
leon.han@intel.com changed reviewers: + jam@chromium.org
Hi, Daniel, would you PTAnL at ps#25? Thanks. Per jam@'s suggestion in chromium-mojo@ discussion thread, now we use StrongBinding to bind the lifecycle of DataReductionProxyHostImpl with the message pipe, and use weak ptr to guard the access to DataReductionProxyConfig instance inside DataReductionProxyHostImpl. Also, +jam@ to help confirm the new solution. Thanks.
Ping Daniel and John, thanks.
(assuming the owners of data_reduction_proxy are OK with exposing the weakptr to the config externally... it seems a bit funny to do that, but I don't have any better ideas) https://codereview.chromium.org/2063683002/diff/500001/chrome/renderer/page_l... File chrome/renderer/page_load_histograms.cc (right): https://codereview.chromium.org/2063683002/diff/500001/chrome/renderer/page_l... chrome/renderer/page_load_histograms.cc:844: bool handled = data_reduction_proxy_host->IsDataReductionProxy( What happens to this request if the other side is never bound? Wouldn't it hang? https://codereview.chromium.org/2063683002/diff/500001/components/data_reduct... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc (right): https://codereview.chromium.org/2063683002/diff/500001/components/data_reduct... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:19: new data_reduction_proxy::DataReductionProxyHostImpl(config, Does it make sense to actually call Create if |config| is null? I'm not sure why we AddInterface in that case, as we'll never bind anything to the interface request anyway.
When I last looked at the CL, it was not exposing the WeakPtr from DRP. So, now I need to look at it again. leonhsl: Can you please hold on this CL for a while.
On 2016/08/26 20:56:34, tbansal1 wrote: > When I last looked at the CL, it was not exposing the WeakPtr from DRP. So, now > I need to look at it again. leonhsl: Can you please hold on this CL for a while. Understood. I'll address Daniel's comments firstly and let's figure out a proper pattern making all happy ;-)
https://codereview.chromium.org/2063683002/diff/500001/chrome/renderer/page_l... File chrome/renderer/page_load_histograms.cc (right): https://codereview.chromium.org/2063683002/diff/500001/chrome/renderer/page_l... chrome/renderer/page_load_histograms.cc:844: bool handled = data_reduction_proxy_host->IsDataReductionProxy( On 2016/08/26 19:16:20, dcheng wrote: > What happens to this request if the other side is never bound? Wouldn't it hang? Normally the other side will either bind or reject(close) the request. Closing request means breaking the message pipe connection, which will wake up the waiting sync call to return with no any value set to |ata_reduction_proxy_was_used|. Will hang here ONLY IF the other side holds the request deliberately but does not bind it, which would never happen for this CL. https://codereview.chromium.org/2063683002/diff/500001/components/data_reduct... File components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc (right): https://codereview.chromium.org/2063683002/diff/500001/components/data_reduct... components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc:19: new data_reduction_proxy::DataReductionProxyHostImpl(config, On 2016/08/26 19:16:20, dcheng wrote: > Does it make sense to actually call Create if |config| is null? I'm not sure why > we AddInterface in that case, as we'll never bind anything to the interface > request anyway. If we do not AddInterface, ERROR log "Failed to locate a binder for interface: XXX" will be dumped by https://cs.chromium.org/chromium/src/services/shell/public/cpp/lib/interface_... when the request arrived. I assume we do not want this.
As data_reduction_proxy IPCs have all been deprecated by https://codereview.chromium.org/2314163003/, no need to do the mojo conversion further, so close this CL now. Thanks all for the help to me here ;-) |