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

Side by Side Diff: chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc

Issue 2874663005: [Page Load Metrics] Add mojom file to page load metrics. (Closed)
Patch Set: Created 3 years, 7 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/page_load_metrics/observers/ads_page_load_metrics_obser ver.h" 5 #include "chrome/browser/page_load_metrics/observers/ads_page_load_metrics_obser ver.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 if (navigation_handle->IsParentMainFrame() && ad_data) 135 if (navigation_handle->IsParentMainFrame() && ad_data)
136 top_level_ad_frame_count_ += 1; 136 top_level_ad_frame_count_ += 1;
137 137
138 ProcessOngoingNavigationResource(frame_tree_node_id); 138 ProcessOngoingNavigationResource(frame_tree_node_id);
139 return CONTINUE_OBSERVING; 139 return CONTINUE_OBSERVING;
140 } 140 }
141 141
142 page_load_metrics::PageLoadMetricsObserver::ObservePolicy 142 page_load_metrics::PageLoadMetricsObserver::ObservePolicy
143 AdsPageLoadMetricsObserver::FlushMetricsOnAppEnterBackground( 143 AdsPageLoadMetricsObserver::FlushMetricsOnAppEnterBackground(
144 const page_load_metrics::PageLoadTiming& timing, 144 const page_load_metrics::mojom::PageLoadTiming& timing,
145 const page_load_metrics::PageLoadExtraInfo& extra_info) { 145 const page_load_metrics::PageLoadExtraInfo& extra_info) {
146 // The browser may come back, but there is no guarantee. To be safe, record 146 // The browser may come back, but there is no guarantee. To be safe, record
147 // what we have now and ignore future changes to this navigation. 147 // what we have now and ignore future changes to this navigation.
148 if (extra_info.did_commit) 148 if (extra_info.did_commit)
149 RecordHistograms(); 149 RecordHistograms();
150 150
151 return STOP_OBSERVING; 151 return STOP_OBSERVING;
152 } 152 }
153 153
154 void AdsPageLoadMetricsObserver::OnLoadedResource( 154 void AdsPageLoadMetricsObserver::OnLoadedResource(
155 const page_load_metrics::ExtraRequestCompleteInfo& extra_request_info) { 155 const page_load_metrics::ExtraRequestCompleteInfo& extra_request_info) {
156 ProcessLoadedResource(extra_request_info); 156 ProcessLoadedResource(extra_request_info);
157 } 157 }
158 158
159 void AdsPageLoadMetricsObserver::OnComplete( 159 void AdsPageLoadMetricsObserver::OnComplete(
160 const page_load_metrics::PageLoadTiming& timing, 160 const page_load_metrics::mojom::PageLoadTiming& timing,
161 const page_load_metrics::PageLoadExtraInfo& info) { 161 const page_load_metrics::PageLoadExtraInfo& info) {
162 RecordHistograms(); 162 RecordHistograms();
163 } 163 }
164 164
165 void AdsPageLoadMetricsObserver::ProcessLoadedResource( 165 void AdsPageLoadMetricsObserver::ProcessLoadedResource(
166 const page_load_metrics::ExtraRequestCompleteInfo& extra_request_info) { 166 const page_load_metrics::ExtraRequestCompleteInfo& extra_request_info) {
167 if (!extra_request_info.url.SchemeIsHTTPOrHTTPS()) { 167 if (!extra_request_info.url.SchemeIsHTTPOrHTTPS()) {
168 // Data uris should be accounted for in the generating resource, not 168 // Data uris should be accounted for in the generating resource, not
169 // here. Blobs for PlzNavigate shouldn't be counted as the http resource 169 // here. Blobs for PlzNavigate shouldn't be counted as the http resource
170 // was already counted. Blobs for other things like CacheStorage or 170 // was already counted. Blobs for other things like CacheStorage or
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 void AdsPageLoadMetricsObserver::ProcessOngoingNavigationResource( 288 void AdsPageLoadMetricsObserver::ProcessOngoingNavigationResource(
289 FrameTreeNodeId frame_tree_node_id) { 289 FrameTreeNodeId frame_tree_node_id) {
290 const auto& frame_id_and_request = 290 const auto& frame_id_and_request =
291 ongoing_navigation_resources_.find(frame_tree_node_id); 291 ongoing_navigation_resources_.find(frame_tree_node_id);
292 if (frame_id_and_request == ongoing_navigation_resources_.end()) 292 if (frame_id_and_request == ongoing_navigation_resources_.end())
293 return; 293 return;
294 294
295 ProcessLoadedResource(frame_id_and_request->second); 295 ProcessLoadedResource(frame_id_and_request->second);
296 ongoing_navigation_resources_.erase(frame_id_and_request); 296 ongoing_navigation_resources_.erase(frame_id_and_request);
297 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698