RESOLVED FIXED 174166
FileMonitor should not be ref counted
https://bugs.webkit.org/show_bug.cgi?id=174166
Summary FileMonitor should not be ref counted
Brent Fulgham
Reported 2017-07-05 11:30:14 PDT
The current API for FileMonitor is fragile, because it requires the user to manually stop the monitor to make sure it is properly cleaned up. This was done to make sure the event handler would never be left with a dangling this pointer. Instead, we should vend a WeakPtr to the closure, and check it when processing events to see if the FileMonitor was destroyed. If it was, we don't need to take any action. This will allow the object to properly terminate monitoring when the object goes out of scope.
Attachments
Patch (16.24 KB, patch)
2017-07-06 13:03 PDT, Chris Dumez
no flags
Patch (16.27 KB, patch)
2017-07-06 13:07 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2017-07-06 13:03:39 PDT
Chris Dumez
Comment 2 2017-07-06 13:07:35 PDT
Brent Fulgham
Comment 3 2017-07-06 14:42:42 PDT
Comment on attachment 314746 [details] Patch Looks good! Nice cleanup.
Brent Fulgham
Comment 4 2017-07-06 14:43:15 PDT
Comment on attachment 314746 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=314746&action=review > Source/WebCore/platform/FileMonitor.cpp:-46 > -} Much simpler!
Chris Dumez
Comment 5 2017-07-06 14:45:08 PDT
Comment on attachment 314746 [details] Patch Clearing flags on attachment: 314746 Committed r219219: <http://trac.webkit.org/changeset/219219>
Chris Dumez
Comment 6 2017-07-06 14:45:10 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.