| Index: content/browser/loader/mime_sniffing_resource_handler.h
|
| diff --git a/content/browser/loader/mime_sniffing_resource_handler.h b/content/browser/loader/mime_sniffing_resource_handler.h
|
| index 47a9dff945be4094ffa8b406af212c50c7e56dfb..21200938cb7bb5e76a8fb4c2832d8696d3c05cf9 100644
|
| --- a/content/browser/loader/mime_sniffing_resource_handler.h
|
| +++ b/content/browser/loader/mime_sniffing_resource_handler.h
|
| @@ -66,6 +66,11 @@ class CONTENT_EXPORT MimeSniffingResourceHandler
|
| // about request interception.
|
| STATE_BUFFERING,
|
|
|
| + // In these states, the MimeSniffingResourceHandler is calling OnWillRead on
|
| + // the downstream ResourceHandler and then waiting for the response.
|
| + STATE_CALLING_ON_WILL_READ,
|
| + STATE_WAITING_FOR_BUFFER,
|
| +
|
| // In this state, the MimeSniffingResourceHandler has identified the mime
|
| // type and made a decision on whether the request should be intercepted or
|
| // not. It is nows attempting to replay the response to downstream
|
| @@ -88,8 +93,9 @@ class CONTENT_EXPORT MimeSniffingResourceHandler
|
| void OnResponseStarted(
|
| ResourceResponse* response,
|
| std::unique_ptr<ResourceController> controller) override;
|
| - bool OnWillRead(scoped_refptr<net::IOBuffer>* buf,
|
| - int* buf_size) override;
|
| + void OnWillRead(scoped_refptr<net::IOBuffer>* buf,
|
| + int* buf_size,
|
| + std::unique_ptr<ResourceController> controller) override;
|
| void OnReadCompleted(int bytes_read,
|
| std::unique_ptr<ResourceController> controller) override;
|
| void OnResponseCompleted(
|
| @@ -110,6 +116,12 @@ class CONTENT_EXPORT MimeSniffingResourceHandler
|
| // Intercepts the request as a stream/download if needed.
|
| void MaybeIntercept();
|
|
|
| + // Calls OnWillRead on the downstream handlers.
|
| + void CallOnWillRead();
|
| +
|
| + // Copies received buffer to parent.
|
| + void BufferReceived();
|
| +
|
| // Replays OnResponseStarted on the downstream handlers.
|
| void ReplayResponseReceived();
|
|
|
| @@ -167,6 +179,11 @@ class CONTENT_EXPORT MimeSniffingResourceHandler
|
| int read_buffer_size_;
|
| int bytes_read_;
|
|
|
| + // Pointers to parent-owned read buffer and its size. Only used for first
|
| + // OnWillRead call.
|
| + scoped_refptr<net::IOBuffer>* parent_read_buffer_;
|
| + int* parent_read_buffer_size_;
|
| +
|
| // The InterceptingResourceHandler that will perform ResourceHandler swap if
|
| // needed.
|
| InterceptingResourceHandler* intercepting_handler_;
|
|
|