Bug 150770 - [GTK] Use RunLoop in WorkQueue implementation
Summary: [GTK] Use RunLoop in WorkQueue implementation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks: 150771
  Show dependency treegraph
 
Reported: 2015-11-01 02:04 PST by Carlos Garcia Campos
Modified: 2015-11-02 00:42 PST (History)
4 users (show)

See Also:


Attachments
Patch (9.26 KB, patch)
2015-11-01 02:12 PST, Carlos Garcia Campos
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2015-11-01 02:04:13 PST
Instead of using GMainLoop directly. RunLoop already abstracts the GMainLoop details and uses persistent sources making it more efficient.
Comment 1 Carlos Garcia Campos 2015-11-01 02:12:01 PST
Created attachment 264509 [details]
Patch
Comment 2 WebKit Commit Bot 2015-11-01 02:15:00 PST
Attachment 264509 [details] did not pass style-queue:


ERROR: Source/WTF/wtf/glib/WorkQueueGLib.cpp:89:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WTF/wtf/glib/WorkQueueGLib.cpp:95:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WTF/wtf/glib/WorkQueueGLib.cpp:112:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 3 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Darin Adler 2015-11-01 12:50:14 PST
Comment on attachment 264509 [details]
Patch

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

> Source/WTF/wtf/WorkQueue.h:43
> +#include <wtf/RunLoop.h>

Do we actually need this header to be included? Can we just forward-declare RunLoop? This header doesn’t actually depend on the content of RunLoop, just that it’s a pointer to some class.

> Source/WTF/wtf/WorkQueue.h:113
> +    RunLoop* m_runLoop;

Would be nice if we could find a way to make this a reference rather than a pointer.
Comment 4 Carlos Garcia Campos 2015-11-02 00:13:23 PST
(In reply to comment #3)
> Comment on attachment 264509 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=264509&action=review
> 
> > Source/WTF/wtf/WorkQueue.h:43
> > +#include <wtf/RunLoop.h>
> 
> Do we actually need this header to be included? Can we just forward-declare
> RunLoop? This header doesn’t actually depend on the content of RunLoop, just
> that it’s a pointer to some class.

Not only the pointer, we also have:

RunLoop& runLoop() const { return *m_runLoop; }

> > Source/WTF/wtf/WorkQueue.h:113
> > +    RunLoop* m_runLoop;
> 
> Would be nice if we could find a way to make this a reference rather than a
> pointer.

If we make it a reference we would need to initialize it on construction, but the RunLoop has to be created by the worker thread. We could use Optional, but I'm not sure it would make the code better in this particular case.
Comment 5 Carlos Garcia Campos 2015-11-02 00:42:02 PST
Committed r191878: <http://trac.webkit.org/changeset/191878>