[webkit-reviews] review granted: [Bug 209676] [Cocoa] Sleep disabling should be performed in the UI process : [Attachment 394824] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Mar 28 16:49:09 PDT 2020


Darin Adler <darin at apple.com> has granted Per Arne Vollan <pvollan at apple.com>'s
request for review:
Bug 209676: [Cocoa] Sleep disabling should be performed in the UI process
https://bugs.webkit.org/show_bug.cgi?id=209676

Attachment 394824: Patch

https://bugs.webkit.org/attachment.cgi?id=394824&action=review




--- Comment #11 from Darin Adler <darin at apple.com> ---
Comment on attachment 394824
  --> https://bugs.webkit.org/attachment.cgi?id=394824
Patch

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

Looks good

> Source/WebCore/platform/SleepDisablerClient.h:32
> +#include "SleepDisablerIdentifier.h"
> +
> +#include <pal/system/SleepDisabler.h>
> +#include <wtf/ObjectIdentifier.h>
> +#include <wtf/text/WTFString.h>

Seems like this is too many includes. <wtf/Forward.h> should be all we need for
a const String& argument. I don’t see any reason we’d need the
ObjectIdentifer.h or SleepDisabler.h include. Might need to include <memory> so
we can use std::unique_ptr.

Also, headers should have one paragraph of includes, not two.

> Source/WebCore/testing/Internals.cpp:5570
> +    static unsigned identifier = 0;

This is a pretty good name. I also like the name "lastUsedIdentifier" for
globals like this one.

> Source/WebKit/UIProcess/WebProcessProxy.cpp:1797
> +    return m_sleepDisablers.size() > 0;

This should use !isEmpty() instead of size() > 0.

> Source/WebKit/UIProcess/WebProcessProxy.h:382
> +    bool hasSleepDisabler();

This should be const.

> Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm:225
> +    return _page ? _page->process().hasSleepDisabler() : false;

This can use &&, which I think is clearer than ? : false.

> Source/WebKit/WebProcess/GPU/media/RemoteLegacyCDM.cpp:33
> +#include "GPUProcessConnection.h"
> +
>  #include "RemoteLegacyCDMFactory.h"

New include should not be in a separate paragraph.


More information about the webkit-reviews mailing list