Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/loading_predictor_observer.h" | 5 #include "chrome/browser/net/loading_predictor_observer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/browser/resource_request_info.h" | 14 #include "content/public/browser/resource_request_info.h" |
| 15 #include "net/url_request/url_request.h" | 15 #include "net/url_request/url_request.h" |
| 16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 class WebContents; | 19 class WebContents; |
| 20 } | 20 } |
| 21 | 21 |
| 22 using content::BrowserThread; | 22 using content::BrowserThread; |
| 23 using predictors::LoadingPredictor; | 23 using predictors::LoadingPredictor; |
| 24 using predictors::LoadingDataCollector; | 24 using predictors::LoadingDataCollector; |
| 25 using URLRequestSummary = | 25 using URLRequestSummary = predictors::URLRequestSummary; |
|
alexilin
2017/06/16 09:31:57
nit:
Why not `using predictors::URLRequestSummary;
trevordixon
2017/06/16 10:53:19
Done.
| |
| 26 predictors::ResourcePrefetchPredictor::URLRequestSummary; | |
| 27 | 26 |
| 28 namespace { | 27 namespace { |
| 29 | 28 |
| 30 // Enum for measuring statistics pertaining to observed request, responses and | 29 // Enum for measuring statistics pertaining to observed request, responses and |
| 31 // redirects. | 30 // redirects. |
| 32 enum RequestStats { | 31 enum RequestStats { |
| 33 REQUEST_STATS_TOTAL_RESPONSES = 0, | 32 REQUEST_STATS_TOTAL_RESPONSES = 0, |
| 34 REQUEST_STATS_TOTAL_PROCESSED_RESPONSES = 1, | 33 REQUEST_STATS_TOTAL_PROCESSED_RESPONSES = 1, |
| 35 REQUEST_STATS_NO_RESOURCE_REQUEST_INFO = 2, // Not recorded (never was). | 34 REQUEST_STATS_NO_RESOURCE_REQUEST_INFO = 2, // Not recorded (never was). |
| 36 REQUEST_STATS_NO_RENDER_FRAME_ID_FROM_REQUEST_INFO = 3, // Not recorded. | 35 REQUEST_STATS_NO_RENDER_FRAME_ID_FROM_REQUEST_INFO = 3, // Not recorded. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 if (!TryToFillNavigationID(&summary->navigation_id, web_contents_getter, | 226 if (!TryToFillNavigationID(&summary->navigation_id, web_contents_getter, |
| 228 main_frame_url, creation_time)) { | 227 main_frame_url, creation_time)) { |
| 229 return; | 228 return; |
| 230 } | 229 } |
| 231 if (summary->resource_type == content::RESOURCE_TYPE_MAIN_FRAME) | 230 if (summary->resource_type == content::RESOURCE_TYPE_MAIN_FRAME) |
| 232 predictor_->OnMainFrameResponse(*summary); | 231 predictor_->OnMainFrameResponse(*summary); |
| 233 predictor_->loading_data_collector()->RecordURLResponse(*summary); | 232 predictor_->loading_data_collector()->RecordURLResponse(*summary); |
| 234 } | 233 } |
| 235 | 234 |
| 236 } // namespace chrome_browser_net | 235 } // namespace chrome_browser_net |
| OLD | NEW |