[background-sync] Remove WebSyncError and SyncCallbacks
- Follow up to http://crrev.com/2473483012
- Remove WebSyncError and SyncError
- Remove SyncCallbacks and put all functionality inside BackgroundSyncProvider directly
- Remove WebSyncClient.h (file was not being used anywhere)
BUG=662134
Committed: https://crrev.com/958b47bdc79d4636041ee59a0ac7874dfca84bba
Cr-Commit-Position: refs/heads/master@{#433584}
Description was changed from
==========
Remove WebSyncError and other Blink API dependencies
- Follow up to http://crrev.com/2473483012
- "Rename" WebSyncError to SyncError (SyncError is not a purely static
class anymore)
- Replace all references to WebSyncError with SyncError
- Remove dependency to WebCallback
- Use Vector<SyncRegistrationPtr> instead of
WebVector<SyncRegistration*>
BUG=662134
==========
to
==========
- Follow up to http://crrev.com/2473483012
- "Rename" WebSyncError to SyncError (SyncError is not a purely static
class anymore)
- Replace all references to WebSyncError with SyncError
- Remove dependency to WebCallback
- Use Vector<SyncRegistrationPtr> instead of
WebVector<SyncRegistration*>
- Remove SyncCallbacks and put all functionality inside BackgroundSyncProvider
directly
BUG=662134
==========
adithyas
Description was changed from ========== - Follow up to http://crrev.com/2473483012 - "Rename" WebSyncError to SyncError ...
Description was changed from
==========
- Follow up to http://crrev.com/2473483012
- "Rename" WebSyncError to SyncError (SyncError is not a purely static
class anymore)
- Replace all references to WebSyncError with SyncError
- Remove dependency to WebCallback
- Use Vector<SyncRegistrationPtr> instead of
WebVector<SyncRegistration*>
- Remove SyncCallbacks and put all functionality inside BackgroundSyncProvider
directly
BUG=662134
==========
to
==========
- Follow up to http://crrev.com/2473483012
- "Rename" WebSyncError to SyncError (SyncError is not a purely static
class anymore)
- Replace all references to WebSyncError with SyncError
- Remove dependency to WebCallback
- Use Vector<SyncRegistrationPtr> instead of
WebVector<SyncRegistration*>
- Remove SyncCallbacks and put all functionality inside BackgroundSyncProvider
directly
- Remove WebClient.h (file was not being used anywhere)
BUG=662134
==========
adithyas
The CQ bit was checked by adithyas@chromium.org to run a CQ dry run
Dry run: Try jobs failed on following builders: android_arm64_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm64_dbg_recipe/builds/161116) linux_android_rel_ng on ...
Dry run: Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds/102914) ios-simulator on ...
4 years, 1 month ago
(2016-11-09 23:10:39 UTC)
#10
4 years, 1 month ago
(2016-11-18 16:21:35 UTC)
#14
jbroman
Description was changed from ========== - Follow up to http://crrev.com/2473483012 - "Rename" WebSyncError to SyncError ...
4 years, 1 month ago
(2016-11-18 16:42:13 UTC)
#15
Description was changed from
==========
- Follow up to http://crrev.com/2473483012
- "Rename" WebSyncError to SyncError (SyncError is not a purely static
class anymore)
- Replace all references to WebSyncError with SyncError
- Remove dependency to WebCallback
- Use Vector<SyncRegistrationPtr> instead of
WebVector<SyncRegistration*>
- Remove SyncCallbacks and put all functionality inside BackgroundSyncProvider
directly
- Remove WebClient.h (file was not being used anywhere)
BUG=662134
==========
to
==========
- Follow up to http://crrev.com/2473483012
- "Rename" WebSyncError to SyncError (SyncError is not a purely static
class anymore)
- Replace all references to WebSyncError with SyncError
- Remove dependency to WebCallback
- Use Vector<SyncRegistrationPtr> instead of
WebVector<SyncRegistration*>
- Remove SyncCallbacks and put all functionality inside BackgroundSyncProvider
directly
- Remove WebSyncClient.h (file was not being used anywhere)
BUG=662134
==========
jbroman
I think there's a little more code that can be simplified here (see comments). Otherwise, ...
4 years, 1 month ago
(2016-11-18 16:53:32 UTC)
#16
I think there's a little more code that can be simplified here (see comments).
Otherwise, (non-owner) lgtm.
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
File
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp
(right):
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp:21:
if (!resolver->getExecutionContext() ||
Here and below: ScriptPromiseResolver::resolveOrReject already checks internally
whether active DOM objects are stopped; is this necessary here (and below)?
If you do remove this check here, then this function becomes extremely short,
and it might be simpler to just inline it at its call site.
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp:59:
void BackgroundSyncProvider::onGetRegistrationsError(
If you don't take my suggestion above and remove this function, it's probably
clearer to just remove this one and rename "onRegisterError" to a more generic
name, like "onError".
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
File third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h
(right):
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:10:
#include <memory>
super-nit: I think this include was here for unique_ptr, which is no longer used
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:15:
class ScriptPromiseResolver;
nit: alphabetize these
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:32:
ScriptPromiseResolver*);
Since there's only the one implementation of Sync*Callbacks, this seems like a
reasonable simplification to make. It does bind this class fairly closely to the
interface of SyncManager. WDYT of (probably in a followup, since it changes
lifetime semantics) merging this class into SyncManager?
That way, the method that creates the promise and the one that resolves it live
in the same class, so it's easier to see at a glance what values the promise can
be resolved/rejected with.
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
File third_party/WebKit/Source/modules/background_sync/SyncError.h (right):
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/SyncError.h:14: class
SyncError {
Is this class still useful? It seems to just be a place to store a string and
enum until we immediately convert to DOMException in the same source file. It
seems to me that the onRegisterError calls could simply be:
case mojom::blink::BackgroundSyncError::STORAGE:
resolver->reject(DOMException::create(UnknownError, "Background Sync is
disabled."));
break;
and so on. WDYT?
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
4 years, 1 month ago
(2016-11-18 17:58:52 UTC)
#17
4 years, 1 month ago
(2016-11-18 17:58:53 UTC)
#18
Dry run: This issue passed the CQ dry run.
haraken
LGTM with jbroman's comments addressed.
4 years, 1 month ago
(2016-11-18 18:52:03 UTC)
#19
LGTM with jbroman's comments addressed.
adithyas
Addressed jbroman's comments https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp File third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp (right): https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp#newcode21 third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp:21: if (!resolver->getExecutionContext() || On 2016/11/18 at ...
4 years, 1 month ago
(2016-11-18 20:05:00 UTC)
#20
Addressed jbroman's comments
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
File
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp
(right):
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp:21:
if (!resolver->getExecutionContext() ||
On 2016/11/18 at 16:53:31, jbroman wrote:
> Here and below: ScriptPromiseResolver::resolveOrReject already checks
internally whether active DOM objects are stopped; is this necessary here (and
below)?
>
> If you do remove this check here, then this function becomes extremely short,
and it might be simpler to just inline it at its call site.
Yeah, it's not necessary, I'll just inline it. The old implementation of the
callbacks had the check and I just copied them over.
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
File third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h
(right):
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:10:
#include <memory>
On 2016/11/18 at 16:53:32, jbroman wrote:
> super-nit: I think this include was here for unique_ptr, which is no longer
used
Done.
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:15:
class ScriptPromiseResolver;
On 2016/11/18 at 16:53:31, jbroman wrote:
> nit: alphabetize these
Done.
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:32:
ScriptPromiseResolver*);
On 2016/11/18 at 16:53:32, jbroman wrote:
> Since there's only the one implementation of Sync*Callbacks, this seems like a
reasonable simplification to make. It does bind this class fairly closely to the
interface of SyncManager. WDYT of (probably in a followup, since it changes
lifetime semantics) merging this class into SyncManager?
>
> That way, the method that creates the promise and the one that resolves it
live in the same class, so it's easier to see at a glance what values the
promise can be resolved/rejected with.
Yup I definitely agree with that thought, both classes basically have identical
interfaces. This was something I wanted to change in this CL, but like you
mentioned, it changes lifetime semantics with BackgroundSyncProvider currently
having thread specific instances.
I also wanted to know the owners' thoughts about this before changing the
implementation.
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
File third_party/WebKit/Source/modules/background_sync/SyncError.h (right):
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/SyncError.h:14: class
SyncError {
On 2016/11/18 at 16:53:32, jbroman wrote:
> Is this class still useful? It seems to just be a place to store a string and
enum until we immediately convert to DOMException in the same source file. It
seems to me that the onRegisterError calls could simply be:
>
> case mojom::blink::BackgroundSyncError::STORAGE:
> resolver->reject(DOMException::create(UnknownError, "Background Sync is
disabled."));
> break;
>
> and so on. WDYT?
+1, I'll get rid of it. Now that I look at it again, I don't know why
SyncError::take even needs ScriptPromiseResolver as a parameter.
adithyas
The CQ bit was checked by adithyas@chromium.org to run a CQ dry run
4 years, 1 month ago
(2016-11-18 20:05:45 UTC)
#21
Still LGTM; please update CL description to correspond with the changes you've made. https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp File ...
4 years, 1 month ago
(2016-11-18 20:14:17 UTC)
#23
Still LGTM; please update CL description to correspond with the changes you've
made.
https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Sou...
File
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp
(right):
https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp:96:
for (const mojom::blink::SyncRegistrationPtr& r :
super-nit: that this line has to wrap is kinda unfortunate; it's okay to use
"const auto&" in cases like this where the type is clear:
for (const auto& registration : registrations.storage()) {
tags.append(registration->tag);
}
It's not important, but an option to keep in mind. :)
jbroman
(Oh, and also keep the first line of "Description" in sync with "Title". IIRC, only ...
4 years, 1 month ago
(2016-11-18 20:15:12 UTC)
#24
(Oh, and also keep the first line of "Description" in sync with "Title". IIRC,
only "Description" gets propagated to the git commit message, and "Title" is
purely for display in the code review UI.)
adithyas
Description was changed from ========== - Follow up to http://crrev.com/2473483012 - "Rename" WebSyncError to SyncError ...
4 years, 1 month ago
(2016-11-18 20:20:56 UTC)
#25
Description was changed from
==========
- Follow up to http://crrev.com/2473483012
- "Rename" WebSyncError to SyncError (SyncError is not a purely static
class anymore)
- Replace all references to WebSyncError with SyncError
- Remove dependency to WebCallback
- Use Vector<SyncRegistrationPtr> instead of
WebVector<SyncRegistration*>
- Remove SyncCallbacks and put all functionality inside BackgroundSyncProvider
directly
- Remove WebSyncClient.h (file was not being used anywhere)
BUG=662134
==========
to
==========
[background-sync] Remove WebSyncError and SyncCallbacks
- Follow up to http://crrev.com/2473483012
- Remove WebSyncError and SyncError
- Remove SyncCallbacks and put all functionality inside BackgroundSyncProvider
directly
- Remove WebSyncClient.h (file was not being used anywhere)
BUG=662134
==========
iclelland
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h File third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h (right): https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h#newcode32 third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:32: ScriptPromiseResolver*); On 2016/11/18 20:05:00, adithyas wrote: > On 2016/11/18 ...
4 years, 1 month ago
(2016-11-18 20:53:46 UTC)
#26
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
File third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h
(right):
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:32:
ScriptPromiseResolver*);
On 2016/11/18 20:05:00, adithyas wrote:
> On 2016/11/18 at 16:53:32, jbroman wrote:
> > Since there's only the one implementation of Sync*Callbacks, this seems like
a
> reasonable simplification to make. It does bind this class fairly closely to
the
> interface of SyncManager. WDYT of (probably in a followup, since it changes
> lifetime semantics) merging this class into SyncManager?
> >
> > That way, the method that creates the promise and the one that resolves it
> live in the same class, so it's easier to see at a glance what values the
> promise can be resolved/rejected with.
>
> Yup I definitely agree with that thought, both classes basically have
identical
> interfaces. This was something I wanted to change in this CL, but like you
> mentioned, it changes lifetime semantics with BackgroundSyncProvider currently
> having thread specific instances.
>
> I also wanted to know the owners' thoughts about this before changing the
> implementation.
The difference, I believe, is that there can be multiple SyncManagers present in
the main thread -- up to one per ServiceWorkerRegistration for the page's
origin. They all use the same BackgroundSyncProvider, though, since we only need
one IPC channel between the renderer and the browser.
https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Sou...
File third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h
(right):
https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:14:
class SyncError;
blink::SyncError isn't used in this file; do you need this declaration?
https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Sou...
File third_party/WebKit/Source/modules/background_sync/SyncManager.cpp (right):
https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/SyncManager.cpp:57:
std::move(syncRegistration), m_registration->webRegistration(), resolver);
The old SyncRegistrationCallbacks object held a reference to the service worker
registration -- I think that was so that even if this SyncManager was destroyed,
the service worker registration object would be kept alive long enough that the
provider could handle the success/failure of the register() call, and call the
JS callback function.
I haven't traced it completely through, so I may be wrong, but I'm not sure that
we still have that guarantee here.
iclelland
On deeper inspection, this lgtm :) https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Source/modules/background_sync/SyncManager.cpp File third_party/WebKit/Source/modules/background_sync/SyncManager.cpp (right): https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Source/modules/background_sync/SyncManager.cpp#newcode57 third_party/WebKit/Source/modules/background_sync/SyncManager.cpp:57: std::move(syncRegistration), m_registration->webRegistration(), resolver); ...
4 years, 1 month ago
(2016-11-18 21:22:36 UTC)
#27
On deeper inspection, this lgtm :)
https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Sou...
File third_party/WebKit/Source/modules/background_sync/SyncManager.cpp (right):
https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/SyncManager.cpp:57:
std::move(syncRegistration), m_registration->webRegistration(), resolver);
On 2016/11/18 20:53:46, iclelland wrote:
> The old SyncRegistrationCallbacks object held a reference to the service
worker
> registration -- I think that was so that even if this SyncManager was
destroyed,
> the service worker registration object would be kept alive long enough that
the
> provider could handle the success/failure of the register() call, and call the
> JS callback function.
>
> I haven't traced it completely through, so I may be wrong, but I'm not sure
that
> we still have that guarantee here.
>
>
Tracing through the git history, and the evolution of that file, it looks like
that reference was originally used so that we could pass an active
SyncRegistration object to the (JS) callback on success. That was pulled out in
crrev.com/1667623004, but we never got rid of the constructor arg.
I think that in this case, the fact that you're making the ScriptPromiseResolver
persistent is enough to make sure that the callback will run correctly, and we
don't actually need to keep the service worker registration object alive
explicitly.
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
4 years, 1 month ago
(2016-11-18 22:27:03 UTC)
#28
4 years, 1 month ago
(2016-11-18 22:27:04 UTC)
#29
Dry run: This issue passed the CQ dry run.
jbroman
My non-owner two cents on the lifetime discussion. https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h File third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h (right): https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h#newcode32 third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:32: ScriptPromiseResolver*); ...
4 years, 1 month ago
(2016-11-19 03:32:15 UTC)
#30
My non-owner two cents on the lifetime discussion.
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
File third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h
(right):
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:32:
ScriptPromiseResolver*);
On 2016/11/18 at 20:53:46, iclelland wrote:
> On 2016/11/18 20:05:00, adithyas wrote:
> > On 2016/11/18 at 16:53:32, jbroman wrote:
> > > Since there's only the one implementation of Sync*Callbacks, this seems
like a
> > reasonable simplification to make. It does bind this class fairly closely to
the
> > interface of SyncManager. WDYT of (probably in a followup, since it changes
> > lifetime semantics) merging this class into SyncManager?
> > >
> > > That way, the method that creates the promise and the one that resolves it
> > live in the same class, so it's easier to see at a glance what values the
> > promise can be resolved/rejected with.
> >
> > Yup I definitely agree with that thought, both classes basically have
identical
> > interfaces. This was something I wanted to change in this CL, but like you
> > mentioned, it changes lifetime semantics with BackgroundSyncProvider
currently
> > having thread specific instances.
> >
> > I also wanted to know the owners' thoughts about this before changing the
> > implementation.
>
> The difference, I believe, is that there can be multiple SyncManagers present
in the main thread -- up to one per ServiceWorkerRegistration for the page's
origin. They all use the same BackgroundSyncProvider, though, since we only need
one IPC channel between the renderer and the browser.
Right, that's the difference (unless there's a correctness difference I'm
missing).
Personally I'd prefer to simplify here. IIUC Mojo pipes are fairly inexpensive,
and it makes the lifetime easier to reason about without having an thread-local
object to track, as well as putting the code from JS bindings to Mojo call and
back again in one place. But you're the modules/background_sync/ owner, so it
probably matters more what you think. :)
haraken
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h File third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h (right): https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h#newcode32 third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:32: ScriptPromiseResolver*); On 2016/11/19 03:32:15, jbroman wrote: > On 2016/11/18 ...
4 years, 1 month ago
(2016-11-21 00:21:58 UTC)
#31
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
File third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h
(right):
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:32:
ScriptPromiseResolver*);
On 2016/11/19 03:32:15, jbroman wrote:
> On 2016/11/18 at 20:53:46, iclelland wrote:
> > On 2016/11/18 20:05:00, adithyas wrote:
> > > On 2016/11/18 at 16:53:32, jbroman wrote:
> > > > Since there's only the one implementation of Sync*Callbacks, this seems
> like a
> > > reasonable simplification to make. It does bind this class fairly closely
to
> the
> > > interface of SyncManager. WDYT of (probably in a followup, since it
changes
> > > lifetime semantics) merging this class into SyncManager?
> > > >
> > > > That way, the method that creates the promise and the one that resolves
it
> > > live in the same class, so it's easier to see at a glance what values the
> > > promise can be resolved/rejected with.
> > >
> > > Yup I definitely agree with that thought, both classes basically have
> identical
> > > interfaces. This was something I wanted to change in this CL, but like you
> > > mentioned, it changes lifetime semantics with BackgroundSyncProvider
> currently
> > > having thread specific instances.
> > >
> > > I also wanted to know the owners' thoughts about this before changing the
> > > implementation.
> >
> > The difference, I believe, is that there can be multiple SyncManagers
present
> in the main thread -- up to one per ServiceWorkerRegistration for the page's
> origin. They all use the same BackgroundSyncProvider, though, since we only
need
> one IPC channel between the renderer and the browser.
>
> Right, that's the difference (unless there's a correctness difference I'm
> missing).
>
> Personally I'd prefer to simplify here. IIUC Mojo pipes are fairly
inexpensive,
> and it makes the lifetime easier to reason about without having an
thread-local
> object to track, as well as putting the code from JS bindings to Mojo call and
> back again in one place. But you're the modules/background_sync/ owner, so it
> probably matters more what you think. :)
+1
dcheng
mojo changes lgtm, though I'd also be interested in seeing the simplifications (in a followup)
4 years, 1 month ago
(2016-11-21 10:06:02 UTC)
#32
mojo changes lgtm, though I'd also be interested in seeing the simplifications
(in a followup)
iclelland
On 2016/11/19 03:32:15, jbroman wrote: > My non-owner two cents on the lifetime discussion. > ...
4 years, 1 month ago
(2016-11-21 13:42:57 UTC)
#33
On 2016/11/19 03:32:15, jbroman wrote:
> My non-owner two cents on the lifetime discussion.
>
>
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
> File
third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h
> (right):
>
>
https://codereview.chromium.org/2481393002/diff/100001/third_party/WebKit/Sou...
> third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.h:32:
> ScriptPromiseResolver*);
> On 2016/11/18 at 20:53:46, iclelland wrote:
> > On 2016/11/18 20:05:00, adithyas wrote:
> > > On 2016/11/18 at 16:53:32, jbroman wrote:
> > > > Since there's only the one implementation of Sync*Callbacks, this seems
> like a
> > > reasonable simplification to make. It does bind this class fairly closely
to
> the
> > > interface of SyncManager. WDYT of (probably in a followup, since it
changes
> > > lifetime semantics) merging this class into SyncManager?
> > > >
> > > > That way, the method that creates the promise and the one that resolves
it
> > > live in the same class, so it's easier to see at a glance what values the
> > > promise can be resolved/rejected with.
> > >
> > > Yup I definitely agree with that thought, both classes basically have
> identical
> > > interfaces. This was something I wanted to change in this CL, but like you
> > > mentioned, it changes lifetime semantics with BackgroundSyncProvider
> currently
> > > having thread specific instances.
> > >
> > > I also wanted to know the owners' thoughts about this before changing the
> > > implementation.
> >
> > The difference, I believe, is that there can be multiple SyncManagers
present
> in the main thread -- up to one per ServiceWorkerRegistration for the page's
> origin. They all use the same BackgroundSyncProvider, though, since we only
need
> one IPC channel between the renderer and the browser.
>
> Right, that's the difference (unless there's a correctness difference I'm
> missing).
>
> Personally I'd prefer to simplify here. IIUC Mojo pipes are fairly
inexpensive,
> and it makes the lifetime easier to reason about without having an
thread-local
> object to track, as well as putting the code from JS bindings to Mojo call and
> back again in one place. But you're the modules/background_sync/ owner, so it
> probably matters more what you think. :)
Given that mojo connections *are* supposed to be really cheap, the
simplification is probably worth it here.
I expect that the mean number of service worker registrations explicitly used by
a given page is probably very very close to 1 (among pages which use a service
worker at all); I doubt we're seeing pages with dozens or hundreds of active
registrations, and even those are unlikely to all be using background sync :)
adithyas
https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp File third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp (right): https://codereview.chromium.org/2481393002/diff/120001/third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp#newcode96 third_party/WebKit/Source/modules/background_sync/BackgroundSyncProvider.cpp:96: for (const mojom::blink::SyncRegistrationPtr& r : On 2016/11/18 at 20:14:17, ...
4 years, 1 month ago
(2016-11-21 15:25:17 UTC)
#34
The patchset sent to the CQ was uploaded after l-g-t-m from haraken@chromium.org, dcheng@chromium.org, jbroman@chromium.org, iclelland@chromium.org ...
4 years, 1 month ago
(2016-11-21 15:26:03 UTC)
#36
CQ is committing da patch. Bot data: {"patchset_id": 160001, "attempt_start_ts": 1479741963022270, "parent_rev": "2fea1ea0e457f5913b2a7fb436a5e86ad067d3e8", "commit_rev": "5431ac40a7f48c62cbc455e6eae027b3d2e5d958"}
4 years, 1 month ago
(2016-11-21 18:03:58 UTC)
#38
CQ is committing da patch.
Bot data: {"patchset_id": 160001, "attempt_start_ts": 1479741963022270,
"parent_rev": "2fea1ea0e457f5913b2a7fb436a5e86ad067d3e8", "commit_rev":
"5431ac40a7f48c62cbc455e6eae027b3d2e5d958"}
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years, 1 month ago
(2016-11-21 18:04:32 UTC)
#39
Message was sent while issue was closed.
Committed patchset #9 (id:160001)
commit-bot: I haz the power
Description was changed from ========== [background-sync] Remove WebSyncError and SyncCallbacks - Follow up to http://crrev.com/2473483012 ...
4 years, 1 month ago
(2016-11-21 18:06:12 UTC)
#40
Message was sent while issue was closed.
Description was changed from
==========
[background-sync] Remove WebSyncError and SyncCallbacks
- Follow up to http://crrev.com/2473483012
- Remove WebSyncError and SyncError
- Remove SyncCallbacks and put all functionality inside BackgroundSyncProvider
directly
- Remove WebSyncClient.h (file was not being used anywhere)
BUG=662134
==========
to
==========
[background-sync] Remove WebSyncError and SyncCallbacks
- Follow up to http://crrev.com/2473483012
- Remove WebSyncError and SyncError
- Remove SyncCallbacks and put all functionality inside BackgroundSyncProvider
directly
- Remove WebSyncClient.h (file was not being used anywhere)
BUG=662134
Committed: https://crrev.com/958b47bdc79d4636041ee59a0ac7874dfca84bba
Cr-Commit-Position: refs/heads/master@{#433584}
==========
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/958b47bdc79d4636041ee59a0ac7874dfca84bba Cr-Commit-Position: refs/heads/master@{#433584}
4 years, 1 month ago
(2016-11-21 18:06:13 UTC)
#41
Issue 2481393002: [background-sync] Remove WebSyncError and SyncCallbacks
(Closed)
Created 4 years, 1 month ago by adithyas
Modified 4 years, 1 month ago
Reviewers: dcheng, haraken, iclelland, jbroman
Base URL:
Comments: 20