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

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

Issue 2218583002: [page_load_metrics] Log cache warmth ratios at parse stop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: thestig@ review Created 4 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/metrics_web_contents_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" 14 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h"
15 #include "chrome/common/page_load_metrics/page_load_timing.h" 15 #include "chrome/common/page_load_metrics/page_load_timing.h"
16 #include "content/public/browser/render_widget_host.h" 16 #include "content/public/browser/render_widget_host.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "content/public/browser/web_contents_observer.h" 18 #include "content/public/browser/web_contents_observer.h"
19 #include "content/public/browser/web_contents_user_data.h" 19 #include "content/public/browser/web_contents_user_data.h"
20 #include "content/public/common/resource_type.h"
20 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
21 #include "third_party/WebKit/public/web/WebInputEvent.h" 22 #include "third_party/WebKit/public/web/WebInputEvent.h"
22 23
23 namespace content { 24 namespace content {
24 class NavigationHandle; 25 class NavigationHandle;
25 class RenderFrameHost; 26 class RenderFrameHost;
26 } // namespace content 27 } // namespace content
27 28
28 namespace IPC { 29 namespace IPC {
29 class Message; 30 class Message;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // killed at any time after this method is invoked without further 150 // killed at any time after this method is invoked without further
150 // notification. 151 // notification.
151 void FlushMetricsOnAppEnterBackground(); 152 void FlushMetricsOnAppEnterBackground();
152 153
153 void NotifyClientRedirectTo(const PageLoadTracker& destination); 154 void NotifyClientRedirectTo(const PageLoadTracker& destination);
154 155
155 // Returns true if the timing was successfully updated. 156 // Returns true if the timing was successfully updated.
156 bool UpdateTiming(const PageLoadTiming& timing, 157 bool UpdateTiming(const PageLoadTiming& timing,
157 const PageLoadMetadata& metadata); 158 const PageLoadMetadata& metadata);
158 159
160 void OnLoadedSubresource(bool was_cached);
161
159 // Signals that we should stop tracking metrics for the associated page load. 162 // Signals that we should stop tracking metrics for the associated page load.
160 // We may stop tracking a page load if it doesn't meet the criteria for 163 // We may stop tracking a page load if it doesn't meet the criteria for
161 // tracking metrics in DidFinishNavigation. 164 // tracking metrics in DidFinishNavigation.
162 void StopTracking(); 165 void StopTracking();
163 166
164 int aborted_chain_size() const { return aborted_chain_size_; } 167 int aborted_chain_size() const { return aborted_chain_size_; }
165 int aborted_chain_size_same_url() const { 168 int aborted_chain_size_same_url() const {
166 return aborted_chain_size_same_url_; 169 return aborted_chain_size_same_url_;
167 } 170 }
168 171
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // when they occur in the background. 259 // when they occur in the background.
257 base::TimeTicks background_time_; 260 base::TimeTicks background_time_;
258 base::TimeTicks foreground_time_; 261 base::TimeTicks foreground_time_;
259 bool started_in_foreground_; 262 bool started_in_foreground_;
260 263
261 PageLoadTiming timing_; 264 PageLoadTiming timing_;
262 PageLoadMetadata metadata_; 265 PageLoadMetadata metadata_;
263 266
264 ui::PageTransition page_transition_; 267 ui::PageTransition page_transition_;
265 268
269 // Note: these are only approximations, based on WebContents attribution from
270 // ResourceRequestInfo objects while this is the currently committed load in
271 // the WebContents.
272 int num_cache_requests_;
273 int num_network_requests_;
274
266 // This is a subtle member. If a provisional load A gets aborted by 275 // This is a subtle member. If a provisional load A gets aborted by
267 // provisional load B, which gets aborted by C that eventually commits, then 276 // provisional load B, which gets aborted by C that eventually commits, then
268 // there exists an abort chain of length 2, starting at A's navigation_start. 277 // there exists an abort chain of length 2, starting at A's navigation_start.
269 // This is useful because it allows histograming abort chain lengths based on 278 // This is useful because it allows histograming abort chain lengths based on
270 // what the last load's transition type is. i.e. holding down F-5 to spam 279 // what the last load's transition type is. i.e. holding down F-5 to spam
271 // reload will produce a long chain with the RELOAD transition. 280 // reload will produce a long chain with the RELOAD transition.
272 const int aborted_chain_size_; 281 const int aborted_chain_size_;
273 282
274 // This member counts consecutive provisional aborts that share a url. It will 283 // This member counts consecutive provisional aborts that share a url. It will
275 // always be less than or equal to |aborted_chain_size_|. 284 // always be less than or equal to |aborted_chain_size_|.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 void OnInputEvent(const blink::WebInputEvent& event) override; 320 void OnInputEvent(const blink::WebInputEvent& event) override;
312 void WasShown() override; 321 void WasShown() override;
313 void WasHidden() override; 322 void WasHidden() override;
314 void RenderProcessGone(base::TerminationStatus status) override; 323 void RenderProcessGone(base::TerminationStatus status) override;
315 void RenderViewHostChanged(content::RenderViewHost* old_host, 324 void RenderViewHostChanged(content::RenderViewHost* old_host,
316 content::RenderViewHost* new_host) override; 325 content::RenderViewHost* new_host) override;
317 326
318 // This method is forwarded from the MetricsNavigationThrottle. 327 // This method is forwarded from the MetricsNavigationThrottle.
319 void WillStartNavigationRequest(content::NavigationHandle* navigation_handle); 328 void WillStartNavigationRequest(content::NavigationHandle* navigation_handle);
320 329
330 // A resource request completed on the IO thread.
331 void OnRequestComplete(content::ResourceType resource_type,
332 bool was_cached,
333 int net_error);
334
321 // Flush any buffered metrics, as part of the metrics subsystem persisting 335 // Flush any buffered metrics, as part of the metrics subsystem persisting
322 // metrics as the application goes into the background. The application may be 336 // metrics as the application goes into the background. The application may be
323 // killed at any time after this method is invoked without further 337 // killed at any time after this method is invoked without further
324 // notification. 338 // notification.
325 void FlushMetricsOnAppEnterBackground(); 339 void FlushMetricsOnAppEnterBackground();
326 340
327 // This getter function is required for testing. 341 // This getter function is required for testing.
328 const PageLoadExtraInfo GetPageLoadExtraInfoForCommittedLoad(); 342 const PageLoadExtraInfo GetPageLoadExtraInfoForCommittedLoad();
329 343
330 private: 344 private:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 402
389 // Has the MWCO observed at least one navigation? 403 // Has the MWCO observed at least one navigation?
390 bool has_navigated_; 404 bool has_navigated_;
391 405
392 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); 406 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver);
393 }; 407 };
394 408
395 } // namespace page_load_metrics 409 } // namespace page_load_metrics
396 410
397 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_WEB_CONTENTS_OBSERVER_H_ 411 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_WEB_CONTENTS_OBSERVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/metrics_web_contents_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698