DescriptionChange BodyStreamBuffer to be FetchDataConsumerHandle-based and enable backpressure in Fetch API
This CL replaces BodyStreamBuffer with a new FetchDataConsumerHandle-based
implementation and thus enables backpressure in Fetch API.
Major changes:
1. BlobDataHandle and old BodyStreamBuffer-based interfaces to body data are
replaced with the new FetchDataConsumerHandle-based BodyStreamBuffer.
The old BodyStreamBuffer, BlobDataHandle-based interfaces and related
methods/classes/tests are removed.
2. Now Body::ReadableStreamSource goes into Streaming state on construction and
takes the reader of FetchDataConsumerHandle.
Therefore, all accesses to body data now should take createDrainingStream().
Also, DrainingBodyStreamBuffer is introduced to notify
Body::ReadableStreamSource after createDrainingStream() is done.
3. populateWebServiceWorkerResponse() no longer sets BlobDataHandle.
Callers of populateWebServiceWorkerResponse()
(RespondWithObserver::responseWasFulfilled() and Cache::putImpl()) are
modified accordingly.
Body:
- blobDataHandle() and buffer() are merged into createDrainingStream() [1][2].
- Body::isBodyConsumed() is removed, because it is now always true.
This was used to check whether we have to take createDrainingStream(),
but now we always have to take createDrainingStream() [2].
- Body::m_fetchDataLoader is moved to BodyStreamBuffer::m_fetchDataLoader [2].
- FetchDataLoader::Client methods in Body no longer call
m_streamSource->close()/error(). Now they are done in
Body::ReadableStreamSource::didFetchDataLoadFinishedFromDrainingStream() [2].
- Removed unused code: Body::didFinishLoadingViaStream().
- readAllAndCreateBlobHandle(), BlobHandleCreator, BlobHandleReceiver and
associated methods are removed and replaced with FetchDataLoader.
Body::ReadableStreamSource:
- Loading via FileReaderLoader is removed.
- We no longer put data in |m_stream| that are not immediately consumed and
thus we no longer call |m_stream->readInternal()| in createDrainingStream().
Request:
- refreshBody() is introduced and called after m_request->buffer() is set [1].
FetchRequestData:
- |m_blobDataHandle| is replaced with |m_buffer| [1].
- Some methods now require ExecutionContext* as an argument to set |m_buffer|.
Response:
- createInternalDrainingStream() is introduced and replaces internalBuffer().
FetchResponseData:
- Some methods now require ExecutionContext* as an argument to make clones.
- startTee() is replaced with DataConsumerHandleTee.
cache-put.js:
- Add a layout test for getReader() after cache.put() is completed.
This test confirms notification by DrainingBodyStreamBuffer works correctly.
BUG=480746
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=198391
Patch Set 1 : BASE #Patch Set 2 : https://codereview.chromium.org/1171913003/#ps760001 #Patch Set 3 : #Patch Set 4 : #Patch Set 5 : BASE #Patch Set 6 : #Patch Set 7 : Fixed layout test failure. #Patch Set 8 : Enabled unittests #Patch Set 9 : BASE #Patch Set 10 : Rebase. #
Total comments: 10
Patch Set 11 : Keep-alive OK. Remove BodyStreamBuffer. #Patch Set 12 : #Patch Set 13 : Rename BodyStreamBuffer2 to BodyStreamBuffer #Patch Set 14 : Reflect comments. #
Total comments: 2
Patch Set 15 : Reflected comment #4 #Patch Set 16 : BASE #Patch Set 17 : Rebase #Patch Set 18 : #Patch Set 19 : WIP. BlobDataHandle refactoring. #Patch Set 20 : WIP Fix unittests. #Patch Set 21 : Rebase. #Patch Set 22 : bug fix. #Patch Set 23 : Comment fix. #Patch Set 24 : Remove isBodyConsumed. #Patch Set 25 : Fix build break. #Patch Set 26 : Rebase. #Patch Set 27 : drainingStream refactoring. all fetch/serviceworker/cachestorage tests passed except for one. #Patch Set 28 : resolve sync in FetchDataLoader #Patch Set 29 : Fix unittests. #Patch Set 30 : Rebase. #Patch Set 31 : rebase. #Patch Set 32 : Fix tests. #Patch Set 33 : BASE #Patch Set 34 : Rebase. #Patch Set 35 : Clean up done. ready. #
Total comments: 1
Patch Set 36 : (temp) alternative to calling didGetReadable in sync. #
Total comments: 16
Patch Set 37 : Rebase. #Patch Set 38 : Reflect comments. #
Total comments: 22
Patch Set 39 : Reflect comments #14 #
Total comments: 3
Patch Set 40 : Temp. #Patch Set 41 : Temp. #Patch Set 42 : Reflected comments #14, #16. #
Total comments: 2
Patch Set 43 : performance-timeline test. #Patch Set 44 : Rebase. #Messages
Total messages: 27 (6 generated)
|