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

Side by Side Diff: chrome/browser/page_load_metrics/page_load_metrics_observer.cc

Issue 2780003003: Send an event to the page load metrics to track resource starting. (Closed)
Patch Set: Fix browser tests Created 3 years, 8 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 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/page_load_metrics_observer.h" 5 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h"
6 6
7 namespace page_load_metrics { 7 namespace page_load_metrics {
8 8
9 PageLoadExtraInfo::PageLoadExtraInfo( 9 PageLoadExtraInfo::PageLoadExtraInfo(
10 base::TimeTicks navigation_start, 10 base::TimeTicks navigation_start,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 base::Optional<base::TimeDelta>() /* first_background_time */, 47 base::Optional<base::TimeDelta>() /* first_background_time */,
48 base::Optional<base::TimeDelta>() /* first_foreground_time */, 48 base::Optional<base::TimeDelta>() /* first_foreground_time */,
49 started_in_foreground /* started_in_foreground */, 49 started_in_foreground /* started_in_foreground */,
50 UserInitiatedInfo::BrowserInitiated(), url, url, true /* did_commit */, 50 UserInitiatedInfo::BrowserInitiated(), url, url, true /* did_commit */,
51 page_load_metrics::END_NONE, 51 page_load_metrics::END_NONE,
52 page_load_metrics::UserInitiatedInfo::NotUserInitiated(), 52 page_load_metrics::UserInitiatedInfo::NotUserInitiated(),
53 base::TimeDelta(), page_load_metrics::PageLoadMetadata(), 53 base::TimeDelta(), page_load_metrics::PageLoadMetadata(),
54 page_load_metrics::PageLoadMetadata()); 54 page_load_metrics::PageLoadMetadata());
55 } 55 }
56 56
57 ExtraRequestInfo::ExtraRequestInfo(bool was_cached, 57 ExtraRequestCompleteInfo::ExtraRequestCompleteInfo(
58 int64_t raw_body_bytes, 58 bool was_cached,
59 bool data_reduction_proxy_used, 59 int64_t raw_body_bytes,
60 int64_t original_network_content_length) 60 bool data_reduction_proxy_used,
61 int64_t original_network_content_length,
62 content::ResourceType found_type)
61 : was_cached(was_cached), 63 : was_cached(was_cached),
62 raw_body_bytes(raw_body_bytes), 64 raw_body_bytes(raw_body_bytes),
63 data_reduction_proxy_used(data_reduction_proxy_used), 65 data_reduction_proxy_used(data_reduction_proxy_used),
64 original_network_content_length(original_network_content_length) {} 66 original_network_content_length(original_network_content_length),
67 resource_type(found_type) {}
65 68
66 ExtraRequestInfo::ExtraRequestInfo(const ExtraRequestInfo& other) = default; 69 ExtraRequestCompleteInfo::ExtraRequestCompleteInfo(
70 const ExtraRequestCompleteInfo& other) = default;
67 71
68 ExtraRequestInfo::~ExtraRequestInfo() {} 72 ExtraRequestCompleteInfo::~ExtraRequestCompleteInfo() {}
73
74 ExtraRequestStartInfo::ExtraRequestStartInfo(content::ResourceType found_type)
75 : resource_type(found_type) {}
76
77 ExtraRequestStartInfo::ExtraRequestStartInfo(
78 const ExtraRequestStartInfo& other) = default;
79
80 ExtraRequestStartInfo::~ExtraRequestStartInfo() {}
69 81
70 FailedProvisionalLoadInfo::FailedProvisionalLoadInfo(base::TimeDelta interval, 82 FailedProvisionalLoadInfo::FailedProvisionalLoadInfo(base::TimeDelta interval,
71 net::Error error) 83 net::Error error)
72 : time_to_failed_provisional_load(interval), error(error) {} 84 : time_to_failed_provisional_load(interval), error(error) {}
73 85
74 FailedProvisionalLoadInfo::~FailedProvisionalLoadInfo() {} 86 FailedProvisionalLoadInfo::~FailedProvisionalLoadInfo() {}
75 87
76 PageLoadMetricsObserver::ObservePolicy PageLoadMetricsObserver::OnStart( 88 PageLoadMetricsObserver::ObservePolicy PageLoadMetricsObserver::OnStart(
77 content::NavigationHandle* navigation_handle, 89 content::NavigationHandle* navigation_handle,
78 const GURL& currently_committed_url, 90 const GURL& currently_committed_url,
(...skipping 30 matching lines...) Expand all
109 121
110 PageLoadMetricsObserver::ObservePolicy 122 PageLoadMetricsObserver::ObservePolicy
111 PageLoadMetricsObserver::ShouldObserveMimeType( 123 PageLoadMetricsObserver::ShouldObserveMimeType(
112 const std::string& mime_type) const { 124 const std::string& mime_type) const {
113 return mime_type == "text/html" || mime_type == "application/xhtml+xml" 125 return mime_type == "text/html" || mime_type == "application/xhtml+xml"
114 ? CONTINUE_OBSERVING 126 ? CONTINUE_OBSERVING
115 : STOP_OBSERVING; 127 : STOP_OBSERVING;
116 } 128 }
117 129
118 } // namespace page_load_metrics 130 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698