• bnc's avatar
    Remove Request from Map in OnNewSpdySessionReady(). · dcdaa5f6
    bnc authored
    SpdySessionPool::OnNewSpdySessionReady() calls
    HttpStreamFactoryImpl::Request::Complete() repeatedly while there are
    any Requests in the map.  This relies on
    HttpStreamRequest::Delegate::OnStreamReady() destroying the Request,
    which in its destructor calls
    HttpStreamFactoryImpl::JobController::OnRequestComplete(), which calls
    HttpStreamFactoryImpl::JobController::CancelJobs(), which calls
    HttpStreamFactoryImpl::JobController::RemoveRequestFromSpdySessionRequestMap(),
    which calls SpdySessionPool::RemoveRequestFromSpdySessionRequestMap().
    However, if HttpStreamRequest::Delegate::OnStreamReady() does not
    destroy the Request, that results in DCHECK(!completed_) triggering in
    HttpStreamFactoryImpl::Request::Complete() in a debug build, and an
    infinite loop in production build.
    
    This CL fixes this by explicitly calling
    RemoveRequestFromSpdySessionRequestMap() in
    SpdySessionPool::OnNewSpdySessionReady().
    
    This revives https://crrev.com/2784143003, which was abandoned to do all
    the necessary cleanup first.  Kudos to xunjieli@ for paving the way.
    
    BUG=706974
    
    Review-Url: https://codereview.chromium.org/2930323002
    Cr-Commit-Position: refs/heads/master@{#478704}
    dcdaa5f6
http_stream_factory_impl_unittest.cc 104 KB