Bug 106144

Summary: Consolidate process initialization in ChildProcess
Product: WebKit Reporter: Sam Weinig <sam>
Component: New BugsAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal CC: abecsi, cmarcelo, gyuyoung.kim, menard, rakuco, rniwa, webkit-ews, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch ap: review+, webkit-ews: commit-queue-

Sam Weinig
Reported 2013-01-04 16:18:31 PST
Consolidate process initialization in ChildProcess
Attachments
Patch (49.55 KB, patch)
2013-01-04 16:29 PST, Sam Weinig
no flags
Patch (49.65 KB, patch)
2013-01-04 16:41 PST, Sam Weinig
no flags
Patch (49.69 KB, patch)
2013-01-04 16:42 PST, Sam Weinig
ap: review+
webkit-ews: commit-queue-
Sam Weinig
Comment 1 2013-01-04 16:29:57 PST
Early Warning System Bot
Comment 2 2013-01-04 16:35:20 PST
EFL EWS Bot
Comment 3 2013-01-04 16:38:20 PST
Sam Weinig
Comment 4 2013-01-04 16:41:06 PST
Sam Weinig
Comment 5 2013-01-04 16:42:37 PST
Early Warning System Bot
Comment 6 2013-01-04 17:01:30 PST
EFL EWS Bot
Comment 7 2013-01-04 17:01:52 PST
Alexey Proskuryakov
Comment 8 2013-01-04 17:06:13 PST
Comment on attachment 181408 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=181408&action=review > Source/WebKit2/NetworkProcess/NetworkProcess.cpp:91 > - if (m_messageReceiverMap.dispatchMessage(connection, messageID, decoder)) > + if (messageReceiverMap().dispatchMessage(connection, messageID, decoder)) It's sad that we have to do this. Direct access to member variables is more transparent. > Source/WebKit2/NetworkProcess/NetworkProcess.cpp:125 > - return m_uiConnection.get(); > + return connection(); Can the name be more descriptive? Perhaps parentProcessConnection? > Source/WebKit2/NetworkProcess/NetworkProcess.cpp:169 > + send(Messages::NetworkProcessProxy::DidCreateNetworkConnectionToWebProcess(clientPort)); I'd say that brevity is not helpful here. NetworkProcess mostly talks to WebProcess, so having a nondescript send() function that talks to an unusual receiver is confusing. > Source/WebKit2/PluginProcess/PluginProcess.cpp:169 > - m_connection->send(Messages::PluginProcessProxy::DidCreateWebProcessConnection(clientPort, m_supportsAsynchronousPluginInitialization), 0); > + send(Messages::PluginProcessProxy::DidCreateWebProcessConnection(clientPort, m_supportsAsynchronousPluginInitialization)); Here as well, send() is confusing. > Source/WebKit2/PluginProcess/PluginProcess.h:45 > -class PluginProcess : ChildProcess { > +class PluginProcess : public ChildProcess { I didn't notice why this is needed. ChildProcess is an implementation detail of the processes, and hopefully doesn't need to be exposed as a base class. > Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp:105 > - WebKit::PluginProcess::shared().initializeConnection(identifier); > + > + WebKit::ChildProcessInitializationParameters parameters; I don't understand these namespace prefixes. > Source/WebKit2/PluginProcess/unix/PluginProcessMainUnix.cpp:110 > - WebKit::PluginProcess::shared().initializeConnection(socket); > + > + WebKit::ChildProcessInitializationParameters parameters; I don't understand these namespace prefixes. > Source/WebKit2/Shared/ChildProcess.cpp:43 > // FIXME: The termination timer should not be scheduled on the main run loop. > // It won't work with the threaded mode, but it's not really useful anyway as is. Do we still need this FIXME? > Source/WebKit2/Shared/ChildProcess.cpp:53 > + // We use _exit here since the watchdog callback is called from another thread and we don't want > + // global destructors or atexit handlers to be called from this thread while the main thread is busy This is a surprising explanation. Do we have global destructors? > Source/WebKit2/Shared/ChildProcess.cpp:62 > + static const double watchdogDelay = 10.0; Coding style: no ".0". Also, "static" is not useful for C++ constants, especially function local ones. > Source/WebKit2/Shared/ChildProcess.h:83 > + uint64_t destinationID() const { return 0; } How is this used? A dummy non-virtual function is surprising, unless a template makes use of it. > Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.h:44 > -class SharedWorkerProcess : ChildProcess { > +class SharedWorkerProcess : public ChildProcess { public :(
Sam Weinig
Comment 9 2013-01-04 17:12:59 PST
(In reply to comment #8) > (From update of attachment 181408 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=181408&action=review > > > Source/WebKit2/NetworkProcess/NetworkProcess.cpp:91 > > - if (m_messageReceiverMap.dispatchMessage(connection, messageID, decoder)) > > + if (messageReceiverMap().dispatchMessage(connection, messageID, decoder)) > > It's sad that we have to do this. Direct access to member variables is more transparent. Indeed, but this will be removed relatively soon. > > > Source/WebKit2/NetworkProcess/NetworkProcess.cpp:125 > > - return m_uiConnection.get(); > > + return connection(); > > Can the name be more descriptive? Perhaps parentProcessConnection? It could be, but we would also need a function called connection() for the MessageSender template, I'll add it. > > > Source/WebKit2/NetworkProcess/NetworkProcess.cpp:169 > > + send(Messages::NetworkProcessProxy::DidCreateNetworkConnectionToWebProcess(clientPort)); > > I'd say that brevity is not helpful here. NetworkProcess mostly talks to WebProcess, so having a nondescript send() function that talks to an unusual receiver is confusing. Ok, I'll use the new parentProcessConnection() method to make it clearer. > > > Source/WebKit2/PluginProcess/PluginProcess.cpp:169 > > - m_connection->send(Messages::PluginProcessProxy::DidCreateWebProcessConnection(clientPort, m_supportsAsynchronousPluginInitialization), 0); > > + send(Messages::PluginProcessProxy::DidCreateWebProcessConnection(clientPort, m_supportsAsynchronousPluginInitialization)); > > Here as well, send() is confusing. Ok. > > > Source/WebKit2/PluginProcess/PluginProcess.h:45 > > -class PluginProcess : ChildProcess { > > +class PluginProcess : public ChildProcess { > > I didn't notice why this is needed. > > ChildProcess is an implementation detail of the processes, and hopefully doesn't need to be exposed as a base class. It has the initialization() function on it that is called. I'll figure out a way to keep it private. > > > Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp:105 > > - WebKit::PluginProcess::shared().initializeConnection(identifier); > > + > > + WebKit::ChildProcessInitializationParameters parameters; > > I don't understand these namespace prefixes. This is Qt code that isn't inside the WebKit namespace for some reason, I think (will check). > > > Source/WebKit2/PluginProcess/unix/PluginProcessMainUnix.cpp:110 > > - WebKit::PluginProcess::shared().initializeConnection(socket); > > + > > + WebKit::ChildProcessInitializationParameters parameters; > > I don't understand these namespace prefixes. Same. > > > Source/WebKit2/Shared/ChildProcess.cpp:43 > > // FIXME: The termination timer should not be scheduled on the main run loop. > > // It won't work with the threaded mode, but it's not really useful anyway as is. > > Do we still need this FIXME? Probably not, will remove. > > > Source/WebKit2/Shared/ChildProcess.cpp:53 > > + // We use _exit here since the watchdog callback is called from another thread and we don't want > > + // global destructors or atexit handlers to be called from this thread while the main thread is busy > > This is a surprising explanation. Do we have global destructors? I think frameworks we link against might, but I am just guessing, this code that is just being moved. > > > Source/WebKit2/Shared/ChildProcess.cpp:62 > > + static const double watchdogDelay = 10.0; > > Coding style: no ".0". Also, "static" is not useful for C++ constants, especially function local ones. Will fix. > > > Source/WebKit2/Shared/ChildProcess.h:83 > > + uint64_t destinationID() const { return 0; } > > How is this used? A dummy non-virtual function is surprising, unless a template makes use of it. Yeah. its for MessageSender, which I am not a huge fan of, but is currently being used. > > > Source/WebKit2/SharedWorkerProcess/SharedWorkerProcess.h:44 > > -class SharedWorkerProcess : ChildProcess { > > +class SharedWorkerProcess : public ChildProcess { > > public :( :(
Sam Weinig
Comment 10 2013-01-04 17:17:44 PST
Actually, this patch is big enough as is. Since I got the r+, I'll do the big clean up in a follow up.
Sam Weinig
Comment 11 2013-01-04 17:20:43 PST
Sam Weinig
Comment 15 2013-01-04 19:53:43 PST
Note You need to log in before you can comment on or make changes to this bug.