CheckResetStatus need to three different things and in specific order if
it detects problem:
1. Set `device_needs_reset_` to true. This needs to happen first as it's
used in MarkContextLost.
2. Call MarkContextLost
3. Return true. This must happen only if context was lost.
Before this CL there was couple of problems:
* default case in switch would return true, but never lose context.
* OutOfMemory case would lost context before setting device_needs_reset_
This CL extracts logic for checking errors from CheckResetStatus into
GetResetStatus to make sure we do all the actions above in one place and
make code less error prone.
Bug: 1126490
Change-Id: I1a86ad2cc783ee2fd2dcf828612f2b657aba23ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2401400
Reviewed-by: Jonathan Backer <backer@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805765}