OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/metrics_web_contents_observer.h" | 5 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <ostream> | 8 #include <ostream> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 // investigation is needed to confirm that all cases would be handled | 237 // investigation is needed to confirm that all cases would be handled |
238 // correctly (for example Link: preloads). | 238 // correctly (for example Link: preloads). |
239 if (committed_load_ && | 239 if (committed_load_ && |
240 creation_time >= committed_load_->navigation_start()) { | 240 creation_time >= committed_load_->navigation_start()) { |
241 return committed_load_.get(); | 241 return committed_load_.get(); |
242 } | 242 } |
243 } | 243 } |
244 return nullptr; | 244 return nullptr; |
245 } | 245 } |
246 | 246 |
247 void MetricsWebContentsObserver::OnRequestStarted( | |
248 const content::GlobalRequestID& request_id, | |
249 content::ResourceType resource_type, | |
250 base::TimeTicks creation_time) { | |
251 PageLoadTracker* tracker = | |
252 GetTrackerOrNullForRequest(request_id, resource_type, creation_time); | |
253 if (tracker) { | |
254 ExtraRequestInfo extra_request_info( | |
RyanSturm
2017/03/29 19:03:47
Debatable whether the two request methods should s
Pete Williamson
2017/04/13 23:10:21
OK, I'll separate it into two types (and add the r
| |
255 false /*was_cached*/, 0 /*raw_body_bytes*/, | |
256 false /*used_data_reduction_proxy*/, 0 /*original_content_length*/); | |
257 tracker->OnStartedResource(extra_request_info); | |
258 } | |
259 } | |
260 | |
247 void MetricsWebContentsObserver::OnRequestComplete( | 261 void MetricsWebContentsObserver::OnRequestComplete( |
248 const content::GlobalRequestID& request_id, | 262 const content::GlobalRequestID& request_id, |
249 content::ResourceType resource_type, | 263 content::ResourceType resource_type, |
250 bool was_cached, | 264 bool was_cached, |
251 bool used_data_reduction_proxy, | 265 bool used_data_reduction_proxy, |
252 int64_t raw_body_bytes, | 266 int64_t raw_body_bytes, |
253 int64_t original_content_length, | 267 int64_t original_content_length, |
254 base::TimeTicks creation_time) { | 268 base::TimeTicks creation_time) { |
255 PageLoadTracker* tracker = | 269 PageLoadTracker* tracker = |
256 GetTrackerOrNullForRequest(request_id, resource_type, creation_time); | 270 GetTrackerOrNullForRequest(request_id, resource_type, creation_time); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
573 content::NavigationHandle* navigation_handle) const { | 587 content::NavigationHandle* navigation_handle) const { |
574 DCHECK(navigation_handle->IsInMainFrame()); | 588 DCHECK(navigation_handle->IsInMainFrame()); |
575 DCHECK(!navigation_handle->HasCommitted() || | 589 DCHECK(!navigation_handle->HasCommitted() || |
576 !navigation_handle->IsSameDocument()); | 590 !navigation_handle->IsSameDocument()); |
577 | 591 |
578 return BrowserPageTrackDecider(embedder_interface_.get(), web_contents(), | 592 return BrowserPageTrackDecider(embedder_interface_.get(), web_contents(), |
579 navigation_handle).ShouldTrack(); | 593 navigation_handle).ShouldTrack(); |
580 } | 594 } |
581 | 595 |
582 } // namespace page_load_metrics | 596 } // namespace page_load_metrics |
OLD | NEW |