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

Issue 2164033002: Refactoring startup logic for upcoming FRE changes (non-Win 10). (Closed)

Created:
4 years, 5 months ago by tmartino
Modified:
4 years, 2 months ago
CC:
chromium-reviews, Mathieu
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactoring startup logic for upcoming FRE changes (non-Win 10). Refactor goals (in descending order): 1. Consolidate the various places throughout startup where onboarding and other special-case tabs are added. 2. Reduce the massive number of branches, spaghetti calls, and seemingly-redundant checks into a manageable, linear flow. 3. Offload all policy logic (e.g., "Should we show the Welcome page?") for FRE to the more-appropriate first_run directory. 4. Where possible, consolidate code into testable units. BUG=618454, 248883, 517248 Committed: https://crrev.com/b930f6e90137299cc399cd35bcf7e7f89c19587e Cr-Commit-Position: refs/heads/master@{#423636}

Patch Set 1 #

Patch Set 2 : Expanding refactor (WIP) #

Total comments: 12

Patch Set 3 : Addressing rogerta feedback #

Total comments: 16

Patch Set 4 : Addressing comments from grt, excluding structural changes #

Total comments: 2

Patch Set 5 : Further nits #

Patch Set 6 : Preview of struct-based refactor #

Patch Set 7 : Adding first unit tests #

Total comments: 35

Patch Set 8 : Restructuring to use Provider class #

Patch Set 9 : Adding missing constructor #

Total comments: 38

Patch Set 10 : Changing getters to adders #

Total comments: 12

Patch Set 11 : Misc changes to argument passing #

Total comments: 5

Patch Set 12 : Additional Nits #

Total comments: 6

Patch Set 13 : Fixing side-effect behavior changes #

Patch Set 14 : Line break nit #

Total comments: 4

Patch Set 15 : Further tweaks to conditionals #

Total comments: 3

Patch Set 16 : Test nits #

Patch Set 17 : Win build issue #

Total comments: 75

Patch Set 18 : Addressing pkasting feedback #

Patch Set 19 : Further feedback from pkasting #

Patch Set 20 : Using new welcome page URL #

Total comments: 18

