Support synchonizing BrowsingContext fields between IPC processes
Categories
(Core :: DOM: Core & HTML, enhancement, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox67 | --- | fixed |
People
(Reporter: farre, Assigned: farre)
References
Details
Attachments
(2 files)
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Comment 1•6 years ago
|
||
What's here:
- Transaction class
- Macros for declaring synced fields
- IPDLParamTrait for Transaction
Comment 2•6 years ago
|
||
Assignee | ||
Comment 3•6 years ago
|
||
(In reply to :Nika Layzell from comment #2)
Comment on attachment 9041439 [details] [diff] [review]
0001-wip.patchReview of attachment 9041439 [details] [diff] [review]:
::: docshell/base/BrowsingContext.h
@@ +38,5 @@class Sequence;
struct WindowPostMessageOptions;
class WindowProxyHolder;+#define FOR_EACH_SYNCED_FIELD(fn_, ...) \
what's the idea behind the ... here?
When FOR_EACH_SYNCED_FIELD expands to more fields I need to be able to handle to behaviours:
- The passed macro handles its own separator, as for the statement case.
- Interspersed separators, as for type packs and arguments
@@ +42,5 @@
+#define FOR_EACH_SYNCED_FIELD(fn_, ...) \
- fn_(Name, nsString)
+#define GETTER(name, type) const type& Get ## name () const { return m ## name ; }
+#define MEMBER(name, type, ...) type m ## name;Let's not use such generic names for these macros. These are in headers and
are at risk of conflicting with other macros.
Sure thing.
Also we can use
NAME(name)
in the other places where you writem ## name
:-)@@ +43,5 @@
- fn_(Name, nsString)
+#define GETTER(name, type) const type& Get ## name () const { return m ## name ; }
+#define MEMBER(name, type, ...) type m ## name;
+#define MAYBE_MEMBER(name, type) mozilla::Maybe< type > m ## name;Where are you using MAYBE_MEMBER?
Just above the 'private:' in Transaction.
@@ +47,5 @@
+#define MAYBE_MEMBER(name, type) mozilla::Maybe< type > m ## name;
+#define MAYBE_TYPE(_, type) mozilla::Maybe< type >
+#define NAME(name, _) m ## name
+
+#define SYNCED_FIELDS(FOR_EACH_FIELD) \You can probably skip having
FOR_EACH_FIELD
be an argument. You can just
pass inFOR_EACH_SYNCED_FIELD
.
Right.
@@ +55,5 @@
- public: \
- typedef Tuple<FOR_EACH_FIELD(MAYBE_TYPE, ,)> Type; \
- explicit Transaction(uint64_t aBrowsingContextId) \
: mBrowsingContextId(aBrowsingContextId) {} \
- NS_INLINE_DECL_REFCOUNTING(Transaction) \
Do we need this to be refcounted?
No.
@@ +56,5 @@
- typedef Tuple<FOR_EACH_FIELD(MAYBE_TYPE, ,)> Type; \
- explicit Transaction(uint64_t aBrowsingContextId) \
: mBrowsingContextId(aBrowsingContextId) {} \
- NS_INLINE_DECL_REFCOUNTING(Transaction) \
- auto Tie() { return mozilla::Tie(FOR_EACH_FIELD(NAME, , )); } \
Why the extra commas?
So, that's what the varargs in the macro is used for. Tie is variadic, and I use FOR_EACH_FIELD to intersperse commas.
Updated•6 years ago
|
Assignee | ||
Comment 4•6 years ago
|
||
Assignee | ||
Comment 5•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 8•6 years ago
|
||
bugherder |
Comment 9•6 years ago
|
||
This is awesome! \o/
Updated•6 years ago
|
Updated•6 years ago
|
Description
•