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

Issue 259613003: Fix auto-reload histograms. (Closed)

Created:
6 years, 8 months ago by Elly Fong-Jones
Modified:
6 years, 7 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@lkgr
Visibility:
Public.

Description

Fix auto-reload histograms. Two bugs, and general state-machine grotesqueness, prevented auto-reload histograms from working properly in production: 1. Success could only be reported in OnCommitLoad() if can_auto_reload_page_ was true, but can_auto_reload_page_ would be set to false in OnStartLoad(), since OnStartLoad() had no way of knowing that the non-error page load it saw starting was actually part of an attempt to auto-reload the page. This has been patched around by tracking is_auto_reloading in committed_error_page_info_; when the auto reload timer fires, it sets is_auto_reloading to indicate to OnCommitLoad that auto-reload was running. OnCommitLoad can then use is_auto_reloading and the loading URL to decide whether the committing load represents a success or failure for auto-reload. 2. Whenever a non-error load started, OnStartLoad() would call CancelPendingFetches(), intending to prevent auto-reload from replacing the starting load with its own; as a side-effect, CancelPendingFetches() would assume that if there was an existing error page which looked auto-reloadable that the cancel represented a failure of auto-reload and log a histogram entry. Unfortunately, this logic would trigger at each reload attempt by auto-reload, inflating the failure count with nonexistent failures. To prevent this misbehavior, CancelPendingFetches() is now no longer responsible for logging auto-reload failures; instead, failures are detected and logged in OnCommitLoad() (for "user navigated elsewhere" failures), OnStop (for "user pressed Stop to abort auto-reload" failures), and the NetErrorHelperCore destructor (for "user closed the tab" failures). To help clean up the code, statistics are now reported through ReportAutoReloadSuccess() and ReportAutoReloadFailure(). There are new unit tests covering these cases: 1. Auto-reload succeeding on the first attempt; 2. Auto-reload succeeding on the second attempt; 3. The user manually stopping an auto-reload; 4. The user manually stopping a non-auto-reload load; 5. The user navigating to a different URL; As part of this cleanup, simplify the state machine; the ambiguous "can_auto_reload_page_" flag is gone, replaced by an implicit state bit in whether the timer is running (or paused) or not. BUG= Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=271007

Patch Set 1 #

Total comments: 29

Patch Set 2 : First round of fixes #

Patch Set 3 : Fix stat collection #

Total comments: 31

Patch Set 4 : Rework state machine a bit #

Total comments: 76

Patch Set 5 : More unit-test fixes #

Total comments: 42

Patch Set 6 : More error_url() #

Total comments: 2

Patch Set 7 : Rebase #

Patch Set 8 : don't DCHECK uncommitted_load_started_ #

Patch Set 9 : fix build breaks on win32 and clang #

Total comments: 2

Patch Set 10 : Don't suppress error pages if AR is disabled #

Patch Set 11 : support autoreloading only visible tabs #

Patch Set 12 : Replace CL #

Patch Set 13 : Correctly terminate uncommitted loads #

Unified diffs Side-by-side diffs Delta from patch set Stats (+457 lines, -145 lines) Patch
M chrome/renderer/net/net_error_helper.cc View 1 2 3 4 5 6 11 1 chunk +1 line, -1 line 0 comments Download
M chrome/renderer/net/net_error_helper_core.h View 1 2 3 4 5 6 11 2 chunks +17 lines, -2 lines 0 comments Download
M chrome/renderer/net/net_error_helper_core.cc View 1 2 3 4 5 6 7 8 9 10 11 12 11 chunks +105 lines, -52 lines 0 comments Download
M chrome/renderer/net/net_error_helper_core_unittest.cc View 1 2 3 4 5 6 7 8 11 69 chunks +334 lines, -90 lines 0 comments Download

Messages

