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

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

Issue 1795863006: service worker: Attribute purpose to start worker attempts for UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch for landing? Created 4 years, 9 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>
8
7 #include "base/macros.h" 9 #include "base/macros.h"
8 #include "content/browser/service_worker/service_worker_context_wrapper.h" 10 #include "content/browser/service_worker/service_worker_context_wrapper.h"
9 #include "content/browser/service_worker/service_worker_url_request_job.h" 11 #include "content/browser/service_worker/service_worker_url_request_job.h"
10 #include "content/common/resource_request_body.h" 12 #include "content/common/resource_request_body.h"
11 #include "content/common/service_worker/service_worker_utils.h" 13 #include "content/common/service_worker/service_worker_utils.h"
12 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
13 #include "net/url_request/url_request_interceptor.h" 15 #include "net/url_request/url_request_interceptor.h"
14 #include "storage/browser/blob/blob_storage_context.h" 16 #include "storage/browser/blob/blob_storage_context.h"
15 17
16 namespace content { 18 namespace content {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // TODO(mek): Determine if redirects should be able to be intercepted by 115 // TODO(mek): Determine if redirects should be able to be intercepted by
114 // other foreign fetch service workers. 116 // other foreign fetch service workers.
115 return nullptr; 117 return nullptr;
116 } 118 }
117 119
118 // It's for original request (A) or redirect case (B-a or B-b). 120 // It's for original request (A) or redirect case (B-a or B-b).
119 DCHECK(!job_.get() || job_->ShouldForwardToServiceWorker()); 121 DCHECK(!job_.get() || job_->ShouldForwardToServiceWorker());
120 122
121 ServiceWorkerURLRequestJob* job = new ServiceWorkerURLRequestJob( 123 ServiceWorkerURLRequestJob* job = new ServiceWorkerURLRequestJob(
122 request, network_delegate, std::string(), blob_storage_context_, 124 request, network_delegate, std::string(), blob_storage_context_,
123 resource_context, request_mode_, credentials_mode_, redirect_mode_, false, 125 resource_context, request_mode_, credentials_mode_, redirect_mode_,
124 request_context_type_, frame_type_, body_, 126 resource_type_, request_context_type_, frame_type_, body_,
125 ServiceWorkerFetchType::FOREIGN_FETCH, this); 127 ServiceWorkerFetchType::FOREIGN_FETCH, this);
126 job_ = job->GetWeakPtr(); 128 job_ = job->GetWeakPtr();
127 129
128 context_->FindReadyRegistrationForDocument( 130 context_->FindReadyRegistrationForDocument(
129 request->url(), 131 request->url(),
130 base::Bind(&ForeignFetchRequestHandler::DidFindRegistration, 132 base::Bind(&ForeignFetchRequestHandler::DidFindRegistration,
131 weak_factory_.GetWeakPtr(), job_)); 133 weak_factory_.GetWeakPtr(), job_));
132 134
133 return job_.get(); 135 return job_.get();
134 } 136 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 223 }
222 return target_worker_.get(); 224 return target_worker_.get();
223 } 225 }
224 226
225 void ForeignFetchRequestHandler::ClearJob() { 227 void ForeignFetchRequestHandler::ClearJob() {
226 job_.reset(); 228 job_.reset();
227 target_worker_ = nullptr; 229 target_worker_ = nullptr;
228 } 230 }
229 231
230 } // namespace content 232 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698