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

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: rebase 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 if (navigation_handle->IsParentMainFrame() && ad_data) 138 if (navigation_handle->IsParentMainFrame() && ad_data)
139 top_level_ad_frame_count_ += 1; 139 top_level_ad_frame_count_ += 1;
140 140
141 ProcessOngoingNavigationResource(frame_tree_node_id); 141 ProcessOngoingNavigationResource(frame_tree_node_id);
142 return CONTINUE_OBSERVING; 142 return CONTINUE_OBSERVING;
143 } 143 }
144 144
145 page_load_metrics::PageLoadMetricsObserver::ObservePolicy 145 page_load_metrics::PageLoadMetricsObserver::ObservePolicy
146 AdsPageLoadMetricsObserver::FlushMetricsOnAppEnterBackground( 146 AdsPageLoadMetricsObserver::FlushMetricsOnAppEnterBackground(
147 const page_load_metrics::PageLoadTiming& timing, 147 const page_load_metrics::mojom::PageLoadTiming& timing,
148 const page_load_metrics::PageLoadExtraInfo& extra_info) { 148 const page_load_metrics::PageLoadExtraInfo& extra_info) {
149 // The browser may come back, but there is no guarantee. To be safe, record 149 // The browser may come back, but there is no guarantee. To be safe, record
150 // what we have now and ignore future changes to this navigation. 150 // what we have now and ignore future changes to this navigation.
151 if (extra_info.did_commit) 151 if (extra_info.did_commit)
152 RecordHistograms(); 152 RecordHistograms();
153 153
154 return STOP_OBSERVING; 154 return STOP_OBSERVING;
155 } 155 }
156 156
157 void AdsPageLoadMetricsObserver::OnLoadedResource( 157 void AdsPageLoadMetricsObserver::OnLoadedResource(
158 const page_load_metrics::ExtraRequestCompleteInfo& extra_request_info) { 158 const page_load_metrics::ExtraRequestCompleteInfo& extra_request_info) {
159 ProcessLoadedResource(extra_request_info); 159 ProcessLoadedResource(extra_request_info);
160 } 160 }
161 161
162 void AdsPageLoadMetricsObserver::OnComplete( 162 void AdsPageLoadMetricsObserver::OnComplete(
163 const page_load_metrics::PageLoadTiming& timing, 163 const page_load_metrics::mojom::PageLoadTiming& timing,
164 const page_load_metrics::PageLoadExtraInfo& info) { 164 const page_load_metrics::PageLoadExtraInfo& info) {
165 RecordHistograms(); 165 RecordHistograms();
166 } 166 }
167 167
168 void AdsPageLoadMetricsObserver::ProcessLoadedResource( 168 void AdsPageLoadMetricsObserver::ProcessLoadedResource(
169 const page_load_metrics::ExtraRequestCompleteInfo& extra_request_info) { 169 const page_load_metrics::ExtraRequestCompleteInfo& extra_request_info) {
170 if (!extra_request_info.url.SchemeIsHTTPOrHTTPS()) { 170 if (!extra_request_info.url.SchemeIsHTTPOrHTTPS()) {
171 // Data uris should be accounted for in the generating resource, not 171 // Data uris should be accounted for in the generating resource, not
172 // here. Blobs for PlzNavigate shouldn't be counted as the http resource 172 // here. Blobs for PlzNavigate shouldn't be counted as the http resource
173 // was already counted. Blobs for other things like CacheStorage or 173 // was already counted. Blobs for other things like CacheStorage or
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 void AdsPageLoadMetricsObserver::ProcessOngoingNavigationResource( 291 void AdsPageLoadMetricsObserver::ProcessOngoingNavigationResource(
292 FrameTreeNodeId frame_tree_node_id) { 292 FrameTreeNodeId frame_tree_node_id) {
293 const auto& frame_id_and_request = 293 const auto& frame_id_and_request =
294 ongoing_navigation_resources_.find(frame_tree_node_id); 294 ongoing_navigation_resources_.find(frame_tree_node_id);
295 if (frame_id_and_request == ongoing_navigation_resources_.end()) 295 if (frame_id_and_request == ongoing_navigation_resources_.end())
296 return; 296 return;
297 297
298 ProcessLoadedResource(frame_id_and_request->second); 298 ProcessLoadedResource(frame_id_and_request->second);
299 ongoing_navigation_resources_.erase(frame_id_and_request); 299 ongoing_navigation_resources_.erase(frame_id_and_request);
300 } 300 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698