Bug 123260 - Replace 0 timeouts g_timeout_add() by g_idle_add()
Summary: Replace 0 timeouts g_timeout_add() by g_idle_add()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-24 03:19 PDT by Bastien Nocera
Modified: 2013-10-28 08:42 PDT (History)
13 users (show)

See Also:


Attachments
Replace 0 timeouts g_timeout_add() by g_idle_add() (9.82 KB, patch)
2013-10-24 03:20 PDT, Bastien Nocera
no flags Details | Formatted Diff | Diff
Replace 0 timeouts g_timeout_add() by g_idle_add() (9.78 KB, patch)
2013-10-24 03:27 PDT, Bastien Nocera
andersca: review-
Details | Formatted Diff | Diff
Patch (13.88 KB, patch)
2013-10-25 00:08 PDT, Philippe Normand
cgarcia: review-
cgarcia: commit-queue-
Details | Formatted Diff | Diff
patch for laundring (13.66 KB, patch)
2013-10-25 01:17 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
patch (12.97 KB, patch)
2013-10-28 01:16 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bastien Nocera 2013-10-24 03:19:57 PDT
.
Comment 1 Bastien Nocera 2013-10-24 03:20:25 PDT
Created attachment 215044 [details]
Replace 0 timeouts g_timeout_add() by g_idle_add()

A zero timeout should be equivalent to using
g_idle_add_full(G_PRIORITY_DEFAULT, ...
without the nagging feeling that the wrong API was used.
Comment 2 WebKit Commit Bot 2013-10-24 03:22:58 PDT
Attachment 215044 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/wtf/gtk/MainThreadGtk.cpp', u'Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp', u'Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp', u'Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp', u'Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp', u'Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp', u'Source/WebKit/gtk/webkit/webkitwebview.cpp', u'Tools/DumpRenderTree/gtk/DumpRenderTree.cpp', u'Tools/DumpRenderTree/gtk/EventSender.cpp']" exit_code: 1
Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp:94:  Use 0 instead of NULL.  [readability/null] [5]
Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp:94:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 2 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Bastien Nocera 2013-10-24 03:27:11 PDT
Created attachment 215047 [details]
Replace 0 timeouts g_timeout_add() by g_idle_add()

A zero timeout should be equivalent to using
g_idle_add_full(G_PRIORITY_DEFAULT, ...
without the nagging feeling that the wrong API was used.
Comment 4 Bastien Nocera 2013-10-24 03:29:15 PDT
Comment on attachment 215047 [details]
Replace 0 timeouts g_timeout_add() by g_idle_add()

The "weird number of spaces" review comment is due to me realigning the second line of a function (eg. trying to follow the existing style).
Comment 5 WebKit Commit Bot 2013-10-24 03:30:49 PDT
Attachment 215047 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/wtf/gtk/MainThreadGtk.cpp', u'Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp', u'Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp', u'Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp', u'Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp', u'Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp', u'Source/WebKit/gtk/webkit/webkitwebview.cpp', u'Tools/DumpRenderTree/gtk/DumpRenderTree.cpp', u'Tools/DumpRenderTree/gtk/EventSender.cpp']" exit_code: 1
Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp:94:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 1 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Anders Carlsson 2013-10-24 06:28:37 PDT
Comment on attachment 215047 [details]
Replace 0 timeouts g_timeout_add() by g_idle_add()

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

Patch looks good but needs a ChangeLog with the rationale.

>> Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp:94
>> +                                                   const_cast<void*>(static_cast<const void*>(this)), 0);
> 
> Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]

I know you're just matching what was here before, but the entire function call should be on a single line.
Comment 7 Philippe Normand 2013-10-25 00:01:13 PDT
I'll update the patch.
Comment 8 Philippe Normand 2013-10-25 00:08:36 PDT
Created attachment 215146 [details]
Patch
Comment 9 Carlos Garcia Campos 2013-10-25 00:42:03 PDT
Comment on attachment 215146 [details]
Patch

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

> Source/WebCore/ChangeLog:11
> +        Patch by Bastien Nocera <hadess@hadess.net>

