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

Issue 658163002: Fixed resource scheduler to not treat non-blocking js as render-blocking (Closed)

Created:
6 years, 2 months ago by Pat Meenan
Modified:
6 years, 2 months ago
Reviewers:
mmenke
CC:
chromium-reviews, darin-cc_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Fixed resource scheduler to not treat non-blocking js as render-blocking Prior to https://codereview.chromium.org/462813002 the resource scheduler would exit the critical loading phase as soon as the main parser parsed the body tag: - Blocking JS in the head would keep it in the critical phase - CSS in the head would not (this is the bug that was fixed) - Non-blocking JS or JS discovered by the preload scanner would NOT keep it in the critical phase. After the fix: - Blocking JS in the head still kept it in the critical phase - CSS in the head kept it in the critical phase (fix worked) - Any JS that was started before the body tag was parsed would keep it in the critical phase until that JS finished loading. This inclues non-blocking JS (script-injected while in the head) as well as JS discovered by the preload scanner. This change keeps the CSS fix but also restores the JS behavior so that non-blocking or preload-scanned JS no longer keep the loader in the critical resources phase. The fix was really simple since CSS loads at a higher priority than JS (net::Medium), I just changed the logic to only count Medium+ as render-blocking (waiting for them to finish regardless of the state of the body tag) and returned the logic that unblocks non-render-blocking resources as soon as the body tag was parsed (which now includes JS). Any blocking JS still keeps the main parser blocked so only non-blocking and preloaded JS would be pending or loading when the body tag is parsed. You can see it working here: http://www.webpagetest.org/video/compare.php?tests=141016_WH_e488a05d7b224d7fc362dfa91b7c5ec6,141016_H1_2ecb3d397b3c218ff26dc7bdb9cb0858 Request #13 is a non-blocking script that in teh baseline case keeps images from being loaded but in the fixed case no longer blocks images. The canonical test page for the CSS bug also shows the critical phase still being honored when only css is parsed in the head: http://www.webpagetest.org/video/compare.php?tests=141016_VM_1d25c3ff22f132b4ded97d7d72e5e558,141016_PM_17a2f0282c39f299425ba57c5c5118bf BUG=423853 Committed: https://crrev.com/8a7d3a2d6b85c624db87d8fdea641d1214afe969 Cr-Commit-Position: refs/heads/master@{#299959}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Unit test added #

Total comments: 2

Patch Set 3 : Fixed line lengths #

Unified diffs Side-by-side diffs Delta from patch set Stats (+18 lines, -5 lines) Patch
M content/browser/loader/resource_scheduler.cc View 4 chunks +6 lines, -5 lines 0 comments Download
M content/browser/loader/resource_scheduler_unittest.cc View 1 2 1 chunk +12 lines, -0 lines 0 comments Download

Messages

Total messages: 11 (2 generated)
Pat Meenan
6 years, 2 months ago (2014-10-16 15:00:35 UTC) #2
mmenke
LGTM. If this were any more complicated, I'd ask for a unit test, but as-is ...
6 years, 2 months ago (2014-10-16 15:57:38 UTC) #3
mmenke
https://codereview.chromium.org/658163002/diff/1/content/browser/loader/resource_scheduler.cc File content/browser/loader/resource_scheduler.cc (right): https://codereview.chromium.org/658163002/diff/1/content/browser/loader/resource_scheduler.cc#newcode660 content/browser/loader/resource_scheduler.cc:660: (!has_body_ || total_layout_blocking_count_ != 0) && Oh, may want ...
6 years, 2 months ago (2014-10-16 15:59:01 UTC) #4
Pat Meenan
Added a unit test that keeps a low-priority request in flight and triggers the exit ...
6 years, 2 months ago (2014-10-16 16:50:08 UTC) #5
mmenke
LGTM https://codereview.chromium.org/658163002/diff/20001/content/browser/loader/resource_scheduler_unittest.cc File content/browser/loader/resource_scheduler_unittest.cc (right): https://codereview.chromium.org/658163002/diff/20001/content/browser/loader/resource_scheduler_unittest.cc#newcode333 content/browser/loader/resource_scheduler_unittest.cc:333: scoped_ptr<TestRequest> lowest2(NewRequest("http://host/lowest", net::LOWEST)); nit: Fix line length.
6 years, 2 months ago (2014-10-16 17:19:42 UTC) #6
Pat Meenan
https://codereview.chromium.org/658163002/diff/20001/content/browser/loader/resource_scheduler_unittest.cc File content/browser/loader/resource_scheduler_unittest.cc (right): https://codereview.chromium.org/658163002/diff/20001/content/browser/loader/resource_scheduler_unittest.cc#newcode333 content/browser/loader/resource_scheduler_unittest.cc:333: scoped_ptr<TestRequest> lowest2(NewRequest("http://host/lowest", net::LOWEST)); On 2014/10/16 17:19:42, mmenke wrote: > ...
6 years, 2 months ago (2014-10-16 18:20:55 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/658163002/40001
6 years, 2 months ago (2014-10-16 18:21:32 UTC) #9
commit-bot: I haz the power
Committed patchset #3 (id:40001)
6 years, 2 months ago (2014-10-16 19:43:28 UTC) #10
commit-bot: I haz the power
6 years, 2 months ago (2014-10-16 19:45:09 UTC) #11
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/8a7d3a2d6b85c624db87d8fdea641d1214afe969
Cr-Commit-Position: refs/heads/master@{#299959}

Powered by Google App Engine
This is Rietveld 408576698