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

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

Issue 2654663004: [Not for review] record detailed time breakdown of SW related requests.
Patch Set: add stream uma Created 3 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/service_worker_request_handler.h" 5 #include "content/browser/service_worker/service_worker_request_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 net::URLRequest* request, 59 net::URLRequest* request,
60 ServiceWorkerProviderHost* provider_host, 60 ServiceWorkerProviderHost* provider_host,
61 storage::BlobStorageContext* blob_storage_context, 61 storage::BlobStorageContext* blob_storage_context,
62 bool skip_service_worker, 62 bool skip_service_worker,
63 FetchRequestMode request_mode, 63 FetchRequestMode request_mode,
64 FetchCredentialsMode credentials_mode, 64 FetchCredentialsMode credentials_mode,
65 FetchRedirectMode redirect_mode, 65 FetchRedirectMode redirect_mode,
66 ResourceType resource_type, 66 ResourceType resource_type,
67 RequestContextType request_context_type, 67 RequestContextType request_context_type,
68 RequestContextFrameType frame_type, 68 RequestContextFrameType frame_type,
69 scoped_refptr<ResourceRequestBodyImpl> body) { 69 scoped_refptr<ResourceRequestBodyImpl> body,
70 base::TimeTicks request_start = base::TimeTicks()) {
70 std::unique_ptr<ServiceWorkerRequestHandler> handler( 71 std::unique_ptr<ServiceWorkerRequestHandler> handler(
71 provider_host->CreateRequestHandler( 72 provider_host->CreateRequestHandler(
72 request_mode, credentials_mode, redirect_mode, resource_type, 73 request_mode, credentials_mode, redirect_mode, resource_type,
73 request_context_type, frame_type, blob_storage_context->AsWeakPtr(), 74 request_context_type, frame_type, blob_storage_context->AsWeakPtr(),
74 body, skip_service_worker)); 75 body, skip_service_worker, request_start));
75 if (!handler) 76 if (!handler)
76 return; 77 return;
77 78
78 request->SetUserData(&kUserDataKey, handler.release()); 79 request->SetUserData(&kUserDataKey, handler.release());
79 } 80 }
80 81
81 } // namespace 82 } // namespace
82 83
83 // PlzNavigate 84 // PlzNavigate
84 void ServiceWorkerRequestHandler::InitializeForNavigation( 85 void ServiceWorkerRequestHandler::InitializeForNavigation(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 storage::BlobStorageContext* blob_storage_context, 138 storage::BlobStorageContext* blob_storage_context,
138 int process_id, 139 int process_id,
139 int provider_id, 140 int provider_id,
140 bool skip_service_worker, 141 bool skip_service_worker,
141 FetchRequestMode request_mode, 142 FetchRequestMode request_mode,
142 FetchCredentialsMode credentials_mode, 143 FetchCredentialsMode credentials_mode,
143 FetchRedirectMode redirect_mode, 144 FetchRedirectMode redirect_mode,
144 ResourceType resource_type, 145 ResourceType resource_type,
145 RequestContextType request_context_type, 146 RequestContextType request_context_type,
146 RequestContextFrameType frame_type, 147 RequestContextFrameType frame_type,
147 scoped_refptr<ResourceRequestBodyImpl> body) { 148 scoped_refptr<ResourceRequestBodyImpl> body,
149 base::TimeTicks request_start) {
148 // Create the handler even for insecure HTTP since it's used in the 150 // Create the handler even for insecure HTTP since it's used in the
149 // case of redirect to HTTPS. 151 // case of redirect to HTTPS.
150 if (!request->url().SchemeIsHTTPOrHTTPS() && 152 if (!request->url().SchemeIsHTTPOrHTTPS() &&
151 !OriginCanAccessServiceWorkers(request->url())) { 153 !OriginCanAccessServiceWorkers(request->url())) {
152 return; 154 return;
153 } 155 }
154 156
155 if (!context_wrapper || !context_wrapper->context() || 157 if (!context_wrapper || !context_wrapper->context() ||
156 provider_id == kInvalidServiceWorkerProviderId) { 158 provider_id == kInvalidServiceWorkerProviderId) {
157 return; 159 return;
158 } 160 }
159 161
160 ServiceWorkerProviderHost* provider_host = 162 ServiceWorkerProviderHost* provider_host =
161 context_wrapper->context()->GetProviderHost(process_id, provider_id); 163 context_wrapper->context()->GetProviderHost(process_id, provider_id);
162 if (!provider_host || !provider_host->IsContextAlive()) 164 if (!provider_host || !provider_host->IsContextAlive())
163 return; 165 return;
164 166
165 FinalizeHandlerInitialization(request, provider_host, blob_storage_context, 167 FinalizeHandlerInitialization(
166 skip_service_worker, request_mode, 168 request, provider_host, blob_storage_context, skip_service_worker,
167 credentials_mode, redirect_mode, resource_type, 169 request_mode, credentials_mode, redirect_mode, resource_type,
168 request_context_type, frame_type, body); 170 request_context_type, frame_type, body, request_start);
169 } 171 }
170 172
171 ServiceWorkerRequestHandler* ServiceWorkerRequestHandler::GetHandler( 173 ServiceWorkerRequestHandler* ServiceWorkerRequestHandler::GetHandler(
172 const net::URLRequest* request) { 174 const net::URLRequest* request) {
173 return static_cast<ServiceWorkerRequestHandler*>( 175 return static_cast<ServiceWorkerRequestHandler*>(
174 request->GetUserData(&kUserDataKey)); 176 request->GetUserData(&kUserDataKey));
175 } 177 }
176 178
177 std::unique_ptr<net::URLRequestInterceptor> 179 std::unique_ptr<net::URLRequestInterceptor>
178 ServiceWorkerRequestHandler::CreateInterceptor( 180 ServiceWorkerRequestHandler::CreateInterceptor(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 ResourceType resource_type) 248 ResourceType resource_type)
247 : context_(context), 249 : context_(context),
248 provider_host_(provider_host), 250 provider_host_(provider_host),
249 blob_storage_context_(blob_storage_context), 251 blob_storage_context_(blob_storage_context),
250 resource_type_(resource_type), 252 resource_type_(resource_type),
251 old_process_id_(0), 253 old_process_id_(0),
252 old_provider_id_(kInvalidServiceWorkerProviderId) { 254 old_provider_id_(kInvalidServiceWorkerProviderId) {
253 } 255 }
254 256
255 } // namespace content 257 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698