Patch Set 21 : Attempting submission #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+870 lines, -207 lines) Patch
M chrome/browser/first_run/first_run.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/first_run/first_run.cc View 1 2 3 4 5 6 7 8 9 10 4 chunks +19 lines, -10 lines 0 comments Download
M chrome/browser/first_run/first_run_internal.h View 1 2 3 4 5 6 7 8 9 3 chunks +7 lines, -1 line 0 comments Download
M chrome/browser/first_run/first_run_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +40 lines, -0 lines 0 comments Download
M chrome/browser/ui/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/ui/startup/startup_browser_creator.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/ui/startup/startup_browser_creator_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 chunks +42 lines, -12 lines 0 comments Download
M chrome/browser/ui/startup/startup_browser_creator_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 10 chunks +271 lines, -182 lines 2 comments Download
A chrome/browser/ui/startup/startup_browser_creator_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +172 lines, -0 lines 0 comments Download
A chrome/browser/ui/startup/startup_features.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +16 lines, -0 lines 0 comments Download
A chrome/browser/ui/startup/startup_features.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +12 lines, -0 lines 0 comments Download
M chrome/browser/ui/startup/startup_tab.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +1 line, -1 line 0 comments Download
M chrome/browser/ui/startup/startup_tab.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
A chrome/browser/ui/startup/startup_tab_provider.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +87 lines, -0 lines 0 comments Download
A chrome/browser/ui/startup/startup_tab_provider.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +117 lines, -0 lines 1 comment Download
A chrome/browser/ui/startup/startup_tab_provider_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +69 lines, -0 lines 0 comments Download
M chrome/test/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 67 (24 generated)
tmartino
Sending WIP version of refactor for sanity check.
4 years, 4 months ago (2016-07-25 20:22:58 UTC) #3
Roger Tawa OOO till Jul 10th
Looks fine so far Tommy. Some minor comments below. https://codereview.chromium.org/2164033002/diff/20001/chrome/browser/first_run/first_run.cc File chrome/browser/first_run/first_run.cc (right): https://codereview.chromium.org/2164033002/diff/20001/chrome/browser/first_run/first_run.cc#newcode661 chrome/browser/first_run/first_run.cc:661: ...
4 years, 4 months ago (2016-07-26 15:00:26 UTC) #5
tmartino
https://codereview.chromium.org/2164033002/diff/20001/chrome/browser/first_run/first_run.cc File chrome/browser/first_run/first_run.cc (right): https://codereview.chromium.org/2164033002/diff/20001/chrome/browser/first_run/first_run.cc#newcode661 chrome/browser/first_run/first_run.cc:661: } On 2016/07/26 at 15:00:26, Roger Tawa wrote: > ...
4 years, 4 months ago (2016-07-27 18:40:44 UTC) #6
tmartino
+grt Adding bug 517248.
4 years, 4 months ago (2016-07-28 18:28:57 UTC) #9
grt (UTC plus 2)
some nits and a suggestion below. thanks for hacking on this! https://codereview.chromium.org/2164033002/diff/40001/chrome/browser/first_run/first_run.cc File chrome/browser/first_run/first_run.cc (left): ...
4 years, 4 months ago (2016-07-29 06:56:16 UTC) #10
tmartino
Addressed the straightforward comments from grt. The input for the structural changes makes sense (I ...
4 years, 4 months ago (2016-07-29 15:28:12 UTC) #11
grt (UTC plus 2)
https://codereview.chromium.org/2164033002/diff/40001/chrome/browser/first_run/first_run.cc File chrome/browser/first_run/first_run.cc (right): https://codereview.chromium.org/2164033002/diff/40001/chrome/browser/first_run/first_run.cc#newcode88 chrome/browser/first_run/first_run.cc:88: const char* kNewTabMagicWord = "new_tab_page"; On 2016/07/29 06:56:15, grt ...
4 years, 4 months ago (2016-08-01 06:23:14 UTC) #12
grt (UTC plus 2)
On 2016/07/29 15:28:12, tmartino wrote: > Addressed the straightforward comments from grt. The input for ...
4 years, 4 months ago (2016-08-01 06:27:32 UTC) #13
tmartino
Re: Structure ------------ I've looked into this in more detail and I think I have ...
4 years, 4 months ago (2016-08-02 23:46:50 UTC) #14
tmartino
Update: I spoke to pkasting@ (who will be doing OWNERS review) about landing and TODOs, ...
4 years, 4 months ago (2016-08-03 23:34:03 UTC) #15
grt (UTC plus 2)
On 2016/08/02 23:46:50, tmartino wrote: > Re: Structure > ------------ > I've looked into this ...
4 years, 4 months ago (2016-08-04 10:59:12 UTC) #16
grt (UTC plus 2)
https://codereview.chromium.org/2164033002/diff/40001/chrome/browser/first_run/first_run.cc File chrome/browser/first_run/first_run.cc (right): https://codereview.chromium.org/2164033002/diff/40001/chrome/browser/first_run/first_run.cc#newcode88 chrome/browser/first_run/first_run.cc:88: const char* kNewTabMagicWord = "new_tab_page"; On 2016/08/02 23:46:50, tmartino ...
4 years, 4 months ago (2016-08-04 10:59:27 UTC) #17
tmartino
Hey Greg, Thanks again for doing so many (and such helpful) iterations on this! Sorry ...
4 years, 4 months ago (2016-08-19 22:41:16 UTC) #18
grt (UTC plus 2)
I'll take a look tomorrow. Ciao
4 years, 3 months ago (2016-08-22 19:11:13 UTC) #19
tmartino
On 2016/08/22 at 19:11:13, grt wrote: > I'll take a look tomorrow. Ciao Sounds good, ...
4 years, 3 months ago (2016-08-22 21:58:59 UTC) #20
grt (UTC plus 2)
https://codereview.chromium.org/2164033002/diff/120001/chrome/browser/first_run/first_run.cc File chrome/browser/first_run/first_run.cc (right): https://codereview.chromium.org/2164033002/diff/120001/chrome/browser/first_run/first_run.cc#newcode510 chrome/browser/first_run/first_run.cc:510: FirstRunState g_first_run = FIRST_RUN_UNKNOWN; please move this into the ...
4 years, 3 months ago (2016-08-23 10:36:02 UTC) #21
tmartino
I took a few days to grok your comments and decided there was still some ...
4 years, 3 months ago (2016-09-08 21:33:17 UTC) #22
grt (UTC plus 2)
i like where this is headed. i can see how individual pieces can be more ...
4 years, 3 months ago (2016-09-09 11:40:30 UTC) #23
tmartino
Good stuff; assume everything is "done" unless I've replied otherwise. Re: session restore and other ...
4 years, 3 months ago (2016-09-10 00:19:41 UTC) #24
grt (UTC plus 2)
It's difficult to validate that there's no behavior change here since the old code was ...
4 years, 3 months ago (2016-09-12 07:28:46 UTC) #25
tmartino
I've been working off my chicken-scratch flowchart so I went back and turned it into ...
4 years, 3 months ago (2016-09-13 23:22:23 UTC) #26
grt (UTC plus 2)
That doc is amazing and terrifying. :-) Could you transform it into the expected behavior ...
4 years, 3 months ago (2016-09-14 11:21:22 UTC) #27
tmartino
Makes sense; I'll try to update the doc tomorrow. Done to all comments. https://codereview.chromium.org/2164033002/diff/200001/chrome/browser/ui/startup/startup_tab_provider.h File ...
4 years, 3 months ago (2016-09-15 00:14:47 UTC) #28
grt (UTC plus 2)
https://codereview.chromium.org/2164033002/diff/220001/chrome/browser/ui/startup/startup_tab_provider.cc File chrome/browser/ui/startup/startup_tab_provider.cc (right): https://codereview.chromium.org/2164033002/diff/220001/chrome/browser/ui/startup/startup_tab_provider.cc#newcode115 chrome/browser/ui/startup/startup_tab_provider.cc:115: if (!profile_has_trigger) { nit: omit braces
4 years, 3 months ago (2016-09-16 07:05:31 UTC) #29
tmartino
Here's the flattened behavior (the best that I could trace it): https://docs.google.com/a/google.com/spreadsheets/d/1GAimMY1DERzkQ-0IZ5qa-cu0KL4Lff3iOIqBSFLL_7Y/edit?usp=sharing https://codereview.chromium.org/2164033002/diff/220001/chrome/browser/ui/startup/startup_tab_provider.cc File chrome/browser/ui/startup/startup_tab_provider.cc ...
4 years, 3 months ago (2016-09-21 01:39:03 UTC) #30
grt (UTC plus 2)
I think there are some changes in behavior; see below. Are they intentional? If so, ...
4 years, 3 months ago (2016-09-21 08:59:08 UTC) #31
tmartino
On 2016/09/21 at 08:59:08, grt wrote: > I think there are some changes in behavior; ...
4 years, 2 months ago (2016-09-23 23:20:07 UTC) #32
grt (UTC plus 2)
This is looking pretty good, though it looks like some complexity is creeping into DetermineStartupTabs ...
4 years, 2 months ago (2016-09-26 09:27:02 UTC) #33
tmartino
On 2016/09/26 at 09:27:02, grt wrote: > This is looking pretty good, though it looks ...
4 years, 2 months ago (2016-09-26 19:58:05 UTC) #34
grt (UTC plus 2)
makes sense. thanks for the detailed response. lgtm. https://codereview.chromium.org/2164033002/diff/260001/chrome/browser/ui/startup/startup_browser_creator_impl.cc File chrome/browser/ui/startup/startup_browser_creator_impl.cc (right): https://codereview.chromium.org/2164033002/diff/260001/chrome/browser/ui/startup/startup_browser_creator_impl.cc#newcode639 chrome/browser/ui/startup/startup_browser_creator_impl.cc:639: if ...
4 years, 2 months ago (2016-09-26 20:11:15 UTC) #35
tmartino
+pkasting for OWNERS on /ui/* Hi Peter, This is the first part of the StartupBrowserCreatorImpl ...
4 years, 2 months ago (2016-09-26 23:15:29 UTC) #46
Peter Kasting
Don't be put off by the number of comments below, most things are minor. https://codereview.chromium.org/2164033002/diff/320001/chrome/browser/ui/startup/startup_browser_creator.h ...
4 years, 2 months ago (2016-09-29 07:23:36 UTC) #49
tmartino
Thanks Peter! Assume everything is done unless otherwise specified. https://codereview.chromium.org/2164033002/diff/320001/chrome/browser/ui/startup/startup_browser_creator_impl.cc File chrome/browser/ui/startup/startup_browser_creator_impl.cc (right): https://codereview.chromium.org/2164033002/diff/320001/chrome/browser/ui/startup/startup_browser_creator_impl.cc#newcode592 chrome/browser/ui/startup/startup_browser_creator_impl.cc:592: ...
4 years, 2 months ago (2016-09-30 20:55:02 UTC) #50
Peter Kasting
Thanks for the very thoughtful and detailed replies. Here's some responses. I have yet to ...
4 years, 2 months ago (2016-09-30 21:50:04 UTC) #51
tmartino
Ok, I've addressed everything so PTAL. Also, I wanted to note that we're really hoping ...
4 years, 2 months ago (2016-10-03 23:26:06 UTC) #52
tmartino
Small update: the new Welcome page has been landed for awhile now, so I knocked ...
4 years, 2 months ago (2016-10-05 19:54:11 UTC) #53
Peter Kasting
LGTM. Sorry for taking so long. I've been flooded. https://codereview.chromium.org/2164033002/diff/320001/chrome/browser/ui/startup/startup_tab_provider.h File chrome/browser/ui/startup/startup_tab_provider.h (right): https://codereview.chromium.org/2164033002/diff/320001/chrome/browser/ui/startup/startup_tab_provider.h#newcode32 chrome/browser/ui/startup/startup_tab_provider.h:32: ...
4 years, 2 months ago (2016-10-06 05:49:09 UTC) #54
tmartino
Thanks again Roger, Greg, and Peter for all the attention you've given this. The difference ...
4 years, 2 months ago (2016-10-06 18:27:29 UTC) #55
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/2164033002/400001
4 years, 2 months ago (2016-10-06 19:39:02 UTC) #62
commit-bot: I haz the power
Committed patchset #21 (id:400001)
4 years, 2 months ago (2016-10-06 19:47:06 UTC) #63
commit-bot: I haz the power
Patchset 21 (id:??) landed as https://crrev.com/b930f6e90137299cc399cd35bcf7e7f89c19587e Cr-Commit-Position: refs/heads/master@{#423636}
4 years, 2 months ago (2016-10-06 19:49:18 UTC) #65
grt (UTC plus 2)
i like how this came together. i just made a quick pass and have two ...
4 years, 2 months ago (2016-10-07 07:21:45 UTC) #66
Peter Kasting
4 years, 2 months ago (2016-10-10 23:50:29 UTC) #67
Message was sent while issue was closed.
https://codereview.chromium.org/2164033002/diff/400001/chrome/browser/ui/star...
File chrome/browser/ui/startup/startup_browser_creator_impl.cc (right):

https://codereview.chromium.org/2164033002/diff/400001/chrome/browser/ui/star...
chrome/browser/ui/startup/startup_browser_creator_impl.cc:682: for (size_t i =
0; i < urls.size(); ++i) {
On 2016/10/07 07:21:45, grt (UTC plus 2) wrote:
> nit: this can be condensed a bit:
>   foreach (const GURL& url : urls) {
>     size_t j = 0;
>     while (j < num_existing_tabs && url != (*tabs)[j].url)
>       ++j;
>     if (j == num_existing_tabs)
>       tabs->emplace_back(url, false);
>   }

Yep.  And without spending much time thinking about the details, I'd say: The
first lines of that are trying to find if a matching element occurs in a
container or not, so look for a way to rewrite them with find_if() and a lambda.
 Even if this does not save much code, it more clearly expresses the underlying
intent.

Powered by Google App Engine
This is Rietveld 408576698