The AsnycResourceHandler in the ResourceHandler stack can cancel a request at any time. Any ResourceHandler can defer most operations (including completion).
This creates two problematic cases:
1) If ResourceHandler A defers a request and then ResourceHandler B cancels it, and ResourceHandler C (Which may be the same as B) defers the cancellation, and then A resumes the request (As it hasn't seen the cancellation yet), then the ResourceLoader will think it was ResourceHandler C that resumed the operation, which can result in Bad Things.
2) Similarly, if one ResourceHandler cancels a request, destruction is deferred, and then another cancels the request, the ResourceLoader will call ResourceLoader::ResponseCompleted twice, again resulting in Bad Things.
After some discussion, we've decided the best way to handle (In terms of time to implement and complexity) this is to separate out cancellation from errors/successful completion in the ResourceLoader stack. The only ResourceHandler that needs to defer completion is the RedirectToFileResourceHandler, and on cancellation, it makes sense to just discard whatever data's being written to the file, since something cancelled the request, so partial data won't be useful, anyways.
Comment 1 by mmenke@chromium.org
, Oct 25 2016