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 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/optional.h" | 11 #include "base/optional.h" |
12 #include "chrome/common/page_load_metrics/page_load_timing.h" | 12 #include "chrome/common/page_load_metrics/page_load_timing.h" |
13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data .h" | |
13 #include "content/public/browser/navigation_handle.h" | 14 #include "content/public/browser/navigation_handle.h" |
14 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
15 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 16 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
17 | 18 |
18 namespace page_load_metrics { | 19 namespace page_load_metrics { |
19 | 20 |
20 // This enum represents how a page load ends. If the action occurs before the | 21 // This enum represents how a page load ends. If the action occurs before the |
21 // page load finishes (or reaches some point like first paint), then we consider | 22 // page load finishes (or reaches some point like first paint), then we consider |
22 // the load to be aborted. | 23 // the load to be aborted. |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 const PageLoadMetadata main_frame_metadata; | 193 const PageLoadMetadata main_frame_metadata; |
193 | 194 |
194 // PageLoadMetadata for child frames of the current page load. | 195 // PageLoadMetadata for child frames of the current page load. |
195 const PageLoadMetadata child_frame_metadata; | 196 const PageLoadMetadata child_frame_metadata; |
196 }; | 197 }; |
197 | 198 |
198 // Container for various information about a request within a page load. | 199 // Container for various information about a request within a page load. |
199 struct ExtraRequestInfo { | 200 struct ExtraRequestInfo { |
200 ExtraRequestInfo(bool was_cached, | 201 ExtraRequestInfo(bool was_cached, |
201 int64_t raw_body_bytes, | 202 int64_t raw_body_bytes, |
202 bool data_reduction_proxy_used, | 203 int64_t original_network_content_length, |
203 int64_t original_network_content_length); | 204 std::unique_ptr<data_reduction_proxy::DataReductionProxyData> |
Charlie Harrison
2017/04/20 20:52:50
#include <memory>
RyanSturm
2017/04/20 21:33:00
Done.
| |
204 | 205 data_reduction_proxy_data); |
205 ExtraRequestInfo(const ExtraRequestInfo& other); | |
RyanSturm
2017/04/20 20:30:32
csharrison@, I removed this, but I can add it back
Charlie Harrison
2017/04/20 20:52:50
Fine by me. I think we only use it for for loops :
| |
206 | 206 |
207 ~ExtraRequestInfo(); | 207 ~ExtraRequestInfo(); |
208 | 208 |
209 // True if the resource was loaded from cache. | 209 // True if the resource was loaded from cache. |
210 const bool was_cached; | 210 const bool was_cached; |
211 | 211 |
212 // The number of body (not header) prefilter bytes. | 212 // The number of body (not header) prefilter bytes. |
213 const int64_t raw_body_bytes; | 213 const int64_t raw_body_bytes; |
214 | 214 |
215 // Whether this request used Data Reduction Proxy. | |
216 const bool data_reduction_proxy_used; | |
217 | |
218 // The number of body (not header) bytes that the data reduction proxy saw | 215 // The number of body (not header) bytes that the data reduction proxy saw |
219 // before it compressed the requests. | 216 // before it compressed the requests. |
220 const int64_t original_network_content_length; | 217 const int64_t original_network_content_length; |
218 | |
219 // Data related to data saver. | |
220 const std::unique_ptr<data_reduction_proxy::DataReductionProxyData> | |
221 data_reduction_proxy_data; | |
221 }; | 222 }; |
222 | 223 |
223 // Interface for PageLoadMetrics observers. All instances of this class are | 224 // Interface for PageLoadMetrics observers. All instances of this class are |
224 // owned by the PageLoadTracker tracking a page load. | 225 // owned by the PageLoadTracker tracking a page load. |
225 class PageLoadMetricsObserver { | 226 class PageLoadMetricsObserver { |
226 public: | 227 public: |
227 // ObservePolicy is used as a return value on some PageLoadMetricsObserver | 228 // ObservePolicy is used as a return value on some PageLoadMetricsObserver |
228 // callbacks to indicate whether the observer would like to continue observing | 229 // callbacks to indicate whether the observer would like to continue observing |
229 // metric callbacks. Observers that wish to continue observing metric | 230 // metric callbacks. Observers that wish to continue observing metric |
230 // callbacks should return CONTINUE_OBSERVING; observers that wish to stop | 231 // callbacks should return CONTINUE_OBSERVING; observers that wish to stop |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 const FailedProvisionalLoadInfo& failed_provisional_load_info, | 376 const FailedProvisionalLoadInfo& failed_provisional_load_info, |
376 const PageLoadExtraInfo& extra_info) {} | 377 const PageLoadExtraInfo& extra_info) {} |
377 | 378 |
378 // Called whenever a request is loaded for this page load. | 379 // Called whenever a request is loaded for this page load. |
379 virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {} | 380 virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {} |
380 }; | 381 }; |
381 | 382 |
382 } // namespace page_load_metrics | 383 } // namespace page_load_metrics |
383 | 384 |
384 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 385 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
OLD | NEW |