• Sadrul Habib Chowdhury's avatar
    Reland "metrics: Initialize persistent metric allocator early." · bd6bbb6e
    Sadrul Habib Chowdhury authored
    The fix from the original change is to share the shared-memory handle
    with the child process only if a child process is actually launched.
    There can be configurations where a child-process is not launched (e.g.
    for in-process gpu etc.), and in such cases, it is not necessary to
    create a separate PersistentMemoryAllocator, since there already is an
    existing one for the browser process.
    
    Original change's description:
    metrics: Initialize persistent metric allocator early.
    
    The PersistentMemoryAllocator in the gpu (and other) process is created
    asynchronously. If any uma-histogram is reported before that time, then
    those Histograms are not stored in the shared memory. This has some
    implications:
     . If the process crashes (which is common for the gpu process on
       android), then these metrics are lost.
     . If the process stays alive, then the metrics are reported
       periodically, but because it is buffered, it doesn't match up
       correctly with the other metrics that are reported in the shared
       memory.
    
    The allocator is created in response to a message from the browser,
    which includes the handle for the shared memory to use for the allocator.
    The browser waits until the process has been launched and connected.
    So this happens much later, compared to other messages which are sent
    from browser over mojo without waiting for the connection to have
    been established first. Therefore, change this so that the browser
    immediately shares the shared-memory segment with the gpu process. mojo
    takes care of waiting for the process-launch etc.
    
    BUG=865179, 778749, 875640
    
    Change-Id: Ieffc014ae711d4bc922cda8034bc4a05fd861bde
    Reviewed-on: https://chromium-review.googlesource.com/1182041Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
    Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
    Commit-Queue: Sadrul Chowdhury <sadrul@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#584642}
    bd6bbb6e
browser_child_process_host_impl.cc 23.2 KB