|
|
DescriptionIntroduce FormDataBytesConsumer
This CL introduces FormDataBytesConsumer which will replace
FetchFormDataConsumerHandle.
BUG=610195
Committed: https://crrev.com/1ceb0ca40370a0e0f40d8a9c379e6396672f4923
Cr-Commit-Position: refs/heads/master@{#421219}
Patch Set 1 #Patch Set 2 : fix #
Total comments: 30
Patch Set 3 : fix #Patch Set 4 : fix #Patch Set 5 : fix #Patch Set 6 : fix #Patch Set 7 : fix #
Total comments: 7
Patch Set 8 : rebase #Patch Set 9 : rebase #Patch Set 10 : fix #
Depends on Patchset: Dependent Patchsets: Messages
Total messages: 52 (39 generated)
The CQ bit was checked by yhirano@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by yhirano@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== Introduce FormDataBytesConsumer wip wip wip wip BUG=610195 ========== to ========== Introduce FormDataBytesConsumer This CL introduces FormDataBytesConsumer which will replace FetchFormDataConsumerHandle. BUG=610195 ==========
yhirano@chromium.org changed reviewers: + hiroshige@chromium.org
Basically looks good. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp (right): https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp:21: bool isSimple(const EncodedFormData* formData) Memo: this is dup of isSimple() in FetchFormDataConsumerHandle.cpp. This isn't a problem provided FetchFormDataConsumerHandle.cpp will be deleted soon. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp:153: return m_blobBytesConsumer->beginRead(buffer, available); IIUC this code returns Done after drainAsFormData() returns non-null, because |m_blobBytesConsumer| is cancelled. Leaving a short comment might be helpful to understand the behavior. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp (right): https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:54: class StubBytesConsumer final : public BytesConsumer { optional: How about creating a class with gmock and testing by EXPECT_CALL()s? https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:166: TEST_F(FormDataBytesConsumerTest, ReadFromSimplFormData) nit: s/Simpl/Simple/ https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:222: EXPECT_EQ(Result::Done, consumer->read(&c, 1, &readSize)); Could you also test getPublicState()? https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:236: EXPECT_EQ(Result::Done, consumer->read(&c, 1, &readSize)); ditto. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:255: EXPECT_EQ(Result::Done, consumer->read(&c, 1, &readSize)); ditto. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:269: EXPECT_EQ(Result::Done, consumer->read(&c, 1, &readSize)); ditto. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:283: EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &size)); ditto. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:298: EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &size)); ditto. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:314: EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &size)); ditto. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:327: EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &size)); ditto. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:337: EXPECT_FALSE(consumer->drainAsFormData()); Could you also test drainAsBlobDataHandle()? https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:349: EXPECT_FALSE(consumer->drainAsFormData()); ditto. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:351: Could you also test ReadAffectsDraining/BeginReadAffectsDraining for complex form data?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by yhirano@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_clang_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_clan...)
The CQ bit was checked by yhirano@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by yhirano@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by yhirano@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by yhirano@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
I failed the statement management in SimpleFormDataBytesConsumer, so I fixed it. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp (right): https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp:21: bool isSimple(const EncodedFormData* formData) On 2016/09/15 09:47:33, hiroshige wrote: > Memo: this is dup of isSimple() in FetchFormDataConsumerHandle.cpp. > This isn't a problem provided FetchFormDataConsumerHandle.cpp will be deleted > soon. Acknowledged. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp:153: return m_blobBytesConsumer->beginRead(buffer, available); On 2016/09/15 09:47:33, hiroshige wrote: > IIUC this code returns Done after drainAsFormData() returns non-null, because > |m_blobBytesConsumer| is cancelled. Leaving a short comment might be helpful to > understand the behavior. Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp (right): https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:54: class StubBytesConsumer final : public BytesConsumer { On 2016/09/15 09:47:33, hiroshige wrote: > optional: How about creating a class with gmock and testing by EXPECT_CALL()s? Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:166: TEST_F(FormDataBytesConsumerTest, ReadFromSimplFormData) On 2016/09/15 09:47:33, hiroshige wrote: > nit: s/Simpl/Simple/ Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:222: EXPECT_EQ(Result::Done, consumer->read(&c, 1, &readSize)); On 2016/09/15 09:47:33, hiroshige wrote: > Could you also test getPublicState()? Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:236: EXPECT_EQ(Result::Done, consumer->read(&c, 1, &readSize)); On 2016/09/15 09:47:33, hiroshige wrote: > ditto. Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:255: EXPECT_EQ(Result::Done, consumer->read(&c, 1, &readSize)); On 2016/09/15 09:47:33, hiroshige wrote: > ditto. Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:269: EXPECT_EQ(Result::Done, consumer->read(&c, 1, &readSize)); On 2016/09/15 09:47:33, hiroshige wrote: > ditto. Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:283: EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &size)); On 2016/09/15 09:47:33, hiroshige wrote: > ditto. Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:298: EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &size)); On 2016/09/15 09:47:33, hiroshige wrote: > ditto. Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:314: EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &size)); On 2016/09/15 09:47:33, hiroshige wrote: > ditto. Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:327: EXPECT_EQ(Result::Done, consumer->beginRead(&buffer, &size)); On 2016/09/15 09:47:33, hiroshige wrote: > ditto. Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:337: EXPECT_FALSE(consumer->drainAsFormData()); On 2016/09/15 09:47:33, hiroshige wrote: > Could you also test drainAsBlobDataHandle()? Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:349: EXPECT_FALSE(consumer->drainAsFormData()); On 2016/09/15 09:47:33, hiroshige wrote: > ditto. Done. https://codereview.chromium.org/2342023002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:351: On 2016/09/15 09:47:33, hiroshige wrote: > Could you also test ReadAffectsDraining/BeginReadAffectsDraining for complex > form data? Done.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp (right): https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp:59: m_state = PublicState::Closed; If we change the state to Closed here, shouldn't we notify the client? https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp (right): https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:367: checkpoint.Call(3); Could you test getPublicState() here?
The CQ bit was checked by yhirano@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp (right): https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp:59: m_state = PublicState::Closed; On 2016/09/16 07:24:34, hiroshige wrote: > If we change the state to Closed here, shouldn't we notify the client? You're right, but as talked offline I changed the design so that endRead can return Result::Done. https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp (right): https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:367: checkpoint.Call(3); On 2016/09/16 07:24:34, hiroshige wrote: > Could you test getPublicState() here? In this case consumer->getPublicState() is simply redirected to underlying->getPublicState and we need to provide its return value manually. Do you think it's valuable to test that here?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by yhirano@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp (right): https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp:59: m_state = PublicState::Closed; On 2016/09/21 03:16:16, yhirano (slow) wrote: > On 2016/09/16 07:24:34, hiroshige wrote: > > If we change the state to Closed here, shouldn't we notify the client? > > You're right, but as talked offline I changed the design so that endRead can > return Result::Done. Acknowledged. https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp (right): https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:367: checkpoint.Call(3); On 2016/09/21 03:16:16, yhirano (slow) wrote: > On 2016/09/16 07:24:34, hiroshige wrote: > > Could you test getPublicState() here? > > In this case consumer->getPublicState() is simply redirected to > underlying->getPublicState and we need to provide its return value manually. Do > you think it's valuable to test that here? I think at least we should test getPublicState() does not return Done unless we completely read the data (in other words, |consumer| shouldn't change the state to Done for failed drainAs*()).
lgtm if my previous comment for tests is addressed.
The CQ bit was checked by yhirano@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp (right): https://codereview.chromium.org/2342023002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp:367: checkpoint.Call(3); On 2016/09/21 07:42:19, hiroshige wrote: > On 2016/09/21 03:16:16, yhirano (slow) wrote: > > On 2016/09/16 07:24:34, hiroshige wrote: > > > Could you test getPublicState() here? > > > > In this case consumer->getPublicState() is simply redirected to > > underlying->getPublicState and we need to provide its return value manually. > Do > > you think it's valuable to test that here? > > I think at least we should test getPublicState() does not return Done unless we > completely read the data (in other words, |consumer| shouldn't change the state > to Done for failed drainAs*()). Done.
yhirano@chromium.org changed reviewers: + haraken@chromium.org
+haraken@ for modules/BUILD.gn.
LGTM
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by yhirano@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from hiroshige@chromium.org Link to the patchset: https://codereview.chromium.org/2342023002/#ps180001 (title: "fix")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== Introduce FormDataBytesConsumer This CL introduces FormDataBytesConsumer which will replace FetchFormDataConsumerHandle. BUG=610195 ========== to ========== Introduce FormDataBytesConsumer This CL introduces FormDataBytesConsumer which will replace FetchFormDataConsumerHandle. BUG=610195 ==========
Message was sent while issue was closed.
Committed patchset #10 (id:180001)
Message was sent while issue was closed.
Description was changed from ========== Introduce FormDataBytesConsumer This CL introduces FormDataBytesConsumer which will replace FetchFormDataConsumerHandle. BUG=610195 ========== to ========== Introduce FormDataBytesConsumer This CL introduces FormDataBytesConsumer which will replace FetchFormDataConsumerHandle. BUG=610195 Committed: https://crrev.com/1ceb0ca40370a0e0f40d8a9c379e6396672f4923 Cr-Commit-Position: refs/heads/master@{#421219} ==========
Message was sent while issue was closed.
Patchset 10 (id:??) landed as https://crrev.com/1ceb0ca40370a0e0f40d8a9c379e6396672f4923 Cr-Commit-Position: refs/heads/master@{#421219} |