• asanka@chromium.org's avatar
    Avoid issuing a Read() after draining a request. · 17b674e0
    asanka@chromium.org authored
    A URLRequest can signal the end of a stream by calling OnReadCompleted()
    with a byte count of zero. No further reads should be issued after this.
    However, ResourceLoader could issue a second Read() if the
    ResourceHandler::OnReadCompleted() handler sets defer to true. I.e.
    
    When a read completes:
      URLRequest calls
        -> ResourceLoader::OnReadCompleted(request, 0)
        -> ResourceHandler::OnReadCompleted(id, 0, &defer)
           (ResourceHandler sets defer to true)
    
    Prior to this CL, the behavior on resumption was:
    
      ResourceHandler calls
        -> ResourceLoader::Resume()
        -> ResourceLoader::ResumeReading()
        -> ResourceLoader::StartReading()
        -> ResourceLoader::ReadMore()
        -> URLRequest::Read()
    
    The new behavior is:
    
      ResourceHandler calls
        -> ResourceLoader::Resume()
        -> ResourceLoader::ResponseCompleted()
    
    The new behavior is parallel to what happens if the ResourceHandler
    didn't defer.
    
    BUG=320394
    
    Review URL: https://codereview.chromium.org/267563004
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269518 0039d316-1c4b-4281-b951-d872f2087c98
    17b674e0
empty.bin.mock-http-headers 288 Bytes