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

Side by Side Diff: chrome/browser/page_load_metrics/metrics_web_contents_observer.h

Issue 2624283004: Associate a main resource request with its PageLoadTracker. (Closed)
Patch Set: fix comment Created 3 years, 11 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 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_WEB_CONTENTS_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_WEB_CONTENTS_OBSERVER_H_
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_WEB_CONTENTS_OBSERVER_H_ 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_WEB_CONTENTS_OBSERVER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 void DidRedirectNavigation( 59 void DidRedirectNavigation(
60 content::NavigationHandle* navigation_handle) override; 60 content::NavigationHandle* navigation_handle) override;
61 void NavigationStopped() override; 61 void NavigationStopped() override;
62 void OnInputEvent(const blink::WebInputEvent& event) override; 62 void OnInputEvent(const blink::WebInputEvent& event) override;
63 void WasShown() override; 63 void WasShown() override;
64 void WasHidden() override; 64 void WasHidden() override;
65 void RenderProcessGone(base::TerminationStatus status) override; 65 void RenderProcessGone(base::TerminationStatus status) override;
66 void RenderViewHostChanged(content::RenderViewHost* old_host, 66 void RenderViewHostChanged(content::RenderViewHost* old_host,
67 content::RenderViewHost* new_host) override; 67 content::RenderViewHost* new_host) override;
68 68
69 // This method is forwarded from the MetricsNavigationThrottle. 69 // These methods are forwarded from the MetricsNavigationThrottle.
70 void WillStartNavigationRequest(content::NavigationHandle* navigation_handle); 70 void WillStartNavigationRequest(content::NavigationHandle* navigation_handle);
71 void WillProcessNavigationResponse(
72 content::NavigationHandle* navigation_handle);
71 73
72 // A resource request completed on the IO thread. 74 // A resource request completed on the IO thread. This method is invoked on
73 void OnRequestComplete(content::ResourceType resource_type, 75 // the UI thread.
76 void OnRequestComplete(const content::GlobalRequestID& request_id,
77 content::ResourceType resource_type,
74 bool was_cached, 78 bool was_cached,
75 bool used_data_reduction_proxy, 79 bool used_data_reduction_proxy,
76 int64_t raw_body_bytes, 80 int64_t raw_body_bytes,
77 int64_t original_content_length, 81 int64_t original_content_length,
78 base::TimeTicks creation_time); 82 base::TimeTicks creation_time);
79 83
80 // Flush any buffered metrics, as part of the metrics subsystem persisting 84 // Flush any buffered metrics, as part of the metrics subsystem persisting
81 // metrics as the application goes into the background. The application may be 85 // metrics as the application goes into the background. The application may be
82 // killed at any time after this method is invoked without further 86 // killed at any time after this method is invoked without further
83 // notification. 87 // notification.
84 void FlushMetricsOnAppEnterBackground(); 88 void FlushMetricsOnAppEnterBackground();
85 89
86 // This getter function is required for testing. 90 // This getter function is required for testing.
87 const PageLoadExtraInfo GetPageLoadExtraInfoForCommittedLoad(); 91 const PageLoadExtraInfo GetPageLoadExtraInfoForCommittedLoad();
88 92
89 private: 93 private:
90 friend class content::WebContentsUserData<MetricsWebContentsObserver>; 94 friend class content::WebContentsUserData<MetricsWebContentsObserver>;
91 95
92 void HandleFailedNavigationForTrackedLoad( 96 void HandleFailedNavigationForTrackedLoad(
93 content::NavigationHandle* navigation_handle, 97 content::NavigationHandle* navigation_handle,
94 std::unique_ptr<PageLoadTracker> tracker); 98 std::unique_ptr<PageLoadTracker> tracker);
95 99
96 void HandleCommittedNavigationForTrackedLoad( 100 void HandleCommittedNavigationForTrackedLoad(
97 content::NavigationHandle* navigation_handle, 101 content::NavigationHandle* navigation_handle,
98 std::unique_ptr<PageLoadTracker> tracker); 102 std::unique_ptr<PageLoadTracker> tracker);
99 103
104 // Return a PageLoadTracker (either provisional or committed) that matches the
105 // given request attributes, or nullptr if there are no matching
106 // PageLoadTrackers.
107 PageLoadTracker* GetTrackerOrNullForRequest(
108 const content::GlobalRequestID& request_id,
109 content::ResourceType resource_type,
110 base::TimeTicks creation_time);
111
100 // Notify all loads, provisional and committed, that we performed an action 112 // Notify all loads, provisional and committed, that we performed an action
101 // that might abort them. 113 // that might abort them.
102 void NotifyAbortAllLoads(UserAbortType abort_type, 114 void NotifyAbortAllLoads(UserAbortType abort_type,
103 UserInitiatedInfo user_initiated_info); 115 UserInitiatedInfo user_initiated_info);
104 void NotifyAbortAllLoadsWithTimestamp(UserAbortType abort_type, 116 void NotifyAbortAllLoadsWithTimestamp(UserAbortType abort_type,
105 UserInitiatedInfo user_initiated_info, 117 UserInitiatedInfo user_initiated_info,
106 base::TimeTicks timestamp, 118 base::TimeTicks timestamp,
107 bool is_certainly_browser_timestamp); 119 bool is_certainly_browser_timestamp);
108 120
109 // Register / Unregister input event callback to given RenderViewHost 121 // Register / Unregister input event callback to given RenderViewHost
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 162
151 // Has the MWCO observed at least one navigation? 163 // Has the MWCO observed at least one navigation?
152 bool has_navigated_; 164 bool has_navigated_;
153 165
154 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); 166 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver);
155 }; 167 };
156 168
157 } // namespace page_load_metrics 169 } // namespace page_load_metrics
158 170
159 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_WEB_CONTENTS_OBSERVER_H_ 171 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_WEB_CONTENTS_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698