Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Issue 1192913007: Change BodyStreamBuffer to be FetchDataConsumerHandle-based and enable backpressure in Fetch API (Closed)

Created:
5 years, 6 months ago by hiroshige
Modified:
5 years, 5 months ago
Reviewers:
yhirano, horo
CC:
blink-reviews, michaeln, jsbell+serviceworker_chromium.org, tzik, serviceworker-reviews, nhiroki, falken, kinuko+serviceworker, horo+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Change 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. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+575 lines, -1410 lines) Patch
M LayoutTests/http/tests/cachestorage/script-tests/cache-put.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 33 1 chunk +8 lines, -0 lines 0 comments Download
M Source/modules/cachestorage/Cache.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 7 chunks +19 lines, -24 lines 0 comments Download
M Source/modules/fetch/Body.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 2 chunks +17 lines, -36 lines 0 comments Download
M Source/modules/fetch/Body.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 10 chunks +168 lines, -316 lines 0 comments Download
M Source/modules/fetch/BodyStreamBuffer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 2 chunks +64 lines, -58 lines 0 comments Download
M Source/modules/fetch/BodyStreamBuffer.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 1 chunk +96 lines, -247 lines 0 comments Download
M Source/modules/fetch/BodyStreamBufferTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 chunk +1 line, -257 lines 0 comments Download
M Source/modules/fetch/FetchBlobDataConsumerHandle.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 2 chunks +2 lines, -2 lines 0 comments Download
M Source/modules/fetch/FetchManager.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 33 3 chunks +6 lines, -4 lines 0 comments Download
M Source/modules/fetch/FetchRequestData.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 5 chunks +10 lines, -7 lines 0 comments Download
M Source/modules/fetch/FetchRequestData.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 5 chunks +16 lines, -8 lines 0 comments Download
M Source/modules/fetch/FetchResponseData.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 3 chunks +8 lines, -11 lines 0 comments Download
M Source/modules/fetch/FetchResponseData.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 16 33 10 chunks +11 lines, -98 lines 0 comments Download
M Source/modules/fetch/FetchResponseDataTest.cpp View 1 5 9 16 33 1 chunk +1 line, -0 lines 0 comments Download
M Source/modules/fetch/Request.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 2 chunks +5 lines, -5 lines 0 comments Download
M Source/modules/fetch/Request.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 11 chunks +46 lines, -45 lines 0 comments Download
M Source/modules/fetch/Response.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 2 chunks +9 lines, -6 lines 0 comments Download
M Source/modules/fetch/Response.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 9 chunks +25 lines, -27 lines 0 comments Download
M Source/modules/fetch/ResponseTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 3 chunks +54 lines, -193 lines 0 comments Download
M Source/modules/serviceworkers/RespondWithObserver.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 2 chunks +9 lines, -66 lines 0 comments Download

Messages

