Bug 195130

Summary: Introduce ServiceWorkerFetchTask
Product: WebKit Reporter: youenn fablet <youennf>
Component: Service WorkersAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, commit-queue, dbates, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch for landing none

Description youenn fablet 2019-02-27 16:37:12 PST
Introduce ServiceWorkerFetchTask so that later on we can link it with NetworkResourceLoader.
Comment 1 youenn fablet 2019-02-27 16:43:26 PST
Created attachment 363155 [details]
Patch
Comment 2 youenn fablet 2019-02-27 17:26:22 PST
Created attachment 363164 [details]
Patch
Comment 3 youenn fablet 2019-02-27 19:07:50 PST
Created attachment 363181 [details]
Patch
Comment 4 youenn fablet 2019-02-27 19:42:48 PST
Created attachment 363184 [details]
Patch
Comment 5 youenn fablet 2019-02-28 13:26:20 PST
Created attachment 363258 [details]
Patch
Comment 6 Daniel Bates 2019-03-03 13:36:41 PST
Comment on attachment 363258 [details]
Patch

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

> Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:60
> +        inline unsigned hash() const

Inline?

> Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:62
> +            unsigned hashes[2];

Old style. New hotness is std::array.

> Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:65
> +            

Ok as-is. Empty line to rich for me. I don’t think it improves readability.

> Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:77
> +    ServiceWorkerFetchTask(PAL::SessionID sessionID, Ref<IPC::Connection>&& connection, WebCore::SWServerConnectionIdentifier connectionIdentifier, WebCore::FetchIdentifier fetchIdentifier)
> +        : m_sessionID(sessionID)
> +        , m_connection(WTFMove(connection))
> +        , m_identifier(Identifier {connectionIdentifier, fetchIdentifier})
> +    { }

Uniform initialized syntax (UIS)?

Also, you’re use of UIS is in bad taste. Put spaces after { and before }.

> Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:117
> +    typedef ServiceWorkerFetchTaskIdentifierHash Hash;

Using?

> Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:63
> +    auto fetches = WTFMove(m_ongoingFetches);

std::exchange()? Or old object left in sane state?
Comment 7 youenn fablet 2019-03-05 10:50:37 PST
Created attachment 363654 [details]
Patch
Comment 8 youenn fablet 2019-03-05 10:50:45 PST
Thanks for the review.

(In reply to Daniel Bates from comment #6)
> Comment on attachment 363258 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=363258&action=review
> 
> > Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:60
> > +        inline unsigned hash() const
> 
> Inline?

Removed.

> > Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:62
> > +            unsigned hashes[2];
> 
> Old style. New hotness is std::array.

That probably requires to have hashMemory take a std::array, otherwise this makes the code more complex.
Might be better tackled outside of this patch.

> > Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:65
> > +            
> 
> Ok as-is. Empty line to rich for me. I don’t think it improves readability.

Removed the line.

> > Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:77
> > +    ServiceWorkerFetchTask(PAL::SessionID sessionID, Ref<IPC::Connection>&& connection, WebCore::SWServerConnectionIdentifier connectionIdentifier, WebCore::FetchIdentifier fetchIdentifier)
> > +        : m_sessionID(sessionID)
> > +        , m_connection(WTFMove(connection))
> > +        , m_identifier(Identifier {connectionIdentifier, fetchIdentifier})
> > +    { }
> 
> Uniform initialized syntax (UIS)?
> 
> Also, you’re use of UIS is in bad taste. Put spaces after { and before }.

Fixed

> > Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:117
> > +    typedef ServiceWorkerFetchTaskIdentifierHash Hash;
> 
> Using?

OK

> > Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:63
> > +    auto fetches = WTFMove(m_ongoingFetches);
> 
> std::exchange()? Or old object left in sane state?

I kept WTFMove, it reads better to me and m_ongoingFetches is a map so is left in a good state.
Comment 9 Chris Dumez 2019-03-05 12:06:59 PST
Comment on attachment 363654 [details]
Patch

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

> Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:69
> +    Identifier identifier() const { return m_identifier; }

const Identifier&
Comment 10 youenn fablet 2019-03-05 12:28:26 PST
Created attachment 363669 [details]
Patch for landing
Comment 11 WebKit Commit Bot 2019-03-05 13:49:34 PST
Comment on attachment 363669 [details]
Patch for landing

Clearing flags on attachment: 363669

Committed r242503: <https://trac.webkit.org/changeset/242503>
Comment 12 WebKit Commit Bot 2019-03-05 13:49:36 PST
All reviewed patches have been landed.  Closing bug.
Comment 13 Radar WebKit Bug Importer 2019-03-05 13:50:29 PST
<rdar://problem/48612687>