Changeset 228909 in webkit


Ignore:
Timestamp:
Feb 21, 2018 4:28:20 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Make SubstituteResource take a ResourceResponse r-value
https://bugs.webkit.org/show_bug.cgi?id=183020

Patch by Youenn Fablet <youenn@apple.com> on 2018-02-21
Reviewed by Alex Christensen.

No change of behavior.
Make SubstituteResource take a ResourceResponse r-value.
Update ArchiveResource accordingly.
Take benefit of that in ApplicationCacheResource to set the response source to ApplicationCache
before passing it to SubstituteResource constructor.

  • loader/SubstituteResource.h:

(WebCore::SubstituteResource::SubstituteResource):
(WebCore::SubstituteResource::resourceResponse): Deleted.

  • loader/appcache/ApplicationCacheResource.cpp:

(WebCore::ApplicationCacheResource::create):
(WebCore::ApplicationCacheResource::ApplicationCacheResource):

  • loader/appcache/ApplicationCacheResource.h:

(WebCore::ApplicationCacheResource::create): Deleted.

  • loader/archive/ArchiveResource.cpp:

(WebCore::ArchiveResource::ArchiveResource):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r228908 r228909  
     12018-02-21  Youenn Fablet  <youenn@apple.com>
     2
     3        Make SubstituteResource take a ResourceResponse r-value
     4        https://bugs.webkit.org/show_bug.cgi?id=183020
     5
     6        Reviewed by Alex Christensen.
     7
     8        No change of behavior.
     9        Make SubstituteResource take a ResourceResponse r-value.
     10        Update ArchiveResource accordingly.
     11        Take benefit of that in ApplicationCacheResource to set the response source to ApplicationCache
     12        before passing it to SubstituteResource constructor.
     13
     14        * loader/SubstituteResource.h:
     15        (WebCore::SubstituteResource::SubstituteResource):
     16        (WebCore::SubstituteResource::resourceResponse): Deleted.
     17        * loader/appcache/ApplicationCacheResource.cpp:
     18        (WebCore::ApplicationCacheResource::create):
     19        (WebCore::ApplicationCacheResource::ApplicationCacheResource):
     20        * loader/appcache/ApplicationCacheResource.h:
     21        (WebCore::ApplicationCacheResource::create): Deleted.
     22        * loader/archive/ArchiveResource.cpp:
     23        (WebCore::ArchiveResource::ArchiveResource):
     24
    1252018-02-21  Zalan Bujtas  <zalan@apple.com>
    226
  • trunk/Source/WebCore/loader/SubstituteResource.h

    r228901 r228909  
    4343
    4444protected:
    45     SubstituteResource(const URL& url, const ResourceResponse& response, Ref<SharedBuffer>&& data)
    46         : m_url(url)
    47         , m_response(response)
     45    SubstituteResource(URL&& url, ResourceResponse&& response, Ref<SharedBuffer>&& data)
     46        : m_url(WTFMove(url))
     47        , m_response(WTFMove(response))
    4848        , m_data(WTFMove(data))
    4949    {
    5050    }
    51 
    52     ResourceResponse& resourceResponse() { return m_response; }
    5351
    5452private:
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheResource.cpp

    r228901 r228909  
    3030namespace WebCore {
    3131
    32 ApplicationCacheResource::ApplicationCacheResource(const URL& url, const ResourceResponse& response, unsigned type, Ref<SharedBuffer>&& data, const String& path)
    33     : SubstituteResource(url, response, WTFMove(data))
     32Ref<ApplicationCacheResource> ApplicationCacheResource::create(const URL& url, const ResourceResponse& response, unsigned type, RefPtr<SharedBuffer>&& buffer, const String& path)
     33{
     34    ASSERT(!url.hasFragmentIdentifier());
     35    if (!buffer)
     36        buffer = SharedBuffer::create();
     37    auto resourceResponse = response;
     38    resourceResponse.setSource(ResourceResponse::Source::ApplicationCache);
     39
     40    return adoptRef(*new ApplicationCacheResource(URL { url }, WTFMove(resourceResponse), type, buffer.releaseNonNull(), path));
     41}
     42
     43ApplicationCacheResource::ApplicationCacheResource(URL&& url, ResourceResponse&& response, unsigned type, Ref<SharedBuffer>&& data, const String& path)
     44    : SubstituteResource(WTFMove(url), WTFMove(response), WTFMove(data))
    3445    , m_type(type)
    3546    , m_storageID(0)
     
    3748    , m_path(path)
    3849{
    39     resourceResponse().setSource(ResourceResponse::Source::ApplicationCache);
    4050}
    4151
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheResource.h

    r208646 r228909  
    3939        Fallback = 1 << 4
    4040    };
    41        
    42     static Ref<ApplicationCacheResource> create(const URL& url, const ResourceResponse& response, unsigned type, RefPtr<SharedBuffer> buffer = SharedBuffer::create(), const String& path = String())
    43     {
    44         ASSERT(!url.hasFragmentIdentifier());
    45         if (!buffer)
    46             buffer = SharedBuffer::create();
    47         return adoptRef(*new ApplicationCacheResource(url, response, type, buffer.releaseNonNull(), path));
    48     }
     41
     42    static Ref<ApplicationCacheResource> create(const URL&, const ResourceResponse&, unsigned type, RefPtr<SharedBuffer>&& = SharedBuffer::create(), const String& path = String());
    4943
    5044    unsigned type() const { return m_type; }
     
    6458   
    6559private:
    66     ApplicationCacheResource(const URL&, const ResourceResponse&, unsigned type, Ref<SharedBuffer>&&, const String& path);
     60    ApplicationCacheResource(URL&&, ResourceResponse&&, unsigned type, Ref<SharedBuffer>&&, const String& path);
    6761
    6862    void deliver(ResourceLoader&) override;
  • trunk/Source/WebCore/loader/archive/ArchiveResource.cpp

    r198177 r228909  
    3535
    3636inline ArchiveResource::ArchiveResource(Ref<SharedBuffer>&& data, const URL& url, const String& mimeType, const String& textEncoding, const String& frameName, const ResourceResponse& response)
    37     : SubstituteResource(url, response, WTFMove(data))
     37    : SubstituteResource(URL { url }, ResourceResponse { response }, WTFMove(data))
    3838    , m_mimeType(mimeType)
    3939    , m_textEncoding(textEncoding)
Note: See TracChangeset for help on using the changeset viewer.