<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [GLib] Use a GSource instead of a thread to poll memory pressure eventFD in linux implementation"
href="https://bugs.webkit.org/show_bug.cgi?id=159346#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [GLib] Use a GSource instead of a thread to poll memory pressure eventFD in linux implementation"
href="https://bugs.webkit.org/show_bug.cgi?id=159346">bug 159346</a>
from <span class="vcard"><a class="email" href="mailto:cgarcia@igalia.com" title="Carlos Garcia Campos <cgarcia@igalia.com>"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=159346#c3">comment #3</a>)
<span class="quote">> Comment on <span class=""><a href="attachment.cgi?id=282540&action=diff" name="attach_282540" title="Patch">attachment 282540</a> <a href="attachment.cgi?id=282540&action=edit" title="Patch">[details]</a></span>
> Patch
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=282540&action=review">https://bugs.webkit.org/attachment.cgi?id=282540&action=review</a>
>
> Looking good. One overall suggestion to use Optional rather than -1/0.
>
> > Source/WebCore/platform/MemoryPressureHandler.h:176
> > + int m_eventFD { -1 };
> > + int m_pressureLevelFD { -1 };
>
> since we are touch these now, can we make it Optional<int> instead of using
> magic -1 or 0?
>
> It would allow us to if-check
>
> if (m_eventFD)
>
> instead of
>
> if (m_eventFD != -1)
>
> Also we could reset with
>
> m_eventFD = Nullopt;
>
> And access its value with either *m_eventFD or m_eventFD.value().
>
> WDYT?</span >
The thing is that open() returns -1 in case of failure, but we can probably handle that particular case separately and set it to Nullopt.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>