WebGL: Transfer ownership of WebGraphicsContext3D from WebGLRenderingContext to DrawingBuffer.
Currently, the lifecycle of DrawingBuffer is different from it of WebGraphicsContext3D, so there is so many checks if the context is valid. This complexity is not necessary because DrawingBuffer does not own any objects when the context is lost or impossible to be created. To be clear the lifecycle, this CL makes DrawingBuffer take ownership of WebGraphicsContext3D. The DrawingBuffer creation or resize can fail if the memory is not enough. This logic is preserved. In detail, 1. If it occurs during WebGLRenderingContext creation, we give up creating WebGLRenderingContext. 2. If it occurs during restoration of lost context, we will try again. 3. If it occurs during resizing DrawingBuffer, we slightly ignore, because we can reuse different size FBO in this case. In addition, this CL fixes two bugs. 1. maybeRestoreContext() pretends to success to restore although creating FBO in DrawingBuffer fails. As mentioned earlier, we will try again. 2. WebGLRenderingContext calls DrawingBuffer::reset() twice during creation, because the constructor of DrawingBuffer internally calls reset(). BUG=344393 Review URL: https://codereview.chromium.org/163773007 git-svn-id: svn://svn.chromium.org/blink/trunk@168457 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Showing
This diff is collapsed.
Please register or sign in to comment