Bug 235985 - Share more WebPage code related to marking layers volatile
Summary: Share more WebPage code related to marking layers volatile
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-01 16:19 PST by Simon Fraser (smfr)
Modified: 2022-02-01 21:02 PST (History)
3 users (show)

See Also:


Attachments
Patch (6.80 KB, patch)
2022-02-01 16:20 PST, Simon Fraser (smfr)
cdumez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2022-02-01 16:19:25 PST
Share more WebPage code related to marking layers volatile
Comment 1 Simon Fraser (smfr) 2022-02-01 16:20:38 PST
Created attachment 450585 [details]
Patch
Comment 2 Chris Dumez 2022-02-01 16:34:15 PST
Comment on attachment 450585 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=450585&action=review

> Source/WebKit/WebProcess/WebPage/WebPage.cpp:2842
> +    WEBPAGE_RELEASE_LOG(Layers, "markLayersVolatile");

This seems to go against the usual style of our release logging?

> Source/WebKit/WebProcess/WebPage/WebPage.cpp:2853
> +void WebPage::markLayersVolatileOrRetry(MarkLayersVolatileStopReason stopReason, Seconds timerInterval)

Why the second parameter? Can we just use initialLayerVolatilityTimerInterval inside the function like we used to?

> Source/WebKit/WebProcess/WebPage/WebPage.cpp:2876
> +    WEBPAGE_RELEASE_LOG_ERROR(Layers, "markLayersVolatile: Failed to mark all layers as volatile, will retry in %g ms", timerInterval.milliseconds());

This was downgraded from error logging to regular logging a while back because this happens a lot and I am tired of getting radars about it.

> Source/WebKit/WebProcess/WebPage/WebPage.h:1592
> +    enum class MarkLayersVolatileStopReason {

nit: Could be on one line.
Also: We should use uint8_t as underlying type.

Also, I find the name of this enum super confusing given that the function does something no matter what the stop reason is. I would prefer something like:
enum class ShouldRetryMarkingAsVolatile { NoDueToSuspensionUnderLock, NoDueToTimeout, Yes };
Comment 3 Chris Dumez 2022-02-01 16:35:42 PST
(In reply to Chris Dumez from comment #2)
> Comment on attachment 450585 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=450585&action=review
> 
> > Source/WebKit/WebProcess/WebPage/WebPage.cpp:2842
> > +    WEBPAGE_RELEASE_LOG(Layers, "markLayersVolatile");
> 
> This seems to go against the usual style of our release logging?
> 
> > Source/WebKit/WebProcess/WebPage/WebPage.cpp:2853
> > +void WebPage::markLayersVolatileOrRetry(MarkLayersVolatileStopReason stopReason, Seconds timerInterval)
> 
> Why the second parameter? Can we just use
> initialLayerVolatilityTimerInterval inside the function like we used to?
> 
> > Source/WebKit/WebProcess/WebPage/WebPage.cpp:2876
> > +    WEBPAGE_RELEASE_LOG_ERROR(Layers, "markLayersVolatile: Failed to mark all layers as volatile, will retry in %g ms", timerInterval.milliseconds());
> 
> This was downgraded from error logging to regular logging a while back
> because this happens a lot and I am tired of getting radars about it.
> 
> > Source/WebKit/WebProcess/WebPage/WebPage.h:1592
> > +    enum class MarkLayersVolatileStopReason {
> 
> nit: Could be on one line.
> Also: We should use uint8_t as underlying type.
> 
> Also, I find the name of this enum super confusing given that the function
> does something no matter what the stop reason is. I would prefer something
> like:
> enum class ShouldRetryMarkingAsVolatile { NoDueToSuspensionUnderLock,
> NoDueToTimeout, Yes };

I meant:
enum class ShouldRetryMarkingAsVolatile : uint8_t { NoDueToSuspensionUnderLock, NoDueToTimeout, Yes };
Comment 4 Simon Fraser (smfr) 2022-02-01 16:38:37 PST
Comment on attachment 450585 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=450585&action=review

>> Source/WebKit/WebProcess/WebPage/WebPage.cpp:2853
>> +void WebPage::markLayersVolatileOrRetry(MarkLayersVolatileStopReason stopReason, Seconds timerInterval)
> 
> Why the second parameter? Can we just use initialLayerVolatilityTimerInterval inside the function like we used to?

Because it's called from the timer callback with a new interval (2x the last one).

>> Source/WebKit/WebProcess/WebPage/WebPage.cpp:2876
>> +    WEBPAGE_RELEASE_LOG_ERROR(Layers, "markLayersVolatile: Failed to mark all layers as volatile, will retry in %g ms", timerInterval.milliseconds());
> 
> This was downgraded from error logging to regular logging a while back because this happens a lot and I am tired of getting radars about it.

Will fix.

>> Source/WebKit/WebProcess/WebPage/WebPage.h:1592
>> +    enum class MarkLayersVolatileStopReason {
> 
> nit: Could be on one line.
> Also: We should use uint8_t as underlying type.
> 
> Also, I find the name of this enum super confusing given that the function does something no matter what the stop reason is. I would prefer something like:
> enum class ShouldRetryMarkingAsVolatile { NoDueToSuspensionUnderLock, NoDueToTimeout, Yes };

Can do.
Comment 5 Chris Dumez 2022-02-01 16:41:37 PST
Comment on attachment 450585 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=450585&action=review

>>> Source/WebKit/WebProcess/WebPage/WebPage.cpp:2853
>>> +void WebPage::markLayersVolatileOrRetry(MarkLayersVolatileStopReason stopReason, Seconds timerInterval)
>> 
>> Why the second parameter? Can we just use initialLayerVolatilityTimerInterval inside the function like we used to?
> 
> Because it's called from the timer callback with a new interval (2x the last one).

Oh, I see it now (newInterval). Sorry.
Comment 6 Simon Fraser (smfr) 2022-02-01 16:43:50 PST
The timers should probably be startOneShot(), since they only fire once before reschedule.
Comment 7 Chris Dumez 2022-02-01 16:44:44 PST
(In reply to Simon Fraser (smfr) from comment #6)
> The timers should probably be startOneShot(), since they only fire once
> before reschedule.

Yes, the startRepeating() is confusing here too.
Comment 8 Simon Fraser (smfr) 2022-02-01 21:01:05 PST
https://trac.webkit.org/changeset/288940/webkit
Comment 9 Radar WebKit Bug Importer 2022-02-01 21:02:17 PST
<rdar://problem/88362884>