| 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 "chrome/browser/net/resource_prefetch_predictor_observer.h" | 5 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 ReportRequestStats(REQUEST_STATS_NO_RENDER_FRAME_ID_FROM_REQUEST_INFO); | 65 ReportRequestStats(REQUEST_STATS_NO_RENDER_FRAME_ID_FROM_REQUEST_INFO); |
| 66 return false; | 66 return false; |
| 67 } | 67 } |
| 68 | 68 |
| 69 summary->navigation_id.render_process_id = render_process_id; | 69 summary->navigation_id.render_process_id = render_process_id; |
| 70 summary->navigation_id.render_frame_id = render_frame_id; | 70 summary->navigation_id.render_frame_id = render_frame_id; |
| 71 summary->navigation_id.main_frame_url = request->first_party_for_cookies(); | 71 summary->navigation_id.main_frame_url = request->first_party_for_cookies(); |
| 72 summary->navigation_id.creation_time = request->creation_time(); | 72 summary->navigation_id.creation_time = request->creation_time(); |
| 73 summary->resource_url = request->original_url(); | 73 summary->resource_url = request->original_url(); |
| 74 summary->resource_type = info->GetResourceType(); | 74 summary->resource_type = info->GetResourceType(); |
| 75 summary->priority = request->priority(); |
| 75 request->GetMimeType(&summary->mime_type); | 76 request->GetMimeType(&summary->mime_type); |
| 76 summary->was_cached = request->was_cached(); | 77 summary->was_cached = request->was_cached(); |
| 77 | 78 |
| 78 // Use the mime_type to determine the resource type for subresources since | 79 // Use the mime_type to determine the resource type for subresources since |
| 79 // types such as PREFETCH, SUB_RESOURCE, etc are not useful. | 80 // types such as PREFETCH, SUB_RESOURCE, etc are not useful. |
| 80 if (summary->resource_type != content::RESOURCE_TYPE_MAIN_FRAME) { | 81 if (summary->resource_type != content::RESOURCE_TYPE_MAIN_FRAME) { |
| 81 summary->resource_type = | 82 summary->resource_type = |
| 82 ResourcePrefetchPredictor::GetResourceTypeFromMimeType( | 83 ResourcePrefetchPredictor::GetResourceTypeFromMimeType( |
| 83 summary->mime_type, | 84 summary->mime_type, |
| 84 summary->resource_type); | 85 summary->resource_type); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 summary)); | 195 summary)); |
| 195 | 196 |
| 196 ReportRequestStats(REQUEST_STATS_TOTAL_PROCESSED_RESPONSES); | 197 ReportRequestStats(REQUEST_STATS_TOTAL_PROCESSED_RESPONSES); |
| 197 if (request_info && | 198 if (request_info && |
| 198 request_info->GetResourceType() == content::RESOURCE_TYPE_MAIN_FRAME) { | 199 request_info->GetResourceType() == content::RESOURCE_TYPE_MAIN_FRAME) { |
| 199 ReportMainFrameRequestStats(MAIN_FRAME_REQUEST_STATS_PROCESSED_RESPONSES); | 200 ReportMainFrameRequestStats(MAIN_FRAME_REQUEST_STATS_PROCESSED_RESPONSES); |
| 200 } | 201 } |
| 201 } | 202 } |
| 202 | 203 |
| 203 } // namespace chrome_browser_net | 204 } // namespace chrome_browser_net |
| OLD | NEW |