New issue
Advanced search Search tips

Issue 822873 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Task

Blocked on:
issue 590872

Blocking:
issue 822915



Sign in to add a comment

Clean up LayerImpl

Project Member Reported by weiliangc@chromium.org, Mar 16 2018

Issue description

Looked at layer impl with ajuma@ the other day, there are still a list of small clean ups we could be doing for layerimpl.

Some of the dead code can just be removed.

Rough list including:
- Remove position since we only need for root layer position.
- Move main thread scrolling reason to test properties, should be queried from scroll tree.
- Move scrollable to scroll tree.
- Move IsResizedByBrowserControls to test properties since it should only be used on main.
- Move mask_to_bounds to test properties and clip tree since it is only implying clip.
- Remove draw mode from each layer, it is a LTHI (or LTI) level property.
- PictureLayerImpl's asking for which tree is duplicate of LayerImpl's IsActive().
- has_copy_requests_in_target_subtree is only used in unit tests and could be gathered from effect tree.

 

Comment 1 by danakj@chromium.org, Mar 16 2018

If you have any further guidance for each of these, would you mind writing it down so folks could pick it up and know where to start, or how to approach doing what it says?
Some high level knowledge dump:

Layer impl test properties: https://cs.chromium.org/chromium/src/cc/layers/layer_impl_test_properties.h?sq=package:chromium&l=30
These are properties that are used to build property trees. Currently we don't build property trees on compositor thread (impl side) for production code, it's only used to keep unit tests in check. 

Move a property from layer impl to test properties would include moving it to the test properties class, and also set up accessor helper function in build property tree function: https://cs.chromium.org/chromium/src/cc/trees/property_tree_builder.cc?q=buildpropertytrees&sq=package:chromium&l=146

Setter of these properties would be test only code going through setting the test properties. In production the property would be passed through property trees.

Getters of these properties would go through accessing the property trees on which it lives. Property trees live on layer_tree_impl(), and (transform/clip/effect/scroll)_tree_index() is on the LayerImpl.
Trickier ones from the list would be:
- Remove position since we only need for root layer position.
The non test usage of layerimpl's position is to get the root layer's position here: https://cs.chromium.org/chromium/src/cc/trees/layer_tree_host_common.cc?sq=package:chromium&l=562
This would need to be passed in as a parameter on inputs instead.


- Remove draw mode from each layer, it is a LTHI (or LTI) level property.
Each LayerImpl has a DrawMode. It's used for DCHECK in a bunch of places. It only affect the code path when PictureLayerImpl tries to check if we are in resourceless software draw, which could be access from the tree.

The problem is that draw mode is set through calling WillDraw() and DidDraw() on each LayerImpl. Since we should always call WillDraw->AppendQuads->DidDraw, it's possible to move the WillDraw and DidDraw functions into beginning and ending of AppendQuads instead. 

Also unit tests are calling WillDraw and DidDraw to set draw mode on LayerImpl. Would need to change all these calls to set draw mode on LayerTreeImpl.


Blocking: 822915

Comment 5 by sadrul@chromium.org, Mar 16 2018

Labels: Hotlist-CodeHealth
Project Member

Comment 6 by bugdroid1@chromium.org, Mar 17 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2ac1c7c72c3c369a7e99a76a22b3322687179439

commit 2ac1c7c72c3c369a7e99a76a22b3322687179439
Author: Weiliang Chen <weiliangc@chromium.org>
Date: Sat Mar 17 00:22:00 2018

cc: Remove Unused Code on LayerImpl

Remove unused code.

TBR=enne

Bug: 822873
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: Icfce16105876d05efaa83b858fd4d39be3add686
Reviewed-on: https://chromium-review.googlesource.com/967157
Commit-Queue: weiliangc <weiliangc@chromium.org>
Reviewed-by: weiliangc <weiliangc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543882}
[modify] https://crrev.com/2ac1c7c72c3c369a7e99a76a22b3322687179439/cc/layers/layer_impl.cc
[modify] https://crrev.com/2ac1c7c72c3c369a7e99a76a22b3322687179439/cc/layers/layer_impl.h

Project Member

Comment 7 by bugdroid1@chromium.org, Mar 17 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5e350ca00d1a5355a825a9b7270dc8c4e9ddb827

commit 5e350ca00d1a5355a825a9b7270dc8c4e9ddb827
Author: Weiliang Chen <weiliangc@chromium.org>
Date: Sat Mar 17 19:51:33 2018

cc: Remove test only function checking for copy request on LayerImpl

This function is only called on tests, and it goes to effect tree to
get correct information. Remove this from LayerImpl.

R=danakj

Bug: 822873
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: I21e13b32de44a5a5c50fbdc5029f2fe620a17e09
Reviewed-on: https://chromium-review.googlesource.com/967089
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: weiliangc <weiliangc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543947}
[modify] https://crrev.com/5e350ca00d1a5355a825a9b7270dc8c4e9ddb827/cc/layers/layer_impl.cc
[modify] https://crrev.com/5e350ca00d1a5355a825a9b7270dc8c4e9ddb827/cc/layers/layer_impl.h
[modify] https://crrev.com/5e350ca00d1a5355a825a9b7270dc8c4e9ddb827/cc/trees/layer_tree_host_common_unittest.cc

Project Member

Comment 8 by bugdroid1@chromium.org, Mar 18 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4f82fb79874816b7e4446e14861ef77881da0acc

commit 4f82fb79874816b7e4446e14861ef77881da0acc
Author: Weiliang Chen <weiliangc@chromium.org>
Date: Sun Mar 18 05:45:30 2018

cc: Remove GetTree from PictureLayerImpl, Use Existing Function

LayerImpl has IsActive function to check if layer is on active tree.
Use that function instead of the PictureLayerImpl's GetTree function.

R=danakj

Bug: 822873
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: I169e9ccbca359cc56cb48a7b3587d8bd2f5b753c
Reviewed-on: https://chromium-review.googlesource.com/967268
Commit-Queue: weiliangc <weiliangc@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543951}
[modify] https://crrev.com/4f82fb79874816b7e4446e14861ef77881da0acc/cc/benchmarks/rasterize_and_record_benchmark_impl.cc
[modify] https://crrev.com/4f82fb79874816b7e4446e14861ef77881da0acc/cc/layers/layer_impl.h
[modify] https://crrev.com/4f82fb79874816b7e4446e14861ef77881da0acc/cc/layers/picture_layer_impl.cc
[modify] https://crrev.com/4f82fb79874816b7e4446e14861ef77881da0acc/cc/layers/picture_layer_impl.h

Comment 9 by ajuma@chromium.org, Apr 16 2018

Blockedon: 590872

Sign in to add a comment