Bug 131024

Summary: [UNIX] Reorganize and cleanup main functions of GTK and EFL ports
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bunhere, cdumez, commit-queue, gustavo, gyuyoung.kim, rakuco, sergio, svillar
Priority: P2 Keywords: Gtk
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Updated patch
none
Try to fix EFL build
gustavo: review+
Rebased patch for landing none

Description Carlos Garcia Campos 2014-04-01 02:49:03 PDT
We currently have main functions in Source/WebKit2/gtk/MainGtk.cpp and Source/WebKit2/gtk/MainEfl.cpp for the WebProcess and Source/WebKit2/unix/NetworkMainUnix.cpp and Source/WebKit2/unix/PluginMainUnix.cpp for the network and plugin processes. We should move main functions to WebProcess, NetworkProcess and PluginProcess dirs. Also, in some cases like the NetworkProcess we share the main function, but we need a lot of ifdefs for the platform specific initializations, and the common code is indeed common to all other processes. We could move the common code to Share and use it for all the child processes, with an interface to add the platform specific initializations.
Comment 1 Carlos Garcia Campos 2014-04-01 02:55:40 PDT
Created attachment 228260 [details]
Patch
Comment 2 Carlos Garcia Campos 2014-04-01 03:46:49 PDT
hmm, I think this approach doesn't work, I'm trying a new one
Comment 3 Carlos Garcia Campos 2014-04-01 04:57:06 PDT
Created attachment 228267 [details]
Updated patch

Slightly different approach to ensure that main() functions only depend on a public symbol in the libs like current code does.
Comment 4 WebKit Commit Bot 2014-04-01 04:58:06 PDT
Attachment 228267 [details] did not pass style-queue:


ERROR: Source/WebKit2/NetworkProcess/efl/NetworkProcessMainEfl.cpp:33:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/NetworkProcess/gtk/NetworkProcessMainGtk.cpp:33:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp:29:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp:30:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp:30:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp:31:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
Total errors found: 6 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Carlos Garcia Campos 2014-04-01 05:18:05 PDT
Created attachment 228269 [details]
Try to fix EFL build

Use WK_EXPORT instead of WTF_EXPORT
Comment 6 WebKit Commit Bot 2014-04-01 05:19:00 PDT
Attachment 228269 [details] did not pass style-queue:


ERROR: Source/WebKit2/NetworkProcess/efl/NetworkProcessMainEfl.cpp:33:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/NetworkProcess/gtk/NetworkProcessMainGtk.cpp:33:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp:29:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp:30:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp:30:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp:31:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
Total errors found: 6 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Gustavo Noronha (kov) 2014-05-22 10:16:05 PDT
Comment on attachment 228269 [details]
Try to fix EFL build

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

I'm unsure how much complexity and code this saves, it doesn't look like a lot, but I you're probably a better judge of that than me. One thing that bothers me is that in theory we could use these same implementations for Gtk on Windows, say, but I guess Unix is still sensible as a name since we'd be using GNU libraries even on windows, so r=me.

> Source/WebKit2/ChangeLog:8
> +        Move main function implementation files to <process-dir>/EntryPoint/unix/ProcessNameMain.cpp

add <> around ProcessName to be clearer?
Comment 8 Carlos Garcia Campos 2014-05-23 01:35:06 PDT
(In reply to comment #7)
> (From update of attachment 228269 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=228269&action=review

Thanks for the review.

> I'm unsure how much complexity and code this saves, it doesn't look like a lot, but I you're probably a better judge of that than me. One thing that bothers me is that in theory we could use these same implementations for Gtk on Windows, say, but I guess Unix is still sensible as a name since we'd be using GNU libraries even on windows, so r=me.

Well, this is more about keeping consistency than saving code. When I moved the NEWS file to Source/WebKit2/gtk I noticed there was a MainGtk.cpp file there. And I thought Main what? it ended up being the main function of the WebProcess. When we only had one process, it probably was less confusing, but still misplaced, it should be in Source/WebKit2/WebProcess/gtk at least. Then I looked at the different main functions, and noticed that in some cases we were sharing the implementation with EFL (but with a full of ifdefs) and in others every port had its own file. So, I took a look at what apple did for the entry points, and inspired by the mac implementation I reorganized the "unix" entry points.

> > Source/WebKit2/ChangeLog:8
> > +        Move main function implementation files to <process-dir>/EntryPoint/unix/ProcessNameMain.cpp
> 
> add <> around ProcessName to be clearer?

Ok
Comment 9 Carlos Garcia Campos 2014-05-23 01:36:16 PDT
Created attachment 231951 [details]
Rebased patch for landing
Comment 10 WebKit Commit Bot 2014-05-23 01:39:11 PDT
Attachment 231951 [details] did not pass style-queue:


ERROR: Source/WebKit2/NetworkProcess/efl/NetworkProcessMainEfl.cpp:33:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/NetworkProcess/gtk/NetworkProcessMainGtk.cpp:33:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp:29:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp:30:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp:30:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp:31:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
Total errors found: 6 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Carlos Garcia Campos 2014-05-23 02:58:34 PDT
Committed r169255: <http://trac.webkit.org/changeset/169255>