Bug 182066 - Add logging to facilitate binding of WebContent and Network processes to UI process
Summary: Add logging to facilitate binding of WebContent and Network processes to UI p...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Keith Rollin
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-01-24 14:50 PST by Keith Rollin
Modified: 2018-01-25 13:31 PST (History)
4 users (show)

See Also:


Attachments
Patch (3.37 KB, patch)
2018-01-24 16:07 PST, Keith Rollin
no flags Details | Formatted Diff | Diff
Patch (3.32 KB, patch)
2018-01-25 13:04 PST, Keith Rollin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Rollin 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).
Comment 1 Keith Rollin 2018-01-24 16:07:49 PST
Created attachment 332210 [details]
Patch
Comment 2 Michael Catanzaro 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.
Comment 3 Brent Fulgham 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.
Comment 4 Keith Rollin 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.
Comment 5 Keith Rollin 2018-01-25 13:04:21 PST
Created attachment 332303 [details]
Patch
Comment 6 WebKit Commit Bot 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>
Comment 7 WebKit Commit Bot 2018-01-25 13:30:30 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2018-01-25 13:31:26 PST
<rdar://problem/36881094>