| 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 <map> |   10 #include <map> | 
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  340   *info = *http_info(); |  340   *info = *http_info(); | 
|  341   info->request_time = request_time; |  341   info->request_time = request_time; | 
|  342   info->response_time = response_time_; |  342   info->response_time = response_time_; | 
|  343 } |  343 } | 
|  344  |  344  | 
|  345 void ServiceWorkerURLRequestJob::GetLoadTimingInfo( |  345 void ServiceWorkerURLRequestJob::GetLoadTimingInfo( | 
|  346     net::LoadTimingInfo* load_timing_info) const { |  346     net::LoadTimingInfo* load_timing_info) const { | 
|  347   *load_timing_info = load_timing_info_; |  347   *load_timing_info = load_timing_info_; | 
|  348 } |  348 } | 
|  349  |  349  | 
|  350 int ServiceWorkerURLRequestJob::GetResponseCode() const { |  | 
|  351   if (!http_info()) |  | 
|  352     return -1; |  | 
|  353   return http_info()->headers->response_code(); |  | 
|  354 } |  | 
|  355  |  | 
|  356 void ServiceWorkerURLRequestJob::SetExtraRequestHeaders( |  350 void ServiceWorkerURLRequestJob::SetExtraRequestHeaders( | 
|  357     const net::HttpRequestHeaders& headers) { |  351     const net::HttpRequestHeaders& headers) { | 
|  358   std::string range_header; |  352   std::string range_header; | 
|  359   std::vector<net::HttpByteRange> ranges; |  353   std::vector<net::HttpByteRange> ranges; | 
|  360   if (!headers.GetHeader(net::HttpRequestHeaders::kRange, &range_header) || |  354   if (!headers.GetHeader(net::HttpRequestHeaders::kRange, &range_header) || | 
|  361       !net::HttpUtil::ParseRangeHeader(range_header, &ranges)) { |  355       !net::HttpUtil::ParseRangeHeader(range_header, &ranges)) { | 
|  362     return; |  356     return; | 
|  363   } |  357   } | 
|  364  |  358  | 
|  365   // We don't support multiple range requests in one single URL request. |  359   // We don't support multiple range requests in one single URL request. | 
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  910   DCHECK(!reported_navigation_preload_metrics_); |  904   DCHECK(!reported_navigation_preload_metrics_); | 
|  911   reported_navigation_preload_metrics_ = true; |  905   reported_navigation_preload_metrics_ = true; | 
|  912  |  906  | 
|  913   ServiceWorkerMetrics::RecordNavigationPreloadResponse( |  907   ServiceWorkerMetrics::RecordNavigationPreloadResponse( | 
|  914       worker_ready_time_ - worker_start_time_, |  908       worker_ready_time_ - worker_start_time_, | 
|  915       navigation_preload_response_time_ - worker_start_time_, |  909       navigation_preload_response_time_ - worker_start_time_, | 
|  916       initial_worker_status_, worker_start_situation_); |  910       initial_worker_status_, worker_start_situation_); | 
|  917 } |  911 } | 
|  918  |  912  | 
|  919 }  // namespace content |  913 }  // namespace content | 
| OLD | NEW |