• Sunny Sachanandani's avatar
    gpu: Check errors when restoring context in ScopedMakeCurrent. · fc297be6
    Sunny Sachanandani authored
    ScopedMakeCurrent and ScopedReleaseCurrent don't check for errors when
    restoring the previous context. In most cases the MakeCurrent that
    restores the previous context should not fail, and if it fails we don't
    return errors up the stack so we CHECK that MakeCurrent succeeds.
    
    However, for DirectComposition, we use ScopedReleaseCurrent when
    reallocating the drawing surface. Restoring the context can fail in this
    case. This CL adds a Restore method to both classes whose return value
    must be handled. This prevents the CHECK in the destructor.
    
    The lack of error checking is causing a crash in SetSwapInterval, due to
    null-dereference of GLContext::GetCurrent. This was found by adding a
    crash key to get the stack trace for SetCurrent(NULL).
    
    BUG=724999
    R=piman
    
    Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
    Change-Id: I370ff470c78afa76bd000de60a6a63295746ee1b
    Reviewed-on: https://chromium-review.googlesource.com/818533Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
    Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#523562}
    fc297be6
scoped_make_current.h 1.8 KB