Total messages: 37 (0 generated)
mmenke
https://codereview.chromium.org/259613003/diff/1/chrome/renderer/net/net_error_helper_core.cc File chrome/renderer/net/net_error_helper_core.cc (right): https://codereview.chromium.org/259613003/diff/1/chrome/renderer/net/net_error_helper_core.cc#newcode294 chrome/renderer/net/net_error_helper_core.cc:294: bool is_auto_reloading; Think triggered_auto_reload would be clearer (Makes it ...
6 years, 8 months ago (2014-04-25 14:57:42 UTC) #1
Elly Fong-Jones
https://codereview.chromium.org/259613003/diff/1/chrome/renderer/net/net_error_helper_core.cc File chrome/renderer/net/net_error_helper_core.cc (right): https://codereview.chromium.org/259613003/diff/1/chrome/renderer/net/net_error_helper_core.cc#newcode294 chrome/renderer/net/net_error_helper_core.cc:294: bool is_auto_reloading; On 2014/04/25 14:57:42, mmenke wrote: > Think ...
6 years, 8 months ago (2014-04-25 20:01:25 UTC) #2
mmenke
https://codereview.chromium.org/259613003/diff/1/chrome/renderer/net/net_error_helper_core.cc File chrome/renderer/net/net_error_helper_core.cc (right): https://codereview.chromium.org/259613003/diff/1/chrome/renderer/net/net_error_helper_core.cc#newcode345 chrome/renderer/net/net_error_helper_core.cc:345: auto_reload_timer_->IsRunning())) { On 2014/04/25 20:01:26, Elly Jones wrote: > ...
6 years, 8 months ago (2014-04-25 20:08:03 UTC) #3
Elly Fong-Jones
On 2014/04/25 20:08:03, mmenke wrote: > https://codereview.chromium.org/259613003/diff/1/chrome/renderer/net/net_error_helper_core.cc > File chrome/renderer/net/net_error_helper_core.cc (right): > > https://codereview.chromium.org/259613003/diff/1/chrome/renderer/net/net_error_helper_core.cc#newcode345 > ...
6 years, 7 months ago (2014-04-28 19:17:37 UTC) #4
mmenke
https://codereview.chromium.org/259613003/diff/40001/chrome/renderer/net/net_error_helper_core.cc File chrome/renderer/net/net_error_helper_core.cc (right): https://codereview.chromium.org/259613003/diff/40001/chrome/renderer/net/net_error_helper_core.cc#newcode415 chrome/renderer/net/net_error_helper_core.cc:415: committed_error_page_info_->auto_reload_triggered) { Right...So whenever we destroy committed_error_page_info_, we update ...
6 years, 7 months ago (2014-04-28 20:21:14 UTC) #5
Randy Smith (Not in Mondays)
https://codereview.chromium.org/259613003/diff/40001/chrome/renderer/net/net_error_helper_core.cc File chrome/renderer/net/net_error_helper_core.cc (right): https://codereview.chromium.org/259613003/diff/40001/chrome/renderer/net/net_error_helper_core.cc#newcode343 chrome/renderer/net/net_error_helper_core.cc:343: UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.AutoReload.ErrorAtStop", Why isn't this using the helper functions? That ...
6 years, 7 months ago (2014-04-28 21:05:52 UTC) #6
Elly Fong-Jones
PTAL? https://codereview.chromium.org/259613003/diff/40001/chrome/renderer/net/net_error_helper_core.cc File chrome/renderer/net/net_error_helper_core.cc (right): https://codereview.chromium.org/259613003/diff/40001/chrome/renderer/net/net_error_helper_core.cc#newcode415 chrome/renderer/net/net_error_helper_core.cc:415: committed_error_page_info_->auto_reload_triggered) { On 2014/04/28 20:21:14, mmenke wrote: > ...
6 years, 7 months ago (2014-04-30 15:34:08 UTC) #7
mmenke
This looks pretty reasonable...At least I can't notice any bugs. Would like more tests of ...
6 years, 7 months ago (2014-04-30 18:06:58 UTC) #8
Randy Smith (Not in Mondays)
LGTM conditional on my "Just confirming" below; everything else is suggestions you can do what ...
6 years, 7 months ago (2014-04-30 18:22:16 UTC) #9
Elly Fong-Jones
https://codereview.chromium.org/259613003/diff/60001/chrome/renderer/net/net_error_helper.cc File chrome/renderer/net/net_error_helper.cc (right): https://codereview.chromium.org/259613003/diff/60001/chrome/renderer/net/net_error_helper.cc#newcode118 chrome/renderer/net/net_error_helper.cc:118: core_.OnCommitLoad(GetFrameType(frame), url); On 2014/04/30 18:22:16, rdsmith wrote: > I ...
6 years, 7 months ago (2014-05-01 18:33:02 UTC) #10
mmenke
https://codereview.chromium.org/259613003/diff/80001/chrome/renderer/net/net_error_helper_core_unittest.cc File chrome/renderer/net/net_error_helper_core_unittest.cc (right): https://codereview.chromium.org/259613003/diff/80001/chrome/renderer/net/net_error_helper_core_unittest.cc#newcode1280 chrome/renderer/net/net_error_helper_core_unittest.cc:1280: core().OnCommitLoad(NetErrorHelperCore::MAIN_FRAME, default_url()); error_url. https://codereview.chromium.org/259613003/diff/80001/chrome/renderer/net/net_error_helper_core_unittest.cc#newcode1300 chrome/renderer/net/net_error_helper_core_unittest.cc:1300: core().OnCommitLoad(NetErrorHelperCore::MAIN_FRAME, default_url()); error_url. https://codereview.chromium.org/259613003/diff/80001/chrome/renderer/net/net_error_helper_core_unittest.cc#newcode1367 ...
6 years, 7 months ago (2014-05-02 14:35:12 UTC) #11
Elly Fong-Jones
PTAL? https://codereview.chromium.org/259613003/diff/60001/chrome/renderer/net/net_error_helper_core_unittest.cc File chrome/renderer/net/net_error_helper_core_unittest.cc (right): https://codereview.chromium.org/259613003/diff/60001/chrome/renderer/net/net_error_helper_core_unittest.cc#newcode1884 chrome/renderer/net/net_error_helper_core_unittest.cc:1884: TEST_F(NetErrorHelperCoreTest, AutoReloadStopsOnOffline) { On 2014/04/30 18:06:58, mmenke wrote: ...
6 years, 7 months ago (2014-05-02 17:29:25 UTC) #12
mmenke
LGTM https://codereview.chromium.org/259613003/diff/100001/chrome/renderer/net/net_error_helper_core_unittest.cc File chrome/renderer/net/net_error_helper_core_unittest.cc (right): https://codereview.chromium.org/259613003/diff/100001/chrome/renderer/net/net_error_helper_core_unittest.cc#newcode1804 chrome/renderer/net/net_error_helper_core_unittest.cc:1804: DoErrorLoad(net::ERR_CONNECTION_RESET); A bit far afield of this CL, ...
6 years, 7 months ago (2014-05-02 18:20:12 UTC) #13
Elly Fong-Jones
The CQ bit was checked by ellyjones@chromium.org
6 years, 7 months ago (2014-05-08 19:18:25 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ellyjones@chromium.org/259613003/100001
6 years, 7 months ago (2014-05-08 19:21:17 UTC) #15
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). Please consider checking whether the failures are ...
6 years, 7 months ago (2014-05-08 22:30:14 UTC) #16
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 7 months ago (2014-05-08 22:38:20 UTC) #17
commit-bot: I haz the power
Try jobs failed on following builders: android_chromium_gn_compile_rel on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/android_chromium_gn_compile_rel/builds/2652) chromium_presubmit on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/chromium_presubmit/builds/66631) ios_dbg_simulator ...
6 years, 7 months ago (2014-05-08 22:38:21 UTC) #18
Elly Fong-Jones
The CQ bit was checked by ellyjones@chromium.org
6 years, 7 months ago (2014-05-09 15:32:46 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ellyjones@chromium.org/259613003/100001
6 years, 7 months ago (2014-05-09 15:36:02 UTC) #20
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). Please consider checking whether the failures are ...
6 years, 7 months ago (2014-05-09 16:09:45 UTC) #21
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 7 months ago (2014-05-09 16:17:31 UTC) #22
commit-bot: I haz the power
Try jobs failed on following builders: android_chromium_gn_compile_rel on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/android_chromium_gn_compile_rel/builds/2872) linux_chromium_chromeos_clang_dbg on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/linux_chromium_chromeos_clang_dbg/builds/15698) linux_chromium_chromeos_rel ...
6 years, 7 months ago (2014-05-09 16:17:32 UTC) #23
Elly Fong-Jones
The CQ bit was checked by ellyjones@chromium.org
6 years, 7 months ago (2014-05-09 19:50:40 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ellyjones@chromium.org/259613003/120001
6 years, 7 months ago (2014-05-09 19:54:45 UTC) #25
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). Please consider checking whether the failures are ...
6 years, 7 months ago (2014-05-10 01:03:12 UTC) #26
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 7 months ago (2014-05-10 01:08:02 UTC) #27
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_rel on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/linux_chromium_chromeos_rel/builds/25274) linux_chromium_rel on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/linux_chromium_rel/builds/30003)
6 years, 7 months ago (2014-05-10 01:08:03 UTC) #28
Elly Fong-Jones
The CQ bit was checked by ellyjones@chromium.org
6 years, 7 months ago (2014-05-12 14:22:13 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ellyjones@chromium.org/259613003/120001
6 years, 7 months ago (2014-05-12 14:22:25 UTC) #30
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). Please consider checking whether the failures are ...
6 years, 7 months ago (2014-05-12 18:29:50 UTC) #31
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 7 months ago (2014-05-12 18:45:17 UTC) #32
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/linux_chromium_rel/builds/30399)
6 years, 7 months ago (2014-05-12 18:45:17 UTC) #33
mmenke
LGTM https://codereview.chromium.org/259613003/diff/160001/chrome/renderer/net/net_error_helper_core.cc File chrome/renderer/net/net_error_helper_core.cc (right): https://codereview.chromium.org/259613003/diff/160001/chrome/renderer/net/net_error_helper_core.cc#newcode517 chrome/renderer/net/net_error_helper_core.cc:517: if (committed_error_page_info_ && !pending_error_page_info_ && Hrm...In a followup ...
6 years, 7 months ago (2014-05-13 18:41:10 UTC) #34
Elly Fong-Jones
The CQ bit was checked by ellyjones@chromium.org
6 years, 7 months ago (2014-05-16 12:12:14 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ellyjones@chromium.org/259613003/240001
6 years, 7 months ago (2014-05-16 12:12:24 UTC) #36
commit-bot: I haz the power
6 years, 7 months ago (2014-05-16 13:34:53 UTC) #37
Message was sent while issue was closed.
Change committed as 271007

Powered by Google App Engine
This is Rietveld 408576698