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

Side by Side Diff: content/browser/service_worker/foreign_fetch_request_handler.cc

Issue 2410333006: Implement ServiceWorkerFetchDispatcher::MaybeStartNavigationPreload(). (Closed)
Patch Set: add comment in service_worker_url_request_job.h Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/foreign_fetch_request_handler.h" 5 #include "content/browser/service_worker/foreign_fetch_request_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "content/browser/service_worker/service_worker_context_wrapper.h" 11 #include "content/browser/service_worker/service_worker_context_wrapper.h"
12 #include "content/browser/service_worker/service_worker_response_info.h" 12 #include "content/browser/service_worker/service_worker_response_info.h"
13 #include "content/browser/service_worker/service_worker_url_request_job.h" 13 #include "content/browser/service_worker/service_worker_url_request_job.h"
14 #include "content/common/resource_request_body_impl.h" 14 #include "content/common/resource_request_body_impl.h"
15 #include "content/common/service_worker/service_worker_types.h"
15 #include "content/common/service_worker/service_worker_utils.h" 16 #include "content/common/service_worker/service_worker_utils.h"
16 #include "content/public/browser/content_browser_client.h" 17 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/browser/resource_request_info.h" 18 #include "content/public/browser/resource_request_info.h"
18 #include "content/public/common/content_client.h" 19 #include "content/public/common/content_client.h"
19 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
20 #include "content/public/common/origin_trial_policy.h" 21 #include "content/public/common/origin_trial_policy.h"
21 #include "net/url_request/url_request.h" 22 #include "net/url_request/url_request.h"
22 #include "net/url_request/url_request_interceptor.h" 23 #include "net/url_request/url_request_interceptor.h"
23 #include "storage/browser/blob/blob_storage_context.h" 24 #include "storage/browser/blob/blob_storage_context.h"
24 25
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 return nullptr; 153 return nullptr;
153 } 154 }
154 155
155 // It's for original request (A) or redirect case (B-a or B-b). 156 // It's for original request (A) or redirect case (B-a or B-b).
156 DCHECK(!job_.get() || job_->ShouldForwardToServiceWorker()); 157 DCHECK(!job_.get() || job_->ShouldForwardToServiceWorker());
157 158
158 ServiceWorkerURLRequestJob* job = new ServiceWorkerURLRequestJob( 159 ServiceWorkerURLRequestJob* job = new ServiceWorkerURLRequestJob(
159 request, network_delegate, std::string(), blob_storage_context_, 160 request, network_delegate, std::string(), blob_storage_context_,
160 resource_context, request_mode_, credentials_mode_, redirect_mode_, 161 resource_context, request_mode_, credentials_mode_, redirect_mode_,
161 resource_type_, request_context_type_, frame_type_, body_, 162 resource_type_, request_context_type_, frame_type_, body_,
162 ServiceWorkerFetchType::FOREIGN_FETCH, this); 163 ServiceWorkerFetchType::FOREIGN_FETCH, MojoURLLoaderFactoryGetter(),
164 this);
163 job_ = job->GetWeakPtr(); 165 job_ = job->GetWeakPtr();
164 resource_context_ = resource_context; 166 resource_context_ = resource_context;
165 167
166 context_->FindReadyRegistrationForDocument( 168 context_->FindReadyRegistrationForDocument(
167 request->url(), 169 request->url(),
168 base::Bind(&ForeignFetchRequestHandler::DidFindRegistration, 170 base::Bind(&ForeignFetchRequestHandler::DidFindRegistration,
169 weak_factory_.GetWeakPtr(), job_)); 171 weak_factory_.GetWeakPtr(), job_));
170 172
171 return job_.get(); 173 return job_.get();
172 } 174 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 return target_worker_.get(); 266 return target_worker_.get();
265 } 267 }
266 268
267 void ForeignFetchRequestHandler::ClearJob() { 269 void ForeignFetchRequestHandler::ClearJob() {
268 job_.reset(); 270 job_.reset();
269 target_worker_ = nullptr; 271 target_worker_ = nullptr;
270 resource_context_ = nullptr; 272 resource_context_ = nullptr;
271 } 273 }
272 274
273 } // namespace content 275 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698