[Webkit-unassigned] [Bug 159346] [GLib] Use a GSource instead of a thread to poll memory pressure eventFD in linux implementation

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 1 06:11:23 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=159346

--- Comment #4 from Carlos Garcia Campos <cgarcia at igalia.com> ---
(In reply to comment #3)
> Comment on attachment 282540 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=282540&action=review
> 
> 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?

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160701/706f5b28/attachment.html>


More information about the webkit-unassigned mailing list