Closed Bug 1435637 Opened 2 years ago Closed 2 years ago

Minimally cleanup nsRefreshDriver.

Categories

(Core :: Layout, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: emilio, Assigned: emilio)

Details

Attachments

(1 file)

Just use more ranged loops on locals and such.
Comment on attachment 8948284 [details]
Bug 1435637: Minimally tidy nsRefreshDriver.

https://reviewboard.mozilla.org/r/217784/#review223508

::: layout/base/nsRefreshDriver.cpp:1863
(Diff revision 1)
>  
>    // Resize events should be fired before layout flushes or
>    // calling animation frame callbacks.
>    AutoTArray<nsIPresShell*, 16> observers;
>    observers.AppendElements(mResizeEventFlushObservers);
> -  for (uint32_t i = observers.Length(); i; --i) {
> +  for (nsIPresShell* shell : observers) {

This needs to use Reversed.
Comment on attachment 8948284 [details]
Bug 1435637: Minimally tidy nsRefreshDriver.

https://reviewboard.mozilla.org/r/217784/#review223510

::: layout/base/nsRefreshDriver.cpp:1641
(Diff revision 2)
>    // Hold all AnimationEventDispatcher in mAnimationEventFlushObservers as
>    // a RefPtr<> array since each AnimationEventDispatcher might be destroyed
>    // during processing the previous dispatcher.
> -  size_t len = mAnimationEventFlushObservers.Length();
>    AutoTArray<RefPtr<AnimationEventDispatcher>, 16> dispatchers;
> -  RefPtr<AnimationEventDispatcher>* elems = dispatchers.AppendElements(len);
> +  dispatchers.AppendElements(mAnimationEventFlushObservers);

Oh, I didn't know that AppendElements works between RefPtr<> and raw pointer.

::: layout/base/nsRefreshDriver.cpp:1975
(Diff revision 2)
>    }
>  
>  #ifdef MOZ_XUL
>    // Update any popups that may need to be moved or hidden due to their
>    // anchor changing.
> -  nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
> +  if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {

Though this isn't related to this bug, I am OK with this. :)
Attachment #8948284 - Flags: review?(hikezoe) → review+
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/b3319e229c7d
Minimally tidy nsRefreshDriver. r=hiro
https://hg.mozilla.org/mozilla-central/rev/b3319e229c7d
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in before you can comment on or make changes to this bug.