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

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, 4 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 a458b8d71cb8ddf98f0b5357965d56a48197d9c6..bacd02ec0bcd7e14cf708924029730ebda36a623 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -53,6 +53,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"
@@ -1360,7 +1361,7 @@ void ResourceDispatcherHostImpl::BeginRequest(
request_data.fetch_request_mode, request_data.fetch_credentials_mode,
request_data.fetch_redirect_mode, request_data.resource_type,
request_data.fetch_request_context_type, request_data.fetch_frame_type,
- request_data.request_body);
+ request_data.request_body, nullptr);
// Have the appcache associate its extra info with the request.
AppCacheInterceptor::SetExtraRequestInfo(
@@ -1937,7 +1938,8 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
ResourceContext* resource_context,
int frame_tree_node_id,
const NavigationRequestInfo& info,
- NavigationURLLoaderImplCore* loader) {
+ NavigationURLLoaderImplCore* loader,
+ ServiceWorkerContextWrapper* service_worker_context) {
// PlzNavigate: BeginNavigationRequest currently should only be used for the
// browser-side navigations project.
CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
@@ -2002,10 +2004,10 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
new_request->SetLoadFlags(load_flags);
+ storage::BlobStorageContext* blob_context = GetBlobStorageContext(
+ GetChromeBlobStorageContextForResourceContext(resource_context));
clamy 2015/08/31 12:09:27 nit: extra line needed.
Fabrice (no longer in Chrome) 2015/08/31 14:00:35 You mean a new line? Done.
// 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);
@@ -2071,8 +2073,26 @@ 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.
+ ServiceWorkerRequestHandler::InitializeHandler(
+ new_request.get(),
+ service_worker_context,
+ blob_context,
+ (filter_ != nullptr) ? filter_->child_id() : -1,
+ info.common_params.service_worker_provider_id,
+ info.begin_params.skip_service_worker,
+ FETCH_REQUEST_MODE_NO_CORS,
+ FETCH_CREDENTIALS_MODE_SAME_ORIGIN,
+ FetchRedirectMode::FOLLOW_MODE,
+ resource_type,
+ info.begin_params.request_context_type,
+ frame_type,
+ info.request_body,
+ loader);
+
// TODO(davidben): Attach AppCacheInterceptor.
scoped_ptr<ResourceHandler> handler(new NavigationResourceHandler(

Powered by Google App Engine
This is Rietveld 408576698