3 years, 10 months ago
(2017-02-23 10:12:26 UTC)
#4
Dry run: This issue passed the CQ dry run.
zino
Description was changed from ========== ServiceWorker: Factor out FetchEvent related logics from RespondWithObserver. BUG= ========== ...
3 years, 9 months ago
(2017-03-07 15:26:24 UTC)
#5
Description was changed from
==========
ServiceWorker: Factor out FetchEvent related logics from RespondWithObserver.
BUG=
==========
to
==========
ServiceWorker: Factor out FetchEvent related logics from RespondWithObserver.
To implement respondWith() in PaymentRequestEvent, it's better to factor out
the FetchEvent related logics from RespondWithObserver and then make it as
common class to share common logic between FetchEvent and PaymentRequestEvent.
This CL doesn't change any existing behavior.
See the other CLs in this series:
[1/3] This patch
[2/3] https://codereview.chromium.org/2705293010/ (blink side)
[3/3] https://codereview.chromium.org/2718013004/ (content side and test)
BUG=661608
==========
drive-by comments: https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp File third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp (left): https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp#oldcode233 third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp:233: ServiceWorkerGlobalScopeClient::from(getExecutionContext()) Could you add a virtual method ...
3 years, 9 months ago
(2017-03-08 01:39:03 UTC)
#12
drive-by comments:
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp
(left):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp:233:
ServiceWorkerGlobalScopeClient::from(getExecutionContext())
Could you add a virtual method to notify no respondWith was called and call the
method here instead of just overriding didDispatchEvent in FetchEventDispatcher?
It could be simpler for implementers to understand what they should implement.
I think the following three are the methods to return the result of respondWith:
- responseWasFulfilled
- responseWasRejected
- noRespondWithWasCalled (new one called here)
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h
(right):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h:23: //
This class observes the service worker's handling of events which have
I feel it's better to rewrite this comment to describe how to use this class.
For example;
"This is a base class to implement respondWith. The respondWith has the three
types of results: fulfilled, rejected and not called. Derived classes for each
event should implement the procedure of the three behaviors by overriding
responseWasFulfilled, responseWasRejected and ...."
nhiroki
Looks good overall. Added some comments about layering. https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp File third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp (right): https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp#newcode144 third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp:144: FetchRespondWithObserver::~FetchRespondWithObserver() ...
3 years, 9 months ago
(2017-03-08 01:49:04 UTC)
#13
Looks good overall. Added some comments about layering.
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File
third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp
(right):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp:144:
FetchRespondWithObserver::~FetchRespondWithObserver() {}
= default;
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp:175:
m_observer.clear();
Is it possible to move line 174-175 into RespondWithObserver::didDispatchEvent
and call it here? (see my comment in RespondWithObserver::didDispatchEvent)
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp
(right):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp:85:
void RespondWithObserver::didDispatchEvent(DispatchEventResult dispatchResult) {
How about removing line 86-95 like this?
void RespondWithObserver::didDispatchEvent(DispatchEventResult dispatchResult) {
m_state = Done;
m_observer.clear();
}
...then, make FetchRespondWithObserver::didDispatchEvent() call this:
void FetchRespondWithObserver::didDispatchEvent(DispatchEventResult
dispatchResult result) {
// ...
RespondWithObserver::didDiapatchEvent(result);
}
This encapsulates state management (m_state/m_observer) in RespondWithObserver
class.
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp (right):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp:167:
RespondWithObserver* respondWithObserver = FetchRespondWithObserver::create(
Can you replace RespondWithObserver* with FetchRespondWithObserver*?
It'd be better to use the concrete class name instead of the base class name as
much as possible in terms of readability and compilability. If this change
affects wide areas, a separate CL is ok.
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp File third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp (left): https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp#oldcode233 third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp:233: ServiceWorkerGlobalScopeClient::from(getExecutionContext()) On 2017/03/08 01:39:03, shimazu (slow) wrote: > Could ...
3 years, 9 months ago
(2017-03-09 04:59:00 UTC)
#15
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp
(left):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp:233:
ServiceWorkerGlobalScopeClient::from(getExecutionContext())
On 2017/03/08 01:39:03, shimazu (slow) wrote:
> Could you add a virtual method to notify no respondWith was called and call
the
> method here instead of just overriding didDispatchEvent in
FetchEventDispatcher?
>
> It could be simpler for implementers to understand what they should implement.
> I think the following three are the methods to return the result of
respondWith:
> - responseWasFulfilled
> - responseWasRejected
> - noRespondWithWasCalled (new one called here)
I like something like this. See also my comment below.
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp
(right):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp:120:
m_observer.clear();
It seems unfortunate that the subclass has to remember to call this method. It's
also weird that responseWasRejected and responseWasFulfilled have the same body.
What if there were pure virtual functions onResponseRejected(),
onResponseFulfilled(), onNoResponse() that the subclasses must implemented, that
this base class calls, and then itself does lines 118-120.
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h
(right):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h:23: //
This class observes the service worker's handling of events which have
On 2017/03/08 01:39:03, shimazu (slow) wrote:
> I feel it's better to rewrite this comment to describe how to use this class.
> For example;
>
> "This is a base class to implement respondWith. The respondWith has the three
> types of results: fulfilled, rejected and not called. Derived classes for each
> event should implement the procedure of the three behaviors by overriding
> responseWasFulfilled, responseWasRejected and ...."
+1. Is this base class ever supposed to be instantiated? If not can we make it
an abstract class?
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h:35:
WaitUntilObserver*);
Is this function used?
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h:42: //
Observes the promise and delays calling didHandle*Event() until the given
This comment may be confusing since this class doesn't have a didHandle*Event
function.
zino
The CQ bit was checked by jinho.bang@samsung.com to run a CQ dry run
3 years, 9 months ago
(2017-03-10 14:45:48 UTC)
#16
3 years, 9 months ago
(2017-03-10 16:47:53 UTC)
#19
Dry run: This issue passed the CQ dry run.
zino
Thank you for input and reviews! I addressed your comments. PTAL. https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp File third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp (right): ...
3 years, 9 months ago
(2017-03-10 17:57:18 UTC)
#20
Thank you for input and reviews!
I addressed your comments. PTAL.
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File
third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp
(right):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp:144:
FetchRespondWithObserver::~FetchRespondWithObserver() {}
On 2017/03/08 01:49:04, nhiroki (slow) wrote:
> = default;
Done.
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp:175:
m_observer.clear();
On 2017/03/08 01:49:04, nhiroki (slow) wrote:
> Is it possible to move line 174-175 into RespondWithObserver::didDispatchEvent
> and call it here? (see my comment in RespondWithObserver::didDispatchEvent)
Anyway done.
The didDispatchEvent() is no longer virtual function.
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp
(left):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp:233:
ServiceWorkerGlobalScopeClient::from(getExecutionContext())
On 2017/03/09 04:59:00, falken wrote:
> On 2017/03/08 01:39:03, shimazu (slow) wrote:
> > Could you add a virtual method to notify no respondWith was called and call
> the
> > method here instead of just overriding didDispatchEvent in
> FetchEventDispatcher?
> >
> > It could be simpler for implementers to understand what they should
implement.
>
> > I think the following three are the methods to return the result of
> respondWith:
> > - responseWasFulfilled
> > - responseWasRejected
> > - noRespondWithWasCalled (new one called here)
>
> I like something like this. See also my comment below.
Done.
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp
(right):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp:85:
void RespondWithObserver::didDispatchEvent(DispatchEventResult dispatchResult) {
On 2017/03/08 01:49:04, nhiroki (slow) wrote:
> How about removing line 86-95 like this?
>
> void RespondWithObserver::didDispatchEvent(DispatchEventResult dispatchResult)
{
> m_state = Done;
> m_observer.clear();
> }
>
> ...then, make FetchRespondWithObserver::didDispatchEvent() call this:
>
> void FetchRespondWithObserver::didDispatchEvent(DispatchEventResult
> dispatchResult result) {
> // ...
> RespondWithObserver::didDiapatchEvent(result);
> }
>
> This encapsulates state management (m_state/m_observer) in RespondWithObserver
> class.
Anyway done.
The didDispatchEvent() was removed in this class :)
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp:120:
m_observer.clear();
On 2017/03/09 04:59:00, falken wrote:
> It seems unfortunate that the subclass has to remember to call this method.
It's
> also weird that responseWasRejected and responseWasFulfilled have the same
body.
> What if there were pure virtual functions onResponseRejected(),
> onResponseFulfilled(), onNoResponse() that the subclasses must implemented,
that
> this base class calls, and then itself does lines 118-120.
Done.
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h
(right):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h:23: //
This class observes the service worker's handling of events which have
On 2017/03/09 04:59:00, falken wrote:
> On 2017/03/08 01:39:03, shimazu (slow) wrote:
> > I feel it's better to rewrite this comment to describe how to use this
class.
> > For example;
> >
> > "This is a base class to implement respondWith. The respondWith has the
three
> > types of results: fulfilled, rejected and not called. Derived classes for
each
> > event should implement the procedure of the three behaviors by overriding
> > responseWasFulfilled, responseWasRejected and ...."
>
> +1. Is this base class ever supposed to be instantiated? If not can we make it
> an abstract class?
Done.
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h:35:
WaitUntilObserver*);
On 2017/03/09 04:59:00, falken wrote:
> Is this function used?
Done.
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp (right):
https://codereview.chromium.org/2715663002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp:167:
RespondWithObserver* respondWithObserver = FetchRespondWithObserver::create(
On 2017/03/08 01:49:04, nhiroki (slow) wrote:
> Can you replace RespondWithObserver* with FetchRespondWithObserver*?
>
> It'd be better to use the concrete class name instead of the base class name
as
> much as possible in terms of readability and compilability. If this change
> affects wide areas, a separate CL is ok.
Done.
falken
lgtm https://codereview.chromium.org/2715663002/diff/40001/third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp File third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp (right): https://codereview.chromium.org/2715663002/diff/40001/third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp#newcode1 third_party/WebKit/Source/modules/serviceworkers/FetchRespondWithObserver.cpp:1: // Copyright 2017 The Chromium Authors. All rights ...
3 years, 9 months ago
(2017-03-14 07:33:20 UTC)
#21
lgtm https://codereview.chromium.org/2715663002/diff/60001/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h File third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h (right): https://codereview.chromium.org/2715663002/diff/60001/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h#newcode22 third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h:22: class FetchRespondWithObserver; This is not necessary because FetchRespondWithObserver.h ...
3 years, 9 months ago
(2017-03-14 15:10:38 UTC)
#26
Thank you for review. https://codereview.chromium.org/2715663002/diff/60001/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h File third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h (right): https://codereview.chromium.org/2715663002/diff/60001/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h#newcode22 third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h:22: class FetchRespondWithObserver; On 2017/03/14 15:10:38, ...
3 years, 9 months ago
(2017-03-14 15:56:15 UTC)
#27
CQ is committing da patch. Bot data: {"patchset_id": 80001, "attempt_start_ts": 1489506984180730, "parent_rev": "d43d808612d46fae29f53b14c9e1dc212a823e44", "commit_rev": "87bcdeadc1c7bdeb590472d36fc1458e9641274d"}
3 years, 9 months ago
(2017-03-14 18:01:53 UTC)
#31
CQ is committing da patch.
Bot data: {"patchset_id": 80001, "attempt_start_ts": 1489506984180730,
"parent_rev": "d43d808612d46fae29f53b14c9e1dc212a823e44", "commit_rev":
"87bcdeadc1c7bdeb590472d36fc1458e9641274d"}
commit-bot: I haz the power
Description was changed from ========== ServiceWorker: Factor out FetchEvent related logics from RespondWithObserver. To implement ...
3 years, 9 months ago
(2017-03-14 18:03:41 UTC)
#32
Message was sent while issue was closed.
Description was changed from
==========
ServiceWorker: Factor out FetchEvent related logics from RespondWithObserver.
To implement respondWith() in PaymentRequestEvent, it's better to factor out
the FetchEvent related logics from RespondWithObserver and then make it as
common class to share common logic between FetchEvent and PaymentRequestEvent.
This CL doesn't change any existing behavior.
See the other CLs in this series:
[1/3] This patch
[2/3] https://codereview.chromium.org/2705293010/ (blink side)
[3/3] https://codereview.chromium.org/2718013004/ (content side and test)
BUG=661608
==========
to
==========
ServiceWorker: Factor out FetchEvent related logics from RespondWithObserver.
To implement respondWith() in PaymentRequestEvent, it's better to factor out
the FetchEvent related logics from RespondWithObserver and then make it as
common class to share common logic between FetchEvent and PaymentRequestEvent.
This CL doesn't change any existing behavior.
See the other CLs in this series:
[1/3] This patch
[2/3] https://codereview.chromium.org/2705293010/ (blink side)
[3/3] https://codereview.chromium.org/2718013004/ (content side and test)
BUG=661608
Review-Url: https://codereview.chromium.org/2715663002
Cr-Commit-Position: refs/heads/master@{#456760}
Committed:
https://chromium.googlesource.com/chromium/src/+/87bcdeadc1c7bdeb590472d36fc1...
==========
commit-bot: I haz the power
Committed patchset #5 (id:80001) as https://chromium.googlesource.com/chromium/src/+/87bcdeadc1c7bdeb590472d36fc1458e9641274d
3 years, 9 months ago
(2017-03-14 18:03:42 UTC)
#33
Issue 2715663002: ServiceWorker: Factor out FetchEvent related logics from RespondWithObserver.
(Closed)
Created 3 years, 10 months ago by zino
Modified 3 years, 9 months ago
Reviewers: nhiroki, haraken, shimazu, falken
Base URL:
Comments: 27