• Etienne Bergeron's avatar
    Fix HandleVerifier trace events for static builds · 8b856148
    Etienne Bergeron authored
    This CL is fixing the trace events of the HandleVerifier for a
    non components build.
    
    For a static build, there are two instances of the HandleVerifier
      1) chrome.exe!HandleVerifier
      2) chrome.dll!HandleVerifier
    
    At chrome startup, chrome.exe!InstallVerifier set a global singleton
    which start tracking ScopedHandle objects.
    
    After the initialisation, chrome.dll is loaded. The call of
    chrome.dll::InstallVerifier() is fetching the singleton from 1) and is
    storing it as a global singleton into chrome.dll. Calls to the
    chrome.dll!VerifierTraits::StartTracking() and
    chrome.dll!VerifierTraits::StopTracking are forwarded to the
    chrome.exe!HandleVerifier instance.
    
    Since TraceLog is also part of base, there is also two instances
    in each module. There are two instances of categories array that specify
    which categories are enabled but only one is used by chrome tracing.
    
    A trace event executed in chrome.exe will never be enabled. This is
    explaining why trace events from chrome.exe!HandleVerifier are not
    emitted unless the build is a component build.
    
    To solve this issue, this CL is lifting the trace events before
    entering the code that forward the call to chrome.exe. This way trace
    events are using the right instance of TraceLog (e.g. chrome.dll).
    
    Bug: 1110507
    Change-Id: I61ee1e18b849d32f90d2430759da6d1c8666c854
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2324873
    Commit-Queue: Gabriel Charette <gab@chromium.org>
    Reviewed-by: default avatarWill Harris <wfh@chromium.org>
    Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#792764}
    8b856148
scoped_handle.cc 1.56 KB