|
|
Created:
4 years, 1 month ago by horo Modified:
4 years, 1 month ago CC:
chromium-reviews, michaeln, jsbell+serviceworker_chromium.org, serviceworker-reviews, creis+watch_chromium.org, mlamouri+watch-content_chromium.org, shimazu+serviceworker_chromium.org, nasko+codewatch_chromium.org, jam, kinuko+serviceworker, nhiroki, blink-reviews-bindings_chromium.org, haraken, dglazkov+blink, blink-reviews-api_chromium.org, darin-cc_chromium.org, blink-reviews, horo+watch_chromium.org, kinuko+watch, tzik, falken+watch_chromium.org, blink-worker-reviews_chromium.org, clamy, nasko Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionSupport Service Worker NavigationPreload with PlzNavigate.
When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses
MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated
with the RenderProcessHost.
This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters()
and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it
from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and
ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob.
But if PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost()
creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated
with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the
MojoURLLoaderFactoryGetter.
To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter() and:
- NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from
the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore.
- ServiceWorkerRequestHandler::InitializeForNavigation() gets the
MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it
to ServiceWorkerProviderHost.
- So when ServiceWorkerProviderHost::CreateRequestHandler() is called,
ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter.
BUG=649558
TEST=content_browsertests --enable-browser-side-navigation --gtest_filter=ServiceWorkerBrowserTest/ServiceWorkerNavigationPreloadTest.*
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation
Patch Set 1 #
Total comments: 3
Patch Set 2 : remove unnecessary comment #
Total comments: 2
Messages
Total messages: 51 (38 generated)
Description was changed from ========== [not for review]NavigationPreload support with PlzNavigate ========== to ========== [not for review]NavigationPreload support with PlzNavigate CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation ==========
The CQ bit was checked by horo@chromium.org 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: win_chromium_x64_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_...)
The CQ bit was checked by horo@chromium.org 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.
Description was changed from ========== [not for review]NavigationPreload support with PlzNavigate CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation ========== to ========== [not for review]NavigationPreload support with PlzNavigate When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But when PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter(). - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. ==========
The CQ bit was checked by horo@chromium.org 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.
Description was changed from ========== [not for review]NavigationPreload support with PlzNavigate When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But when PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter(). - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. ========== to ========== Support NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But when PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter(). - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. ==========
Description was changed from ========== Support NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But when PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter(). - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. ========== to ========== Support NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But when PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter() and: - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. BUG=649558 ==========
Description was changed from ========== Support NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But when PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter() and: - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. BUG=649558 ========== to ========== Support NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But if PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter() and: - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. BUG=649558 ==========
Patchset #1 (id:1) has been deleted
Patchset #4 (id:80001) has been deleted
Patchset #3 (id:60001) has been deleted
Patchset #2 (id:40001) has been deleted
Patchset #1 (id:20001) has been deleted
Description was changed from ========== Support NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But if PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter() and: - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. BUG=649558 ========== to ========== Support Service Worker NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But if PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter() and: - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. BUG=649558 ==========
horo@chromium.org changed reviewers: + falken@chromium.org
falken@ Could you please review this?
this lgtm https://codereview.chromium.org/2446553002/diff/100001/content/public/browser... File content/public/browser/render_process_host.h (right): https://codereview.chromium.org/2446553002/diff/100001/content/public/browser... content/public/browser/render_process_host.h:340: // used for fetching navigation preload request. I think we can remove the second sentence, since the URL loader factory is potentially useful for purposes other than navigation preload (I think). If it could only possible be used for navigation preload, the function name should be something like CreateURLLoaderFactoryGetterForNavigationPreload. Ideally we'd avoid a new function on RPH and just have the caller bind the function itself using RenderProcessHostImpl::CreateURLLoaderFactory, but I see there is no GetWeakPtr() function and adding it might be controversial. Also, does CreateURLLoaderFactoryGetter() have to be on the public interface or can it just be on RenderProcessHostInstance?
Description was changed from ========== Support Service Worker NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But if PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter() and: - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. BUG=649558 ========== to ========== Support Service Worker NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But if PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter() and: - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. BUG=649558 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation ==========
The CQ bit was checked by horo@chromium.org 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...
https://codereview.chromium.org/2446553002/diff/100001/content/public/browser... File content/public/browser/render_process_host.h (right): https://codereview.chromium.org/2446553002/diff/100001/content/public/browser... content/public/browser/render_process_host.h:340: // used for fetching navigation preload request. On 2016/10/27 02:07:49, falken wrote: > I think we can remove the second sentence, since the URL loader factory is > potentially useful for purposes other than navigation preload (I think). If it > could only possible be used for navigation preload, the function name should be > something like CreateURLLoaderFactoryGetterForNavigationPreload. done. > Ideally we'd avoid a new function on RPH and just have the caller bind the > function itself using RenderProcessHostImpl::CreateURLLoaderFactory, but I see > there is no GetWeakPtr() function and adding it might be controversial. > > Also, does CreateURLLoaderFactoryGetter() have to be on the public interface or > can it just be on RenderProcessHostInstance? Are you saying about RenderProcessHostImpl? We have to have this method in RenderProcessHost, because some unittests (NavigatorTestWithBrowserSideNavigation) are using MockRenderProcessHost , not RenderProcessHostImpl.
Description was changed from ========== Support Service Worker NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But if PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter() and: - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. BUG=649558 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation ========== to ========== Support Service Worker NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But if PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter() and: - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. BUG=649558 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation TEST=content_browsertests --enable-browser-side-navigation --gtest_filter=ServiceWorkerBrowserTest/ServiceWorkerNavigationPreloadTest.* ==========
Description was changed from ========== Support Service Worker NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But if PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter() and: - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. BUG=649558 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation TEST=content_browsertests --enable-browser-side-navigation --gtest_filter=ServiceWorkerBrowserTest/ServiceWorkerNavigationPreloadTest.* ========== to ========== Support Service Worker NavigationPreload with PlzNavigate. When ServiceWorkerFetchDispatcher sends the navigation preload request, it uses MojoURLLoaderFactoryGetter to get the mojom::URLLoaderFactory which is associated with the RenderProcessHost. This MojoURLLoaderFactoryGetter is created in RenderProcessHostImpl::CreateMessageFilters() and passed to ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can get it from ServiceWorkerDispatcherHost via ServiceWorkerProviderHost and ServiceWorkerControlleeRequestHandler and ServiceWorkerURLRequestJob. But if PlzNavigate is enabled, when ServiceWorkerProviderHost::PreCreateNavigationHost() creates a ServiceWorkerProviderHost, the ServiceWorkerProviderHost is not associated with any ServiceWorkerDispatcherHost. So ServiceWorkerFetchDispatcher can't get the MojoURLLoaderFactoryGetter. To solve this problem, this CL introduces RenderProcessHost::CreateURLLoaderFactoryGetter() and: - NavigationRequest::OnStartChecksComplete() creates a MojoURLLoaderFactoryGetter from the navigating_frame_host's process and pass it to ServiceWorkerNavigationHandleCore. - ServiceWorkerRequestHandler::InitializeForNavigation() gets the MojoURLLoaderFactoryGetter from ServiceWorkerNavigationHandleCore and pass it to ServiceWorkerProviderHost. - So when ServiceWorkerProviderHost::CreateRequestHandler() is called, ServiceWorkerProviderHost must have a MojoURLLoaderFactoryGetter. BUG=649558 TEST=content_browsertests --enable-browser-side-navigation --gtest_filter=ServiceWorkerBrowserTest/ServiceWorkerNavigationPreloadTest.* CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation ==========
horo@chromium.org changed reviewers: + clamy@chromium.org
clamy@ Could you please review this?
https://codereview.chromium.org/2446553002/diff/100001/content/public/browser... File content/public/browser/render_process_host.h (right): https://codereview.chromium.org/2446553002/diff/100001/content/public/browser... content/public/browser/render_process_host.h:340: // used for fetching navigation preload request. On 2016/10/27 02:20:27, horo wrote: > On 2016/10/27 02:07:49, falken wrote: > > I think we can remove the second sentence, since the URL loader factory is > > potentially useful for purposes other than navigation preload (I think). If it > > could only possible be used for navigation preload, the function name should > be > > something like CreateURLLoaderFactoryGetterForNavigationPreload. > > done. > > > Ideally we'd avoid a new function on RPH and just have the caller bind the > > function itself using RenderProcessHostImpl::CreateURLLoaderFactory, but I see > > there is no GetWeakPtr() function and adding it might be controversial. > > > > Also, does CreateURLLoaderFactoryGetter() have to be on the public interface > or > > can it just be on RenderProcessHostInstance? > > Are you saying about RenderProcessHostImpl? > We have to have this method in RenderProcessHost, because some unittests > (NavigatorTestWithBrowserSideNavigation) are using MockRenderProcessHost , not > RenderProcessHostImpl. Yes, Impl. Acknowledged.
horo@chromium.org changed reviewers: + alexmos@chromium.org
Ah, clamy@ is ooo until Nov 2. alexmos@ Could you please review content/browser/frame_host/OWNERS?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...)
frame_host LGTM. I'm not as familiar with service worker internals, so this is mostly a RS based on falken@'s review.
horo@chromium.org changed reviewers: - clamy@chromium.org
horo@chromium.org changed reviewers: + clamy@chromium.org, nasko@chromium.org
nasko@ Could you please review content/browser/renderer_host/render_process_host_impl.* content/public/browser/render_process_host.h content/public/test/mock_render_process_host.*?
horo@chromium.org changed reviewers: - clamy@chromium.org, nasko@chromium.org
horo@chromium.org changed reviewers: + clamy@chromium.org, nasko@chromium.org
horo@chromium.org changed reviewers: + piman@chromium.org
piman@ Could you please review content/browser/renderer_host/render_process_host_impl.* content/public/browser/render_process_host.h content/public/test/mock_render_process_host.*?
https://codereview.chromium.org/2446553002/diff/120001/content/browser/render... File content/browser/renderer_host/render_process_host_impl.cc (right): https://codereview.chromium.org/2446553002/diff/120001/content/browser/render... content/browser/renderer_host/render_process_host_impl.cc:1414: weak_factory_.GetWeakPtr()); WeakPtr is not thread safe. So we should not pass the MojoURLLoaderFactoryGetter to the IO thread. http://www.chromium.org/developers/design-documents/threading#base_WeakPtr_an... I will create another CL to avoid this problem. Sorry for confusion.
Message was sent while issue was closed.
https://codereview.chromium.org/2446553002/diff/120001/content/browser/render... File content/browser/renderer_host/render_process_host_impl.cc (right): https://codereview.chromium.org/2446553002/diff/120001/content/browser/render... content/browser/renderer_host/render_process_host_impl.cc:1414: weak_factory_.GetWeakPtr()); On 2016/10/31 14:50:32, horo wrote: > WeakPtr is not thread safe. > So we should not pass the MojoURLLoaderFactoryGetter to the IO thread. > http://www.chromium.org/developers/design-documents/threading#base_WeakPtr_an... > > I will create another CL to avoid this problem. > > Sorry for confusion. I'll wait for the update before a full review. Just one thing: if there are specific expectations about the value returned from CreateURLLoaderFactoryGetter (i.e. used on a different thread than where it's queried?), can you document that in the API? FYI, WeakPtr is not generally thread-safe, however it can be copied to other threads - I don't know if that matters to you. The restriction is that it can only be dereferenced on the same thread as it gets cancelled (i.e. the thread the WeakPtrFactory gets destroyed).
Message was sent while issue was closed.
On 2016/10/31 20:43:25, piman wrote: > https://codereview.chromium.org/2446553002/diff/120001/content/browser/render... > File content/browser/renderer_host/render_process_host_impl.cc (right): > > https://codereview.chromium.org/2446553002/diff/120001/content/browser/render... > content/browser/renderer_host/render_process_host_impl.cc:1414: > weak_factory_.GetWeakPtr()); > On 2016/10/31 14:50:32, horo wrote: > > WeakPtr is not thread safe. > > So we should not pass the MojoURLLoaderFactoryGetter to the IO thread. > > > http://www.chromium.org/developers/design-documents/threading#base_WeakPtr_an... > > > > I will create another CL to avoid this problem. > > > > Sorry for confusion. > > I'll wait for the update before a full review. Just one thing: if there are > specific expectations about the value returned from CreateURLLoaderFactoryGetter > (i.e. used on a different thread than where it's queried?), can you document > that in the API? > > FYI, WeakPtr is not generally thread-safe, however it can be copied to other > threads - I don't know if that matters to you. The restriction is that it can > only be dereferenced on the same thread as it gets cancelled (i.e. the thread > the WeakPtrFactory gets destroyed). ServiceWorkerFetchDispatcher::MaybeStartNavigationPreload() executes the MojoURLLoaderFactoryGetter on the IO thread. But the WeakPtr is dereferenced on the UI thread in the destructor of RenderProcessHostImpl. So it is the problem.
Message was sent while issue was closed.
On 2016/10/31 22:09:42, horo wrote: > On 2016/10/31 20:43:25, piman wrote: > > > https://codereview.chromium.org/2446553002/diff/120001/content/browser/render... > > File content/browser/renderer_host/render_process_host_impl.cc (right): > > > > > https://codereview.chromium.org/2446553002/diff/120001/content/browser/render... > > content/browser/renderer_host/render_process_host_impl.cc:1414: > > weak_factory_.GetWeakPtr()); > > On 2016/10/31 14:50:32, horo wrote: > > > WeakPtr is not thread safe. > > > So we should not pass the MojoURLLoaderFactoryGetter to the IO thread. > > > > > > http://www.chromium.org/developers/design-documents/threading#base_WeakPtr_an... > > > > > > I will create another CL to avoid this problem. > > > > > > Sorry for confusion. > > > > I'll wait for the update before a full review. Just one thing: if there are > > specific expectations about the value returned from > CreateURLLoaderFactoryGetter > > (i.e. used on a different thread than where it's queried?), can you document > > that in the API? > > > > FYI, WeakPtr is not generally thread-safe, however it can be copied to other > > threads - I don't know if that matters to you. The restriction is that it can > > only be dereferenced on the same thread as it gets cancelled (i.e. the thread > > the WeakPtrFactory gets destroyed). > > ServiceWorkerFetchDispatcher::MaybeStartNavigationPreload() executes the > MojoURLLoaderFactoryGetter on the IO thread. > But the WeakPtr is dereferenced on the UI thread in the destructor of > RenderProcessHostImpl. > So it is the problem. I created two CLs. - Stop using MojoURLLoaderFactoryGetter https://codereview.chromium.org/2465813003/ - Support Service Worker NavigationPreload with PlzNavigate (without MojoURLLoaderFactoryGetter) https://codereview.chromium.org/2460223003/ |