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

Issue 2894973002: Provide WebContents::CreateParams to tab helpers. (Closed)

Created:
3 years, 7 months ago by Bryan McQuade
Modified:
3 years, 7 months ago
CC:
cbentzel+watch_chromium.org, chromium-reviews, creis+watch_chromium.org, csharrison+watch_chromium.org, darin-cc_chromium.org, gavinp+prer_chromium.org, jam, loading-reviews+metrics_chromium.org, nasko+codewatch_chromium.org, speed-metrics-reviews_chromium.org, tburkard+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Provide WebContents::CreateParams to tab helpers. With browser-side navigation enabled, navigations in new foreground tabs are considered to have started in the background. This is a change in behavior. This causes page load metrics to incorrectly consider these page loads to have started in the background, which skews all of Chrome's page load metrics (PageLoad.* in UMA). clamy explains: """ the background/foreground issue seems to be due to the ordering of calls in chrome/browser/ui/browser_navigator.cc when we create a new tab. What happens is: - we first create a WebContents and ask it to navigate (https://cs.chromium.org/chromium/src/chrome/browser/ui/browser_navigator.cc?type=cs&l=557). This result in the creation of a NavigationHandle, so we fire DidStartNavigation. In the current architecture, we fire DidStartNavigation after receiving DidStartProvisionalLoad. - then we insert the WebContents in the tab strip (https://cs.chromium.org/chromium/src/chrome/browser/ui/browser_navigator.cc?type=cs&l=589). This fires WebContentsImpl::WasShown. """ This patch implements Nasko's proposed fix to expose the WebContents CreateParams to interested WebContentsObservers, page load metrics's MetricsWebContentsObserver being the first consumer. We don't have the CreateParams in all places where a WebContents is passed to TabHelpers, so we wrap the CreateParams in a base::Optional<> and provide CreateParams in cases where they are available. BUG=725347 Review-Url: https://codereview.chromium.org/2894973002 Cr-Commit-Position: refs/heads/master@{#474895} Committed: https://chromium.googlesource.com/chromium/src/+/42b72063edb66bfd015bd9dea116c3e3e937d3eb

Patch Set 1 #

Patch Set 2 : finish implementation #

Patch Set 3 : fix comment #

Patch Set 4 : disable dcheck #

Patch Set 5 : switch to optional #

Patch Set 6 : fix android build #

Patch Set 7 : fix initial foreground state #

Patch Set 8 : revert behavior changes #

Patch Set 9 : fix android build #

Patch Set 10 : fix android build #

Patch Set 11 : add missing include #

Patch Set 12 : fix tests #

Patch Set 13 : set prerender WC to initially_hidden #

Patch Set 14 : fix prerender issues #

Patch Set 15 : improve comment #

Patch Set 16 : rebase #

Total comments: 11

Patch Set 17 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+174 lines, -93 lines) Patch
M android_webview/browser/aw_web_contents_delegate.h View 1 2 3 4 5 1 chunk +9 lines, -6 lines 0 comments Download
M android_webview/browser/aw_web_contents_delegate.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/android/tab_android.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/android/tab_web_contents_delegate_android.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/devtools/devtools_window.h View 1 2 3 4 2 chunks +10 lines, -6 lines 0 comments Download
M chrome/browser/devtools/devtools_window.cc View 1 2 3 4 1 chunk +8 lines, -6 lines 0 comments Download
M chrome/browser/page_load_metrics/metrics_web_contents_observer.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/page_load_metrics/metrics_web_contents_observer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +12 lines, -2 lines 0 comments Download
M chrome/browser/page_load_metrics/metrics_web_contents_observer_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +25 lines, -0 lines 0 comments Download
M chrome/browser/page_load_metrics/page_load_metrics_initialize.h View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/page_load_metrics/page_load_metrics_initialize.cc View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/browser/prerender/prerender_contents.h View 3 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/prerender/prerender_contents.cc View 5 6 7 8 9 10 11 12 13 2 chunks +8 lines, -4 lines 0 comments Download
M chrome/browser/ui/browser.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +9 lines, -6 lines 0 comments Download
M chrome/browser/ui/browser.cc View 1 2 3 4 1 chunk +9 lines, -7 lines 0 comments Download
M chrome/browser/ui/browser_navigator.cc View 1 2 3 4 2 chunks +6 lines, -3 lines 0 comments Download
M chrome/browser/ui/browser_tab_strip_model_delegate.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/tab_helpers.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -5 lines 0 comments Download
M chrome/browser/ui/tab_helpers.cc View 1 2 3 4 2 chunks +4 lines, -2 lines 0 comments Download
M components/web_contents_delegate_android/web_contents_delegate_android.h View 1 2 3 4 5 6 7 8 2 chunks +10 lines, -7 lines 0 comments Download
M components/web_contents_delegate_android/web_contents_delegate_android.cc View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +3 lines, -3 lines 0 comments Download
M content/public/browser/web_contents_delegate.h View 1 2 3 4 3 chunks +9 lines, -7 lines 0 comments Download
M extensions/browser/guest_view/web_view/web_view_guest.h View 1 2 3 4 2 chunks +10 lines, -6 lines 0 comments Download
M extensions/browser/guest_view/web_view/web_view_guest.cc View 1 2 3 4 1 chunk +8 lines, -6 lines 0 comments Download
M headless/lib/browser/headless_web_contents_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +9 lines, -6 lines 0 comments Download

Messages

