Bug 182066

Summary: Add logging to facilitate binding of WebContent and Network processes to UI process
Product: WebKit Reporter: Keith Rollin <krollin>
Component: WebKit Misc.Assignee: Keith Rollin <krollin>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, commit-queue, mcatanzaro, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Keith Rollin
Reported 2018-01-24 14:50:10 PST
When examining sysdiagnose logs and tracing events from one process to another, it would be helpful to know which WebKit processes were related to each other. When Safari, Mail, Messages, etc. are all running at the same time, it may otherwise be difficult to know if a particular Network process, for example was associated with Safari or some other application. Add some logging to the creation of WebContent and Network processes to identify their "presenting process" (parent application).
Attachments
Patch (3.37 KB, patch)
2018-01-24 16:07 PST, Keith Rollin
no flags
Patch (3.32 KB, patch)
2018-01-25 13:04 PST, Keith Rollin
no flags
Keith Rollin
Comment 1 2018-01-24 16:07:49 PST
Michael Catanzaro
Comment 2 2018-01-24 17:54:36 PST
Comment on attachment 332210 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332210&action=review > Source/WebKit/NetworkProcess/NetworkProcess.cpp:263 > + RELEASE_LOG(Process, "%p - NetworkProcess::initializeNetworkProcess: Presenting process = %lu", this, static_cast<unsigned long>(WebCore::presentingApplicationPID())); Seems like a good idea, but why are you casting from int to unsigned long and using %lu, instead of just using %d? I know it's weird that WebCore::presentingApplicationPID uses int rather than pid_t or unsigned int... but that really is its type.
Brent Fulgham
Comment 3 2018-01-24 19:05:28 PST
Comment on attachment 332210 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332210&action=review r=me if you remove the cast and just use %d. >> Source/WebKit/NetworkProcess/NetworkProcess.cpp:263 >> + RELEASE_LOG(Process, "%p - NetworkProcess::initializeNetworkProcess: Presenting process = %lu", this, static_cast<unsigned long>(WebCore::presentingApplicationPID())); > > Seems like a good idea, but why are you casting from int to unsigned long and using %lu, instead of just using %d? I know it's weird that WebCore::presentingApplicationPID uses int rather than pid_t or unsigned int... but that really is its type. That is weird! Especially considering that it is a pid_t in many places. Maybe Andy can tell us why it's just an int in this method. But for this logging purpose, int seems reasonable.
Keith Rollin
Comment 4 2018-01-24 23:36:12 PST
(In reply to Brent Fulgham from comment #3) > > Seems like a good idea, but why are you casting from int to unsigned long and using %lu, instead of just using %d? I know it's weird that WebCore::presentingApplicationPID uses int rather than pid_t or unsigned int... but that really is its type. > > That is weird! Especially considering that it is a pid_t in many places. > Maybe Andy can tell us why it's just an int in this method. But for this > logging purpose, int seems reasonable. I was looking into how to get a PID in WebKit. I had drilled down into RuntimeApplicationChecks.cpp/.h, which called into ProcessID.h. The base type in ProcessID.h is ProcessID, which is an int on Windows but a pid_t elsewhere. I didn't know what type a pid_t was, so I decided to promote it to something that should hold just about any value. I neglected to notice that presentingApplicationPID in RuntimeApplicationChecks silently converts the ProcessID to an int. So making use of that information to remove my cast makes sense.
Keith Rollin
Comment 5 2018-01-25 13:04:21 PST
WebKit Commit Bot
Comment 6 2018-01-25 13:30:28 PST
Comment on attachment 332303 [details] Patch Clearing flags on attachment: 332303 Committed r227627: <https://trac.webkit.org/changeset/227627>
WebKit Commit Bot
Comment 7 2018-01-25 13:30:30 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 8 2018-01-25 13:31:26 PST
Note You need to log in before you can comment on or make changes to this bug.