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

Side by Side Diff: chrome/browser/net/loading_predictor_observer.cc

Issue 2937623007: predictors: Move more methods from ResourcePrefetchPredictor into LoadingDataCollector. (Closed)
Patch Set: Fix browser test Created 3 years, 5 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 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 predictors::URLRequestSummary;
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698