Closed Bug 1315477 Opened 3 years ago Closed 3 years ago

Eliminate static_cast<>s on LayerManager types

Categories

(Core :: Graphics: WebRender, defect)

52 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: kats, Assigned: kats)

References

()

Details

Attachments

(2 files)

In a number of places we do a static_cast<ClientLayerManager*> on a manager. All of these seem to be guarded by checks of the backend type being equal to LAYERS_CLIENT. However it's better to just do manager->AsClientLayerManager() which effectively does the same thing, and returns null if not.

There is at least one place [1] where we assume that a layer manager in the content process that's not a LAYERS_CLIENT *must* be a BasicLayerManager, and does a static_cast to that effect at [2]. Of course, if we're using something like a WebRenderLayerManager that just writes all over the WRLM and corrupts the state.

[1] http://searchfox.org/mozilla-central/rev/f5c9e9a249637c9abd88754c8963ecb3838475cb/widget/PuppetWidget.cpp#1082
[2] http://searchfox.org/mozilla-central/rev/f5c9e9a249637c9abd88754c8963ecb3838475cb/widget/nsBaseWidget.cpp#909
Assignee: nobody → bugmail
Comment on attachment 8808226 [details]
Bug 1315477 - Add a AsBasicLayerManager() function and use instead of static_casts.

https://reviewboard.mozilla.org/r/91074/#review90926
Attachment #8808226 - Flags: review?(matt.woodrow) → review+
Comment on attachment 8808225 [details]
Bug 1315477 - Remove some instances of static_cast'ing to ClientLayerManager.

https://reviewboard.mozilla.org/r/91072/#review90930
Attachment #8808225 - Flags: review?(matt.woodrow) → review+
Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9f208d6e52c5
Remove some instances of static_cast'ing to ClientLayerManager. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/a229fb665939
Add a AsBasicLayerManager() function and use instead of static_casts. r=mattwoodrow
https://hg.mozilla.org/mozilla-central/rev/9f208d6e52c5
https://hg.mozilla.org/mozilla-central/rev/a229fb665939
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.