Closed
Bug 1275434
Opened 8 years ago
Closed 8 years ago
Refactor `PushNotifier` to clarify remoting
Categories
(Core :: DOM: Push Subscriptions, defect)
Core
DOM: Push Subscriptions
Tracking
()
RESOLVED
FIXED
mozilla49
Tracking | Status | |
---|---|---|
firefox49 | --- | fixed |
People
(Reporter: lina, Assigned: lina)
References
Details
(Whiteboard: btpp-active)
Attachments
(3 files)
43.45 KB,
patch
|
dragana
:
review+
|
Details | Diff | Splinter Review |
4.20 KB,
patch
|
dragana
:
review+
|
Details | Diff | Splinter Review |
6.81 KB,
patch
|
dragana
:
review+
|
Details | Diff | Splinter Review |
Currently, all `PushNotifier` methods checked the process type, and either call `Notify*{Workers, Observers}` or send an IPDL message. The message handlers then called back in to `PushNotifier` from the remote process. This was clearer when we only sent worker event notifications to the content process, and fired all observer notifications in the parent. It became more complicated once we started notifying observers for all subscriptions in both processes (bug 1266433). This makes it harder to see what's missing. For example, "push-subscription-modified" isn't currently forwarded to the child, but "push-subscription-change" and "push-message" are.
Assignee | ||
Comment 1•8 years ago
|
||
I moved the remoting code into PushNotifier::Dispatch(), and added some Dispatcher classes for the different notification types. This cleans up the duplicated e10s checks in NotifyPushWorkers and NotifySubscriptionChangeWorkers, and I think Dispatch() makes it easier to see what's called where. Dragana, please let me know if this makes sense, or if there's a better approach. In JS, I'd use functions instead of a class, but it seems like I can't pass a C++ lambda as a function pointer if it captures variables.
Attachment #8756136 -
Flags: review?(dd.mozilla)
Assignee | ||
Comment 2•8 years ago
|
||
Send "push-subscription-modified" to the child, to match "push-message" and "push-subscription-change".
Attachment #8756137 -
Flags: review?(dd.mozilla)
Comment 4•8 years ago
|
||
(In reply to Kit Cambridge [:kitcambridge] from comment #1) > Created attachment 8756136 [details] [diff] [review] > 1.patch > > I moved the remoting code into PushNotifier::Dispatch(), and added some > Dispatcher classes for the different notification types. This cleans up the > duplicated e10s checks in NotifyPushWorkers and > NotifySubscriptionChangeWorkers, and I think Dispatch() makes it easier to > see what's called where. > > Dragana, please let me know if this makes sense, or if there's a better > approach. In JS, I'd use functions instead of a class, but it seems like I > can't pass a C++ lambda as a function pointer if it captures variables. you could use function pointers, but maybe it is better this way different behaviors are grouped into separate classes.
Comment 5•8 years ago
|
||
Comment on attachment 8756136 [details] [diff] [review] 1.patch Review of attachment 8756136 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/push/PushNotifier.cpp @@ +103,5 @@ > + // At least one content process is active, so e10s must be enabled. > + // Broadcast a message to notify observers and service workers. > + bool ok = true; > + for (uint32_t i = 0; i < contentActors.Length(); ++i) { > + ok &= aDispatcher.SendToChild(contentActors[i]); use ok = ok && aDispatcher.SendToChild(contentActors[i]); The result will be the same, but logically you want && and not bitwise and (&)
Attachment #8756136 -
Flags: review?(dd.mozilla) → review+
Updated•8 years ago
|
Attachment #8756137 -
Flags: review?(dd.mozilla) → review+
Updated•8 years ago
|
Attachment #8756138 -
Flags: review?(dd.mozilla) → review+
Assignee | ||
Comment 6•8 years ago
|
||
(In reply to Dragana Damjanovic [:dragana] from comment #5) > use ok = ok && aDispatcher.SendToChild(contentActors[i]); > The result will be the same, but logically you want && and not bitwise and > (&) Oops, thanks for catching that! Changed to `NS_WARN_IF` instead, to match `SendToParent`. https://treeherder.mozilla.org/#/jobs?repo=try&revision=84b50fdfb7d2
Pushed by kcambridge@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/23080ad39e30 Refactor `PushNotifier` to clarify remoting logic. r=dragana https://hg.mozilla.org/integration/mozilla-inbound/rev/80fbbee5de1f Notify "push-subscription-modified" observers in the child. r=dragana https://hg.mozilla.org/integration/mozilla-inbound/rev/332caaad198f Add remote push observer tests. r=dragana
Comment 8•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/23080ad39e30 https://hg.mozilla.org/mozilla-central/rev/80fbbee5de1f https://hg.mozilla.org/mozilla-central/rev/332caaad198f
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox49:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in
before you can comment on or make changes to this bug.
Description
•