Bug 77715

Summary: SharedBuffer m_segments and m_dataArray must be exclusive
Product: WebKit Reporter: Benjamin Poulain <benjamin>
Component: Page LoadingAssignee: Pratik Solanki <psolanki>
Status: RESOLVED FIXED    
Severity: Normal CC: ddkilzer, psolanki
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch benjamin: review+, benjamin: commit-queue-

Description Benjamin Poulain 2012-02-02 22:19:15 PST
There is a clear order and size relation between m_buffer and m_segments.

With m_dataArray, there is the implicit rule that m_dataArray comes after m_buffer and m_segments, and all segments are completely full.

In practice, we never mix m_dataArray and m_segments (well, I hope at least) which is why that works.

We should make those relations explicit.

Related to:
<rdar://problem/10801705>
Comment 1 Benjamin Poulain 2012-02-03 17:46:37 PST
<rdar://problem/10808108>
Comment 2 Pratik Solanki 2012-11-19 12:56:25 PST
Updating title. m_buffer is still needed even with data array. Also taking bug since I have a patch.
Comment 3 Pratik Solanki 2012-11-29 13:59:55 PST
Created attachment 176814 [details]
Patch
Comment 4 Pratik Solanki 2013-05-03 12:05:44 PDT
Created attachment 200453 [details]
Patch
Comment 5 Benjamin Poulain 2013-05-03 16:06:00 PDT
Comment on attachment 200453 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=200453&action=review

> Source/WebCore/platform/SharedBuffer.cpp:211
> +        m_buffer.reserveInitialCapacity(length);

I don't think that matters. The append() call has the size, it will allocate the best block size for the input.
Comment 6 Pratik Solanki 2013-05-03 16:33:04 PDT
Comment on attachment 200453 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=200453&action=review

>> Source/WebCore/platform/SharedBuffer.cpp:211
>> +        m_buffer.reserveInitialCapacity(length);
> 
> I don't think that matters. The append() call has the size, it will allocate the best block size for the input.

That change was inspired by <http://trac.webkit.org/changeset/135098> made for bug 102625
Comment 7 Pratik Solanki 2013-08-28 17:13:13 PDT
Hmm.. Looks like I never checked this in. :( I am going to rebase the patch, make sure it works and maybe upload a new one for review.
Comment 8 Pratik Solanki 2013-08-28 17:50:19 PDT
Looks like the patch compiles and runs fine with USE(NETWORK_CFDATA_ARRAY_CALLBACK) disabled. If it works fine with the flag turned on, I'll just go ahead and commit.
Comment 9 Pratik Solanki 2013-08-29 11:00:43 PDT
Committed r154823: <http://trac.webkit.org/changeset/154823>