Bug 158332 - Modernize loading code
Summary: Modernize loading code
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-02 18:54 PDT by Alex Christensen
Modified: 2016-06-07 13:06 PDT (History)
6 users (show)

See Also:


Attachments
Patch (101.55 KB, patch)
2016-06-02 18:57 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-yosemite (1.25 MB, application/zip)
2016-06-02 19:44 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews114 for mac-yosemite (522.47 KB, application/zip)
2016-06-02 19:46 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews104 for mac-yosemite-wk2 (664.00 KB, application/zip)
2016-06-02 19:53 PDT, Build Bot
no flags Details
Patch (61.77 KB, patch)
2016-06-06 12:17 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (63.38 KB, patch)
2016-06-06 16:32 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (63.95 KB, patch)
2016-06-06 17:14 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (64.61 KB, patch)
2016-06-06 17:21 PDT, Alex Christensen
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2016-06-02 18:54:33 PDT
Use more SharedBuffer instead of a pointer and length
Comment 1 Alex Christensen 2016-06-02 18:57:46 PDT
Created attachment 280400 [details]
Patch
Comment 2 Alex Christensen 2016-06-02 19:00:48 PDT
Comment on attachment 280400 [details]
Patch

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

> Source/WebCore/loader/cache/CachedRawResource.cpp:54
> -    unsigned incrementalDataLength;
> -    const char* incrementalData = calculateIncrementalDataChunk(&data, incrementalDataLength);
> -    setEncodedSize(data.size());
> -    notifyClientsDataWasReceived(incrementalData, incrementalDataLength);
> +    notifyClientsDataWasReceived(data);

I think this may have changed behavior, but I'm not sure.
Comment 3 Build Bot 2016-06-02 19:43:59 PDT
Comment on attachment 280400 [details]
Patch

Attachment 280400 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/1426096

Number of test failures exceeded the failure limit.
Comment 4 Build Bot 2016-06-02 19:44:02 PDT
Created attachment 280415 [details]
Archive of layout-test-results from ews103 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 5 Build Bot 2016-06-02 19:46:49 PDT
Comment on attachment 280400 [details]
Patch

Attachment 280400 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/1426067

Number of test failures exceeded the failure limit.
Comment 6 Build Bot 2016-06-02 19:46:51 PDT
Created attachment 280416 [details]
Archive of layout-test-results from ews114 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews114  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 7 Build Bot 2016-06-02 19:53:07 PDT
Comment on attachment 280400 [details]
Patch

Attachment 280400 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1426133

Number of test failures exceeded the failure limit.
Comment 8 Build Bot 2016-06-02 19:53:09 PDT
Created attachment 280418 [details]
Archive of layout-test-results from ews104 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 9 Alex Christensen 2016-06-06 12:17:16 PDT
Created attachment 280617 [details]
Patch
Comment 10 Alex Christensen 2016-06-06 16:32:19 PDT
Created attachment 280645 [details]
Patch
Comment 11 Alex Christensen 2016-06-06 17:14:08 PDT
Created attachment 280651 [details]
Patch
Comment 12 Alex Christensen 2016-06-06 17:21:24 PDT
Created attachment 280652 [details]
Patch
Comment 13 Darin Adler 2016-06-06 18:43:45 PDT
Comment on attachment 280652 [details]
Patch

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

Description says modernize, but I also see a some null checking being added that seems unrelated to the modernizing.

> Source/WebCore/loader/DocumentLoader.cpp:809
> +        if (m_substituteData.content() && m_substituteData.content()->size())
> +            dataReceived(nullptr, m_substituteData.content()->data(), m_substituteData.content()->size());

Given that we dereference it three times after checking it for null, maybe put the pointer into a local variable?

> Source/WebCore/loader/ResourceLoader.cpp:310
> +        m_resourceData->append(buffer);

Should append take a SharedBuffer& instead of a SharedBuffer*?

> Source/WebCore/loader/SubstituteData.h:58
> -        const SharedBuffer* content() const { return m_content.get(); }
> +        SharedBuffer* content() const { return m_content.get(); }

What’s the rationale behind this change?

> Source/WebCore/platform/SharedBuffer.cpp:111
>      RefPtr<SharedBuffer> buffer = create();

Should use auto.

> Source/WebCore/platform/SharedBuffer.cpp:291
> +    Ref<DataBuffer> newBuffer = adoptRef(*new DataBuffer);

Should use auto.

> Source/WebCore/platform/SharedBuffer.h:61
> +    WEBCORE_EXPORT static RefPtr<SharedBuffer> adoptVector(Vector<char>&);

This should return a Ref, not a RefPtr.
Comment 14 Alex Christensen 2016-06-07 11:32:37 PDT
(In reply to comment #13)
> > Source/WebCore/loader/SubstituteData.h:58
> > -        const SharedBuffer* content() const { return m_content.get(); }
> > +        SharedBuffer* content() const { return m_content.get(); }
> 
> What’s the rationale behind this change?
This was needed because of the lack of https://bugs.webkit.org/show_bug.cgi?id=158269 at some point while working on this patch, but I don't think it's needed any more.  Removing.
Comment 15 Alex Christensen 2016-06-07 13:06:38 PDT
Committed to http://trac.webkit.org/changeset/201761
Fixed some builds in http://trac.webkit.org/changeset/201767