Total messages: 87 (66 generated)
Avi (use Gerrit)
This looks like a reasonable thing to do. My only concern is that we might ...
3 years, 7 months ago (2017-05-23 15:38:59 UTC) #58
Bryan McQuade
Thanks! https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/android/tab_android.cc File chrome/browser/android/tab_android.cc (right): https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/android/tab_android.cc#newcode122 chrome/browser/android/tab_android.cc:122: TabHelpers::AttachTabHelpers(web_contents, base::nullopt); On 2017/05/23 at 15:38:59, Avi (ping ...
3 years, 7 months ago (2017-05-23 20:29:57 UTC) #59
Bryan McQuade
Note to reviewers: this is just a refactor that adds an additional param to some ...
3 years, 7 months ago (2017-05-23 20:37:35 UTC) #61
Avi (use Gerrit)
https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc File chrome/browser/page_load_metrics/metrics_web_contents_observer.cc (right): https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc#newcode82 chrome/browser/page_load_metrics/metrics_web_contents_observer.cc:82: prerender::PrerenderContents::FromWebContents(web_contents) != nullptr; On 2017/05/23 20:29:57, Bryan McQuade wrote: ...
3 years, 7 months ago (2017-05-23 20:49:54 UTC) #62
boliu
android_webview and components/web_contents_delegate_android rs lgtm I don't own chrome/android code, but probably needs some work. ...
3 years, 7 months ago (2017-05-23 21:16:28 UTC) #63
Bryan McQuade
On 2017/05/23 at 21:16:28, boliu wrote: > android_webview and components/web_contents_delegate_android rs lgtm > > I ...
3 years, 7 months ago (2017-05-24 00:00:50 UTC) #64
boliu
On 2017/05/24 00:00:50, Bryan McQuade wrote: > On 2017/05/23 at 21:16:28, boliu wrote: > > ...
3 years, 7 months ago (2017-05-24 00:18:05 UTC) #65
mattcary
lgtm For prerender. Which is "mostly deprecated" now, we don't like the edge cases more ...
3 years, 7 months ago (2017-05-24 08:01:54 UTC) #66
Sami
headless/ lgtm.
3 years, 7 months ago (2017-05-24 17:43:37 UTC) #67
dgozman
devtools lgtm
3 years, 7 months ago (2017-05-24 19:16:53 UTC) #68
Bryan McQuade
On 2017/05/24 at 00:18:05, boliu wrote: > On 2017/05/24 00:00:50, Bryan McQuade wrote: > > ...
3 years, 7 months ago (2017-05-25 03:08:24 UTC) #69
Bryan McQuade
https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/android/tab_android.cc File chrome/browser/android/tab_android.cc (right): https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/android/tab_android.cc#newcode122 chrome/browser/android/tab_android.cc:122: TabHelpers::AttachTabHelpers(web_contents, base::nullopt); On 2017/05/23 at 21:16:28, boliu wrote: > ...
3 years, 7 months ago (2017-05-25 03:19:12 UTC) #70
Fady Samuel
guest_view lgtm
3 years, 7 months ago (2017-05-25 04:07:01 UTC) #71
Maria
lgtm assuming the answer to my comment is yes https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/android/tab_android.cc File chrome/browser/android/tab_android.cc (right): https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/android/tab_android.cc#newcode122 chrome/browser/android/tab_android.cc:122: ...
3 years, 7 months ago (2017-05-25 05:12:20 UTC) #72
Peter Kasting
Note: I'm behind on codereviews but will try and get to this today (Thursday May ...
3 years, 7 months ago (2017-05-25 07:24:58 UTC) #73
Peter Kasting
LGTM https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/ui/tab_helpers.h File chrome/browser/ui/tab_helpers.h (right): https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/ui/tab_helpers.h#newcode9 chrome/browser/ui/tab_helpers.h:9: #include "content/public/browser/web_contents.h" Do you really need to #include ...
3 years, 7 months ago (2017-05-25 23:21:44 UTC) #74
Bryan McQuade
On 2017/05/25 at 23:21:44, pkasting wrote: > LGTM > > https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/ui/tab_helpers.h > File chrome/browser/ui/tab_helpers.h (right): ...
3 years, 7 months ago (2017-05-26 00:38:47 UTC) #77
Bryan McQuade
https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/android/tab_android.cc File chrome/browser/android/tab_android.cc (right): https://codereview.chromium.org/2894973002/diff/300001/chrome/browser/android/tab_android.cc#newcode122 chrome/browser/android/tab_android.cc:122: TabHelpers::AttachTabHelpers(web_contents, base::nullopt); On 2017/05/25 at 05:12:20, Maria wrote: > ...
3 years, 7 months ago (2017-05-26 00:39:44 UTC) #78
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2894973002/320001
3 years, 7 months ago (2017-05-26 03:08:46 UTC) #83
commit-bot: I haz the power
Committed patchset #17 (id:320001) as https://chromium.googlesource.com/chromium/src/+/42b72063edb66bfd015bd9dea116c3e3e937d3eb
3 years, 7 months ago (2017-05-26 03:14:30 UTC) #86
Bryan McQuade
3 years, 5 months ago (2017-07-14 00:02:23 UTC) #87
Message was sent while issue was closed.
A revert of this CL (patchset #17 id:320001) has been created in
https://codereview.chromium.org/2983533002/ by bmcquade@chromium.org.

The reason for reverting is: sky@ and ducboi@ found a simpler and more correct
fix in https://chromium-review.googlesource.com/c/569578/, so this is no longer
needed..

Powered by Google App Engine
This is Rietveld 408576698