Total messages: 27 (6 generated)
hiroshige
yhirano@, could you take a look at this? See diff from "BASE" Patch Set. This ...
5 years, 6 months ago (2015-06-23 07:59:08 UTC) #2
yhirano
https://codereview.chromium.org/1192913007/diff/180001/Source/modules/cachestorage/Cache.cpp File Source/modules/cachestorage/Cache.cpp (right): https://codereview.chromium.org/1192913007/diff/180001/Source/modules/cachestorage/Cache.cpp#newcode212 Source/modules/cachestorage/Cache.cpp:212: m_resolver->reject(V8ThrowException::createTypeError(state->isolate(), "FOXES ARE CUTE")); // FIXME error message Please ...
5 years, 6 months ago (2015-06-25 10:45:31 UTC) #3
yhirano
https://codereview.chromium.org/1192913007/diff/260001/Source/modules/fetch/Body.cpp File Source/modules/fetch/Body.cpp (right): https://codereview.chromium.org/1192913007/diff/260001/Source/modules/fetch/Body.cpp#newcode117 Source/modules/fetch/Body.cpp:117: void didGetReadable() override Consider using zero-length read in order ...
5 years, 6 months ago (2015-06-25 11:11:32 UTC) #4
hiroshige
https://codereview.chromium.org/1192913007/diff/180001/Source/modules/cachestorage/Cache.cpp File Source/modules/cachestorage/Cache.cpp (right): https://codereview.chromium.org/1192913007/diff/180001/Source/modules/cachestorage/Cache.cpp#newcode212 Source/modules/cachestorage/Cache.cpp:212: m_resolver->reject(V8ThrowException::createTypeError(state->isolate(), "FOXES ARE CUTE")); // FIXME error message On ...
5 years, 6 months ago (2015-06-25 11:27:28 UTC) #5
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1192913007/610001
5 years, 5 months ago (2015-07-01 19:45:09 UTC) #7
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_blink_compile_dbg on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/win_blink_compile_dbg/builds/49877)
5 years, 5 months ago (2015-07-01 20:19:04 UTC) #9
hiroshige
I think now this CL is ready for review again; could you take a look ...
5 years, 5 months ago (2015-07-02 08:22:10 UTC) #10
yhirano
https://codereview.chromium.org/1192913007/diff/690001/Source/modules/fetch/Body.cpp File Source/modules/fetch/Body.cpp (right): https://codereview.chromium.org/1192913007/diff/690001/Source/modules/fetch/Body.cpp#newcode27 Source/modules/fetch/Body.cpp:27: // This class is an ActiveDOMObject subclass only for ...
5 years, 5 months ago (2015-07-03 04:42:28 UTC) #11
yhirano
IIUC all required CLs are landed (except https://codereview.chromium.org/1217943007/ which is not strictly required). Can you ...
5 years, 5 months ago (2015-07-03 07:20:14 UTC) #12
hiroshige
Rebased in Patch Set 37, and reflected comments in Patch Set 38. https://codereview.chromium.org/1192913007/diff/690001/Source/modules/fetch/Body.cpp File Source/modules/fetch/Body.cpp ...
5 years, 5 months ago (2015-07-05 07:30:25 UTC) #13
yhirano
https://codereview.chromium.org/1192913007/diff/730001/Source/modules/fetch/Body.cpp File Source/modules/fetch/Body.cpp (right): https://codereview.chromium.org/1192913007/diff/730001/Source/modules/fetch/Body.cpp#newcode59 Source/modules/fetch/Body.cpp:59: if (m_stream->stateInternal() == ReadableByteStream::Closed) [optional] It would be good ...
5 years, 5 months ago (2015-07-06 03:25:39 UTC) #14
hiroshige
https://codereview.chromium.org/1192913007/diff/730001/Source/modules/fetch/Body.cpp File Source/modules/fetch/Body.cpp (right): https://codereview.chromium.org/1192913007/diff/730001/Source/modules/fetch/Body.cpp#newcode59 Source/modules/fetch/Body.cpp:59: if (m_stream->stateInternal() == ReadableByteStream::Closed) On 2015/07/06 03:25:38, yhirano wrote: ...
5 years, 5 months ago (2015-07-06 05:47:08 UTC) #15
yhirano
https://codereview.chromium.org/1192913007/diff/730001/Source/modules/fetch/Body.cpp File Source/modules/fetch/Body.cpp (right): https://codereview.chromium.org/1192913007/diff/730001/Source/modules/fetch/Body.cpp#newcode59 Source/modules/fetch/Body.cpp:59: if (m_stream->stateInternal() == ReadableByteStream::Closed) On 2015/07/06 05:47:07, hiroshige wrote: ...
5 years, 5 months ago (2015-07-06 06:14:01 UTC) #16
yhirano
+horo@ for modules/serviceworkers, modules/cachestorage and layout tests.
5 years, 5 months ago (2015-07-06 09:06:25 UTC) #18
hiroshige
https://codereview.chromium.org/1192913007/diff/730001/Source/modules/fetch/Body.cpp File Source/modules/fetch/Body.cpp (right): https://codereview.chromium.org/1192913007/diff/730001/Source/modules/fetch/Body.cpp#newcode59 Source/modules/fetch/Body.cpp:59: if (m_stream->stateInternal() == ReadableByteStream::Closed) On 2015/07/06 06:14:00, yhirano wrote: ...
5 years, 5 months ago (2015-07-07 03:50:58 UTC) #19
yhirano
lgtm
5 years, 5 months ago (2015-07-07 04:07:51 UTC) #20
horo
lgtm with nit. https://codereview.chromium.org/1192913007/diff/810001/Source/modules/fetch/BodyStreamBuffer.h File Source/modules/fetch/BodyStreamBuffer.h (right): https://codereview.chromium.org/1192913007/diff/810001/Source/modules/fetch/BodyStreamBuffer.h#newcode85 Source/modules/fetch/BodyStreamBuffer.h:85: BodyStreamBuffer* leakBuffer(); nit: I prefer releaseBuffer.
5 years, 5 months ago (2015-07-07 06:34:47 UTC) #21
hiroshige
Thanks for reviewing! https://codereview.chromium.org/1192913007/diff/810001/Source/modules/fetch/BodyStreamBuffer.h File Source/modules/fetch/BodyStreamBuffer.h (right): https://codereview.chromium.org/1192913007/diff/810001/Source/modules/fetch/BodyStreamBuffer.h#newcode85 Source/modules/fetch/BodyStreamBuffer.h:85: BodyStreamBuffer* leakBuffer(); On 2015/07/07 06:34:46, horo ...
5 years, 5 months ago (2015-07-07 06:50:53 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1192913007/830001
5 years, 5 months ago (2015-07-07 08:25:26 UTC) #25
horo
On 2015/07/07 06:50:53, hiroshige wrote: > Thanks for reviewing! > > https://codereview.chromium.org/1192913007/diff/810001/Source/modules/fetch/BodyStreamBuffer.h > File Source/modules/fetch/BodyStreamBuffer.h ...
5 years, 5 months ago (2015-07-07 09:40:29 UTC) #26
commit-bot: I haz the power
5 years, 5 months ago (2015-07-07 11:16:19 UTC) #27
Message was sent while issue was closed.
Committed patchset #44 (id:830001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=198391

Powered by Google App Engine
This is Rietveld 408576698