Why not adding the author to the changelog header so that commit-queue will credit him correctly?

> Source/WebKit/gtk/webkit/webkitwebview.cpp:5276
> -        g_timeout_add(1, cleanupTemporarilyCachedSubresources, g_list_copy(subResources));
> +        g_idle_add_full(G_PRIORITY_DEFAULT, cleanupTemporarilyCachedSubresources, g_list_copy(subResources), 0);

This is not correct, I don't know why but this was not a 0 timeout.
Comment 10 Philippe Normand 2013-10-25 00:52:49 PDT
(In reply to comment #9)
> (From update of attachment 215146 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=215146&action=review
> 
> > Source/WebCore/ChangeLog:11
> > +        Patch by Bastien Nocera <hadess@hadess.net>
> 
> Why not adding the author to the changelog header so that commit-queue will credit him correctly?
> 
> > Source/WebKit/gtk/webkit/webkitwebview.cpp:5276
> > -        g_timeout_add(1, cleanupTemporarilyCachedSubresources, g_list_copy(subResources));
> > +        g_idle_add_full(G_PRIORITY_DEFAULT, cleanupTemporarilyCachedSubresources, g_list_copy(subResources), 0);
> 
> This is not correct, I don't know why but this was not a 0 timeout.

I think this should be fixed in another patch.
Comment 11 Philippe Normand 2013-10-25 00:56:34 PDT
(In reply to comment #9)
> (From update of attachment 215146 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=215146&action=review
> 
> > Source/WebCore/ChangeLog:11
> > +        Patch by Bastien Nocera <hadess@hadess.net>
> 
> Why not adding the author to the changelog header so that commit-queue will credit him correctly?
> 

AFAIK the commit-queue does that only for commiters.
Using Patch by is quite common and gives him credit already :)
Comment 12 Carlos Garcia Campos 2013-10-25 01:05:14 PDT
(In reply to comment #10)
> (In reply to comment #9)
> > (From update of attachment 215146 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=215146&action=review
> > 
> > > Source/WebCore/ChangeLog:11
> > > +        Patch by Bastien Nocera <hadess@hadess.net>
> > 
> > Why not adding the author to the changelog header so that commit-queue will credit him correctly?
> > 
> > > Source/WebKit/gtk/webkit/webkitwebview.cpp:5276
> > > -        g_timeout_add(1, cleanupTemporarilyCachedSubresources, g_list_copy(subResources));
> > > +        g_idle_add_full(G_PRIORITY_DEFAULT, cleanupTemporarilyCachedSubresources, g_list_copy(subResources), 0);
> > 
> > This is not correct, I don't know why but this was not a 0 timeout.
> 
> I think this should be fixed in another patch.

Well, I'm not sure it's wrong, it seems it was added intentionally, I still don't understand it, though see:

https://bugs.webkit.org/show_bug.cgi?id=108960#c24
Comment 13 Carlos Garcia Campos 2013-10-25 01:06:09 PDT
(In reply to comment #11)
> (In reply to comment #9)
> > (From update of attachment 215146 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=215146&action=review
> > 
> > > Source/WebCore/ChangeLog:11
> > > +        Patch by Bastien Nocera <hadess@hadess.net>
> > 
> > Why not adding the author to the changelog header so that commit-queue will credit him correctly?
> > 
> 
> AFAIK the commit-queue does that only for commiters.

I don't think so.

> Using Patch by is quite common and gives him credit already :)

Looks weird to me, but I'm fine.
Comment 14 Philippe Normand 2013-10-25 01:17:22 PDT
Created attachment 215148 [details]
patch for laundring
Comment 15 Gustavo Noronha (kov) 2013-10-25 03:36:13 PDT
(In reply to comment #13)
> > AFAIK the commit-queue does that only for commiters.
> 
> I don't think so.

Philn is right, it doesn't even credit me when I use an email address that is not the svn username for the changelog. (which is why I asked to get that modified from kov@webkit.org, which I never use in changelogs, to gns@gnome.org)
Comment 16 Carlos Garcia Campos 2013-10-25 04:03:47 PDT
Comment on attachment 215148 [details]
patch for laundring

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

> Source/WebKit/gtk/webkit/webkitwebview.cpp:5276
> -        g_timeout_add(1, cleanupTemporarilyCachedSubresources, g_list_copy(subResources));
> +        g_idle_add_full(G_PRIORITY_DEFAULT, cleanupTemporarilyCachedSubresources, g_list_copy(subResources), 0);

I set r- only because of this, if it's wrong, let's fix it in a follow up patch as you suggested, otherwise don't change it because this commit is about changing 0 timeouts.
Comment 17 Philippe Normand 2013-10-28 01:16:37 PDT
Created attachment 215286 [details]
patch
Comment 18 Carlos Garcia Campos 2013-10-28 02:04:00 PDT
Comment on attachment 215286 [details]
patch

Thanks
Comment 19 WebKit Commit Bot 2013-10-28 02:27:29 PDT
Comment on attachment 215286 [details]
patch

Clearing flags on attachment: 215286

Committed r158103: <http://trac.webkit.org/changeset/158103>
Comment 20 WebKit Commit Bot 2013-10-28 02:27:32 PDT
All reviewed patches have been landed.  Closing bug.
Comment 21 Bastien Nocera 2013-10-28 05:04:00 PDT
(In reply to comment #12)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > (From update of attachment 215146 [details] [details] [details])
> > > View in context: https://bugs.webkit.org/attachment.cgi?id=215146&action=review
> > > 
> > > > Source/WebCore/ChangeLog:11
> > > > +        Patch by Bastien Nocera <hadess@hadess.net>
> > > 
> > > Why not adding the author to the changelog header so that commit-queue will credit him correctly?
> > > 
> > > > Source/WebKit/gtk/webkit/webkitwebview.cpp:5276
> > > > -        g_timeout_add(1, cleanupTemporarilyCachedSubresources, g_list_copy(subResources));
> > > > +        g_idle_add_full(G_PRIORITY_DEFAULT, cleanupTemporarilyCachedSubresources, g_list_copy(subResources), 0);
> > > 
> > > This is not correct, I don't know why but this was not a 0 timeout.
> > 
> > I think this should be fixed in another patch.
> 
> Well, I'm not sure it's wrong, it seems it was added intentionally, I still don't understand it, though see:
> 
> https://bugs.webkit.org/show_bug.cgi?id=108960#c24

Did a separate bug get filed for that one?
Comment 22 Philippe Normand 2013-10-28 08:32:41 PDT
(In reply to comment #21)
> (In reply to comment #12)
> > (In reply to comment #10)
> > > (In reply to comment #9)
> > > > (From update of attachment 215146 [details] [details] [details] [details])
> > > > View in context: https://bugs.webkit.org/attachment.cgi?id=215146&action=review
> > > > 
> > > > > Source/WebCore/ChangeLog:11
> > > > > +        Patch by Bastien Nocera <hadess@hadess.net>
> > > > 
> > > > Why not adding the author to the changelog header so that commit-queue will credit him correctly?
> > > > 
> > > > > Source/WebKit/gtk/webkit/webkitwebview.cpp:5276
> > > > > -        g_timeout_add(1, cleanupTemporarilyCachedSubresources, g_list_copy(subResources));
> > > > > +        g_idle_add_full(G_PRIORITY_DEFAULT, cleanupTemporarilyCachedSubresources, g_list_copy(subResources), 0);
> > > > 
> > > > This is not correct, I don't know why but this was not a 0 timeout.
> > > 
> > > I think this should be fixed in another patch.
> > 
> > Well, I'm not sure it's wrong, it seems it was added intentionally, I still don't understand it, though see:
> > 
> > https://bugs.webkit.org/show_bug.cgi?id=108960#c24
> 
> Did a separate bug get filed for that one?

Yes, bug 123404
Comment 23 Bastien Nocera 2013-10-28 08:42:37 PDT
Thanks.