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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1294243004: PlzNavigate: Make ServiceWorker work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 1b7414704aa5e75c32f8a2fbbdd56943d4d115ed..2267097014afb013c088f9090e73b0f023036c2b 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -34,6 +34,7 @@
#include "content/browser/download/save_file_manager.h"
#include "content/browser/download/save_file_resource_handler.h"
#include "content/browser/fileapi/chrome_blob_storage_context.h"
+#include "content/browser/frame_host/navigation_request.h"
#include "content/browser/frame_host/navigation_request_info.h"
#include "content/browser/frame_host/navigator.h"
#include "content/browser/loader/async_resource_handler.h"
@@ -54,6 +55,7 @@
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/resource_context_impl.h"
+#include "content/browser/service_worker/service_worker_provider_host.h"
#include "content/browser/service_worker/service_worker_request_handler.h"
#include "content/browser/streams/stream.h"
#include "content/browser/streams/stream_context.h"
@@ -1956,9 +1958,9 @@ void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest(
void ResourceDispatcherHostImpl::BeginNavigationRequest(
ResourceContext* resource_context,
- int frame_tree_node_id,
const NavigationRequestInfo& info,
- NavigationURLLoaderImplCore* loader) {
+ NavigationURLLoaderImplCore* loader,
+ ServiceWorkerContextWrapper* service_worker_context) {
michaeln 2015/10/01 01:42:15 interesting failure mode potential, what if servi
Fabrice (no longer in Chrome) 2015/10/01 18:29:55 I'm not sure I follow? This is called from the loa
// PlzNavigate: BeginNavigationRequest currently should only be used for the
// browser-side navigations project.
CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
@@ -2023,10 +2025,11 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
new_request->SetLoadFlags(load_flags);
+ storage::BlobStorageContext* blob_context = GetBlobStorageContext(
+ GetChromeBlobStorageContextForResourceContext(resource_context));
+
// Resolve elements from request_body and prepare upload data.
if (info.request_body.get()) {
- storage::BlobStorageContext* blob_context = GetBlobStorageContext(
- GetChromeBlobStorageContextForResourceContext(resource_context));
AttachRequestBodyBlobDataHandles(
info.request_body.get(),
blob_context);
@@ -2092,8 +2095,21 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
blob_context->context()->GetBlobDataFromPublicURL(new_request->url()));
}
- // TODO(davidben): Attach ServiceWorkerRequestHandler.
- // TODO(michaeln): Help out with this and that.
+ RequestContextFrameType frame_type = info.is_main_frame ?
+ REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL :
+ REQUEST_CONTEXT_FRAME_TYPE_NESTED;
+ // TODO: sync loads should set skip_service_worker to true.
michaeln 2015/10/01 01:42:15 can there be a sync plznav load? if not probably s
Fabrice (no longer in Chrome) 2015/10/01 18:29:55 This is now taken care of, see comments in render_
+ ServiceWorkerRequestHandler::InitializeForNavigation(
+ new_request.get(),
+ service_worker_context,
+ blob_context,
+ info.request_params.service_worker_provider_id,
+ info.begin_params.skip_service_worker,
+ resource_type,
+ info.begin_params.request_context_type,
+ frame_type,
+ info.request_body);
+
// TODO(davidben): Attach AppCacheInterceptor.
scoped_ptr<ResourceHandler> handler(new NavigationResourceHandler(

Powered by Google App Engine
This is Rietveld 408576698