OLD | NEW |
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_url_request_job.h" | 5 #include "content/browser/service_worker/service_worker_url_request_job.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <limits> | 10 #include <limits> |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 // 3) The request is for New Tab Page. This is because it tends to dominate | 672 // 3) The request is for New Tab Page. This is because it tends to dominate |
673 // the stats and makes the results largely skewed. | 673 // the stats and makes the results largely skewed. |
674 if (resource_type_ != RESOURCE_TYPE_MAIN_FRAME) | 674 if (resource_type_ != RESOURCE_TYPE_MAIN_FRAME) |
675 return; | 675 return; |
676 if (!worker_already_activated_) | 676 if (!worker_already_activated_) |
677 return; | 677 return; |
678 if (version->skip_recording_startup_time() && | 678 if (version->skip_recording_startup_time() && |
679 initial_worker_status_ != EmbeddedWorkerStatus::RUNNING) { | 679 initial_worker_status_ != EmbeddedWorkerStatus::RUNNING) { |
680 return; | 680 return; |
681 } | 681 } |
682 if (ServiceWorkerMetrics::ShouldExcludeURLFromHistogram(request()->url())) | 682 if (ServiceWorkerMetrics::ShouldExcludeSiteFromHistogram( |
| 683 version->site_for_uma())) { |
683 return; | 684 return; |
| 685 } |
684 ServiceWorkerMetrics::RecordActivatedWorkerPreparationTimeForMainFrame( | 686 ServiceWorkerMetrics::RecordActivatedWorkerPreparationTimeForMainFrame( |
685 worker_ready_time_ - request()->creation_time(), initial_worker_status_, | 687 worker_ready_time_ - request()->creation_time(), initial_worker_status_, |
686 version->embedded_worker()->start_situation()); | 688 version->embedded_worker()->start_situation()); |
687 } | 689 } |
688 | 690 |
689 void ServiceWorkerURLRequestJob::DidDispatchFetchEvent( | 691 void ServiceWorkerURLRequestJob::DidDispatchFetchEvent( |
690 ServiceWorkerStatusCode status, | 692 ServiceWorkerStatusCode status, |
691 ServiceWorkerFetchEventResult fetch_result, | 693 ServiceWorkerFetchEventResult fetch_result, |
692 const ServiceWorkerResponse& response, | 694 const ServiceWorkerResponse& response, |
693 const scoped_refptr<ServiceWorkerVersion>& version) { | 695 const scoped_refptr<ServiceWorkerVersion>& version) { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 CreateFetchRequest(), active_worker, resource_type_, request()->net_log(), | 1040 CreateFetchRequest(), active_worker, resource_type_, request()->net_log(), |
1039 base::Bind(&ServiceWorkerURLRequestJob::DidPrepareFetchEvent, | 1041 base::Bind(&ServiceWorkerURLRequestJob::DidPrepareFetchEvent, |
1040 weak_factory_.GetWeakPtr(), active_worker), | 1042 weak_factory_.GetWeakPtr(), active_worker), |
1041 base::Bind(&ServiceWorkerURLRequestJob::DidDispatchFetchEvent, | 1043 base::Bind(&ServiceWorkerURLRequestJob::DidDispatchFetchEvent, |
1042 weak_factory_.GetWeakPtr()))); | 1044 weak_factory_.GetWeakPtr()))); |
1043 worker_start_time_ = base::TimeTicks::Now(); | 1045 worker_start_time_ = base::TimeTicks::Now(); |
1044 fetch_dispatcher_->Run(); | 1046 fetch_dispatcher_->Run(); |
1045 } | 1047 } |
1046 | 1048 |
1047 } // namespace content | 1049 } // namespace content |
OLD | NEW |