Delay GpuCommandBufferStub::AddDestructionObserver until we need it.
In certain failure cases at initialization time (caused by a race) we used to call AddDestructionObserver before we would make the surface current, causing us to destroy the surface before OnWillDestroyStub had a chance to be called, so we wouldn't RemoveDestructionObserver and we'd call into a dead pointer. This fixes it. By the time MakeCurrent is called, we know we have a ref to the surface and it won't destroy it until GpuCommandBufferStub::Destroy, after OnWillDestroyStub is called. BUG=140502 TEST=attach debugger to renderer, add a breakpoint to CommandBufferProxyImpl::Initialize, right-click and "view page source" (breakpoint should hit), kill new tab, and only then continue breakpoint. Observe no GPU process crash. Review URL: https://chromiumcodereview.appspot.com/10831169 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150227 0039d316-1c4b-4281-b951-d872f2087c98
Showing
Please register or sign in to comment