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

Side by Side Diff: content/browser/service_worker/service_worker_provider_host.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_provider_host.h" 5 #include "content/browser/service_worker/service_worker_provider_host.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 std::unique_ptr<ServiceWorkerRequestHandler> 364 std::unique_ptr<ServiceWorkerRequestHandler>
365 ServiceWorkerProviderHost::CreateRequestHandler( 365 ServiceWorkerProviderHost::CreateRequestHandler(
366 FetchRequestMode request_mode, 366 FetchRequestMode request_mode,
367 FetchCredentialsMode credentials_mode, 367 FetchCredentialsMode credentials_mode,
368 FetchRedirectMode redirect_mode, 368 FetchRedirectMode redirect_mode,
369 ResourceType resource_type, 369 ResourceType resource_type,
370 RequestContextType request_context_type, 370 RequestContextType request_context_type,
371 RequestContextFrameType frame_type, 371 RequestContextFrameType frame_type,
372 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, 372 base::WeakPtr<storage::BlobStorageContext> blob_storage_context,
373 scoped_refptr<ResourceRequestBodyImpl> body, 373 scoped_refptr<ResourceRequestBodyImpl> body,
374 bool skip_service_worker) { 374 bool skip_service_worker,
375 base::TimeTicks request_start) {
375 // |skip_service_worker| is meant to apply to requests that could be handled 376 // |skip_service_worker| is meant to apply to requests that could be handled
376 // by a service worker, as opposed to requests for the service worker script 377 // by a service worker, as opposed to requests for the service worker script
377 // itself. So ignore it here for the service worker script and its imported 378 // itself. So ignore it here for the service worker script and its imported
378 // scripts. 379 // scripts.
379 // TODO(falken): Really it should be treated as an error to set 380 // TODO(falken): Really it should be treated as an error to set
380 // |skip_service_worker| for requests to start the service worker, but it's 381 // |skip_service_worker| for requests to start the service worker, but it's
381 // difficult to fix that renderer-side, since we don't know whether a request 382 // difficult to fix that renderer-side, since we don't know whether a request
382 // is for a service worker without access to IsHostToRunningServiceWorker() as 383 // is for a service worker without access to IsHostToRunningServiceWorker() as
383 // that state is stored browser-side. 384 // that state is stored browser-side.
384 if (IsHostToRunningServiceWorker() && 385 if (IsHostToRunningServiceWorker() &&
385 (resource_type == RESOURCE_TYPE_SERVICE_WORKER || 386 (resource_type == RESOURCE_TYPE_SERVICE_WORKER ||
386 resource_type == RESOURCE_TYPE_SCRIPT)) { 387 resource_type == RESOURCE_TYPE_SCRIPT)) {
387 skip_service_worker = false; 388 skip_service_worker = false;
388 } 389 }
389 if (skip_service_worker) { 390 if (skip_service_worker) {
390 if (!ServiceWorkerUtils::IsMainResourceType(resource_type)) 391 if (!ServiceWorkerUtils::IsMainResourceType(resource_type))
391 return std::unique_ptr<ServiceWorkerRequestHandler>(); 392 return std::unique_ptr<ServiceWorkerRequestHandler>();
392 return base::MakeUnique<ServiceWorkerURLTrackingRequestHandler>( 393 return base::MakeUnique<ServiceWorkerURLTrackingRequestHandler>(
393 context_, AsWeakPtr(), blob_storage_context, resource_type); 394 context_, AsWeakPtr(), blob_storage_context, resource_type);
394 } 395 }
395 if (IsHostToRunningServiceWorker()) { 396 if (IsHostToRunningServiceWorker()) {
396 return base::MakeUnique<ServiceWorkerContextRequestHandler>( 397 return base::MakeUnique<ServiceWorkerContextRequestHandler>(
397 context_, AsWeakPtr(), blob_storage_context, resource_type); 398 context_, AsWeakPtr(), blob_storage_context, resource_type,
399 request_start);
398 } 400 }
399 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || 401 if (ServiceWorkerUtils::IsMainResourceType(resource_type) ||
400 controlling_version()) { 402 controlling_version()) {
401 return base::MakeUnique<ServiceWorkerControlleeRequestHandler>( 403 return base::MakeUnique<ServiceWorkerControlleeRequestHandler>(
402 context_, AsWeakPtr(), blob_storage_context, request_mode, 404 context_, AsWeakPtr(), blob_storage_context, request_mode,
403 credentials_mode, redirect_mode, resource_type, request_context_type, 405 credentials_mode, redirect_mode, resource_type, request_context_type,
404 frame_type, body); 406 frame_type, body, request_start);
405 } 407 }
406 return std::unique_ptr<ServiceWorkerRequestHandler>(); 408 return std::unique_ptr<ServiceWorkerRequestHandler>();
407 } 409 }
408 410
409 ServiceWorkerObjectInfo 411 ServiceWorkerObjectInfo
410 ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle( 412 ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle(
411 ServiceWorkerVersion* version) { 413 ServiceWorkerVersion* version) {
412 DCHECK(dispatcher_host_); 414 DCHECK(dispatcher_host_);
413 if (!context_ || !version) 415 if (!context_ || !version)
414 return ServiceWorkerObjectInfo(); 416 return ServiceWorkerObjectInfo();
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 Send(new ServiceWorkerMsg_SetControllerServiceWorker( 732 Send(new ServiceWorkerMsg_SetControllerServiceWorker(
731 render_thread_id_, provider_id(), 733 render_thread_id_, provider_id(),
732 GetOrCreateServiceWorkerHandle( 734 GetOrCreateServiceWorkerHandle(
733 associated_registration_->active_version()), 735 associated_registration_->active_version()),
734 false /* shouldNotifyControllerChange */)); 736 false /* shouldNotifyControllerChange */));
735 } 737 }
736 } 738 }
737 } 739 }
738 740
739 } // namespace content 741 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698