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

Issue 131233003: Refactor ResourceLoadPriorityOptimizer to avoid walking render tree (Closed)

Created:
6 years, 11 months ago by shatch
Modified:
6 years, 11 months ago
Reviewers:
eseidel, esprehn, ojan
CC:
blink-reviews, bemjb+rendering_chromium.org, eae+blinkwatch, leviw+renderwatch, jchaffraix+rendering, zoltan1
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Refactor ResourceLoadPriorityOptimizer to avoid walking render tree after every layout and scroll event. 1. Instead of calling RenderObject::didScroll on every FrameView::scrollPositionChanged, use a 250 ms timer to update the image priorities. Ideally, we only update the image priorities once now about 250 ms after scrolling stops. 2. Whenever a RenderImage/RenderBlock is created, it's added to the ResourceLoadPriorityOptimizer. After a layout/scroll, iterate the list removing any RenderObject that either has no images, or has loaded all of it's images. BUG=332285 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=165582

Patch Set 1 #

Patch Set 2 : Use esprehn's suggestion. #

Total comments: 14

Patch Set 3 : Changes from review. #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+125 lines, -80 lines) Patch
M Source/core/fetch/ResourceLoadPriorityOptimizer.h View 1 2 3 chunks +12 lines, -2 lines 1 comment Download
M Source/core/fetch/ResourceLoadPriorityOptimizer.cpp View 1 2 2 chunks +40 lines, -0 lines 0 comments Download
M Source/core/frame/FrameView.h View 1 2 chunks +3 lines, -0 lines 0 comments Download
M Source/core/frame/FrameView.cpp View 1 2 6 chunks +14 lines, -7 lines 0 comments Download
M Source/core/rendering/RenderBlock.h View 1 1 chunk +1 line, -3 lines 0 comments Download
M Source/core/rendering/RenderBlock.cpp View 1 2 5 chunks +38 lines, -35 lines 1 comment Download
M Source/core/rendering/RenderImage.h View 1 1 chunk +1 line, -3 lines 0 comments Download
M Source/core/rendering/RenderImage.cpp View 1 2 3 chunks +6 lines, -15 lines 0 comments Download
M Source/core/rendering/RenderObject.h View 1 2 3 chunks +8 lines, -3 lines 0 comments Download
M Source/core/rendering/RenderObject.cpp View 1 2 3 chunks +2 lines, -12 lines 1 comment Download

Messages

Total messages: 11 (0 generated)
shatch
6 years, 11 months ago (2014-01-13 23:24:57 UTC) #1
esprehn
Most things in a page are RenderBlocks, which means this HashSet will usually be about ...
6 years, 11 months ago (2014-01-13 23:29:42 UTC) #2
shatch
On 2014/01/13 23:29:42, esprehn wrote: > Most things in a page are RenderBlocks, which means ...
6 years, 11 months ago (2014-01-14 00:37:19 UTC) #3
esprehn
This looks promising. https://codereview.chromium.org/131233003/diff/40001/Source/core/fetch/ResourceLoadPriorityOptimizer.cpp File Source/core/fetch/ResourceLoadPriorityOptimizer.cpp (right): https://codereview.chromium.org/131233003/diff/40001/Source/core/fetch/ResourceLoadPriorityOptimizer.cpp#newcode63 Source/core/fetch/ResourceLoadPriorityOptimizer.cpp:63: void ResourceLoadPriorityOptimizer::addRenderObject(RenderObject* o) object or renderer, ...
6 years, 11 months ago (2014-01-15 01:27:44 UTC) #4
shatch
New snapshot uploaded, ptal. https://codereview.chromium.org/131233003/diff/40001/Source/core/fetch/ResourceLoadPriorityOptimizer.cpp File Source/core/fetch/ResourceLoadPriorityOptimizer.cpp (right): https://codereview.chromium.org/131233003/diff/40001/Source/core/fetch/ResourceLoadPriorityOptimizer.cpp#newcode63 Source/core/fetch/ResourceLoadPriorityOptimizer.cpp:63: void ResourceLoadPriorityOptimizer::addRenderObject(RenderObject* o) On 2014/01/15 ...
6 years, 11 months ago (2014-01-15 19:28:51 UTC) #5
shatch
friendly ping On 2014/01/15 19:28:51, shatch wrote: > New snapshot uploaded, ptal. > > https://codereview.chromium.org/131233003/diff/40001/Source/core/fetch/ResourceLoadPriorityOptimizer.cpp ...
6 years, 11 months ago (2014-01-22 00:49:18 UTC) #6
esprehn
lgtm, the timer makes me a little nervous since the behavior is less predictable, but ...
6 years, 11 months ago (2014-01-22 01:06:43 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/simonhatch@chromium.org/131233003/140002
6 years, 11 months ago (2014-01-22 20:45:23 UTC) #8
commit-bot: I haz the power
Change committed as 165582
6 years, 11 months ago (2014-01-23 00:56:50 UTC) #9
ojan
Some drive-by questions... https://codereview.chromium.org/131233003/diff/140002/Source/core/fetch/ResourceLoadPriorityOptimizer.h File Source/core/fetch/ResourceLoadPriorityOptimizer.h (right): https://codereview.chromium.org/131233003/diff/140002/Source/core/fetch/ResourceLoadPriorityOptimizer.h#newcode73 Source/core/fetch/ResourceLoadPriorityOptimizer.h:73: typedef HashSet<RenderObject*> RenderObjectSet; Since we only ...
6 years, 11 months ago (2014-01-23 06:32:59 UTC) #10
shatch
6 years, 11 months ago (2014-01-27 17:47:47 UTC) #11
Message was sent while issue was closed.
Sorry ojan, didn't see this message!

Replies below:

On 2014/01/23 06:32:59, ojan wrote:
> Some drive-by questions...
> 
>
https://codereview.chromium.org/131233003/diff/140002/Source/core/fetch/Resou...
> File Source/core/fetch/ResourceLoadPriorityOptimizer.h (right):
> 
>
https://codereview.chromium.org/131233003/diff/140002/Source/core/fetch/Resou...
> Source/core/fetch/ResourceLoadPriorityOptimizer.h:73: typedef
> HashSet<RenderObject*> RenderObjectSet;
> Since we only ever add RenderImages, could we tighten up this type?
> 

We add RenderBlocks as well.

>
https://codereview.chromium.org/131233003/diff/140002/Source/core/rendering/R...
> File Source/core/rendering/RenderBlock.cpp (right):
> 
>
https://codereview.chromium.org/131233003/diff/140002/Source/core/rendering/R...
> Source/core/rendering/RenderBlock.cpp:218:
>
ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeRenderObject(this);
> Is this needed with the RenderObject destructor also calling this?
> 

You're right, I'll remove this and upload a CL.

>
https://codereview.chromium.org/131233003/diff/140002/Source/core/rendering/R...
> File Source/core/rendering/RenderObject.cpp (right):
> 
>
https://codereview.chromium.org/131233003/diff/140002/Source/core/rendering/R...
> Source/core/rendering/RenderObject.cpp:239:
>
ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeRenderObject(this);
> Since we only ever add RenderImages, could we just call this from the
> RenderImage destructor?

We add RenderBlocks as well.

Powered by Google App Engine
This is Rietveld 408576698