Fix GPU asserts to account for context loss in debug
When trying to debug some GPU process loss on aura, I ran into a couple of
asserts:
- the Finish() in FreeEverything() may not fully finish the command buffer, so
FreeRingBuffer needs to account for the error case. The argument is that in case
of error, the command buffer service will not proceed anymore so it's safe to
destroy the ring buffer.
- for the same reason, the FreeUnusedSharedMemory() in FreeEverything() didn't
free all the shared memory, and so at destruction time, it will WaitForToken to
free all the memory chunks. At that time the ring buffer has already been
destroyed. When that's the case, make WaitForToken() return immediately. The
argument is that FreeRingBuffer ensured that either a Finish was complete (i.e.
all tokens have passed), or the command buffer is in error and we would return
immediately anyway (FlushSync would return failure).
BUG=None
Review URL: https://chromiumcodereview.appspot.com/
11961052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177631 0039d316-1c4b-4281-b951-d872f2087c98