• kylechar's avatar
    exo: Make Texture::Buffer a ContextLostObserver. · 46d2e915
    kylechar authored
    Texture::Buffer is using the deprecated ContextFactoryObserver interface
    to find out about main thread context loss. The ContextFactory adds
    itself as a ContextLostObserver, then on context loss forwards that
    message along to all the ContextFactoryObservers.
    
    There are multiple message pipes between the browser and GPU process
    that have indeterminate ordering for when they find out about connection
    errors. This leads to the following ordering problem:
    
    1. The GPU process crashes. The old shared main thread
       RasterContextProvider is lost and any message pipes between the
       browser and GPU process will encounter connection errors.
    2. A new shared main thread RasterContextProvider is created.
    3. Exo allocates a new Buffer::Texture using the new shared main thread
       RasterContextProvider.
    4. The new Buffer::Texture adds itself as a ContextFactoryObserver.
    5. All ContextFactoryObservers get notified about OnLostSharedContext()
       for the old shared main thread RasterContextProvider loss. For the
       new Buffer::Texture this is wrong, the RasterContextProvider is still
       valid.
    6. The new Buffer::Texture destroys all of it's resources incorrectly.
       This triggers a flood of GL errors from the GPU process.
    
    Make Buffer::Texture a ContextLossObserver instead. This way the
    Buffer::Texture gets notified about context loss for only the
    RasterContextProvider it's using.
    
    Bug: 954151, 944597
    Test: BufferTest.OnLostResources
    Change-Id: Ic68dbaab8864b835b2bbb83b3b43f03495902aef
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1597390
    Commit-Queue: kylechar <kylechar@chromium.org>
    Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#657432}
    46d2e915
in_process_context_provider.cc 6.87 KB