Details
- Reviewers
jld emilio - Commits
- rMOZILLACENTRAL6a0659188d6c: Bug 1743144 [Wayland] Implement Wayland proxy r=emilio
- Bugzilla Bug ID
- 1743144
Diff Detail
- Repository
- rMOZILLACENTRAL mozilla-central
- Build Status
Buildable 614462 Build 712662: arc lint + arc unit
Event Timeline
| widget/gtk/waylandProxy/wayland-proxy.h | ||
|---|---|---|
| 14 ↗ | (On Diff #800505) | I'd like to keep wayland-proxy as independent project and publish that on github so other Wayland project may include it too. So I've used only c++ code without any Mozilla internals and external libraries. |
I've done only a general review and haven't gotten to the nitty-gritty stuff, but I got enough comments that I think it's worth commenting.
| widget/gtk/waylandProxy/wayland-proxy.cpp | ||
|---|---|---|
| 1 ↗ | (On Diff #800505) | Did you meant to use tab-width: 20? |
| 91 ↗ | (On Diff #800505) | Shouldn't we set mFailed = true; then return false; here? |
| 160 ↗ | (On Diff #800505) | Is this just for debugging? If so should it be ifdef'd somehow? |
| 469 ↗ | (On Diff #800505) | no else after return probably. |
| 487 ↗ | (On Diff #800505) | no else after return. |
| widget/gtk/waylandProxy/wayland-proxy.h | ||
| 14 ↗ | (On Diff #800505) | Okay, that explains a lot of the choices here :) Can you make sure to document that, so that people sending patches here know that it's a bit different from the rest of the codebase? |
| 36 ↗ | (On Diff #800505) | I don't think you intend to expose this to consumers more generally, so probably just forward-declare them here and move the code to the cpp file. |
| 59 ↗ | (On Diff #800505) | nit: redundant, it's already private. |
| 103 ↗ | (On Diff #800505) | If you're using the STL, why not just returning an std::unique_ptr<WaylandProxy> here? Also it might be worth having some documentation on how is this expected to be used. Similarly, this could probably be a static std::unique_ptr<WaylandProxy> Create(); in the proxy class. |
| 105 ↗ | (On Diff #800505) | It seems these two functions could just be methods in WaylandProxy. In fact, what is the difference between WaylandProxyRunChildApplication(proxy, args) and proxy->RunChildApplication(args)? |
| 107 ↗ | (On Diff #800505) | Maybe WaylandProxySetVerbose or something would be a bit clearer. |
If this will be released on GitHub without modifications it might be worth putting it under third_party/ instead
| widget/gtk/waylandProxy/wayland-proxy.h | ||
|---|---|---|
| 14 ↗ | (On Diff #800505) | Will move it to third-party for clarity as Gabriele suggested. |
| widget/gtk/waylandProxy/wayland-proxy.cpp | ||
|---|---|---|
| 1 ↗ | (On Diff #800505) | I just copied the header from another file without modifications. I see gecko has various headers with tab-width: 2, 20, 40. |
Code analysis found 1 defect in diff 803049:
- 1 defect found by py-black (Mozlint)
You can run this analysis locally with:
- ./mach lint --warnings --outgoing
If you see a problem in this automated review, please report it here.
You can view these defects in the Diff Detail section of Phabricator diff 803049.
I think the message queue should at the very least use an std::deque. The rest of the comments are mostly nits. Looks good with that fixed from my perspective, though my socket-foo is a bit rusty / forgotten, so I can only say it looks sane.
| third_party/wayland-proxy/wayland-proxy.cpp | ||
|---|---|---|
| 80 | const probably. | |
| 81 | const | |
| 134 | Maybe we should have some sort of arena / freelist for these for performance, if heap-allocation here is hurting us. | |
| 181 | Maybe worth noting here that resize() is guaranteed to not invalidate mData, as per:
| |
| 289 | Should these be >=? I guess it's unlikely to get a 0 fd, but maybe possible if someone closes stdin / stdout / stderr? | |
| 299 | !mToApplicationQueue.empty() | |
| 306 | !mToCompositorQueue.empty() | |
| 415 | This is more expensive than it needs to be because it shifts all the elements in the vector. Let's use an std::deque instead of an std::vector? | |
| 641 | You can use auto here if you want. | |
| 645 | if (mConnections.empty()) | |
| 664 | Probably be explicit about the memory orderings here, at the very least, this should be acquire, and the = false should use release. | |
| third_party/wayland-proxy/wayland-proxy.h | ||
| 40 | More documentation on these would be nice, either here or in the cpp file. | |
| third_party/wayland-proxy/wayland-proxy.cpp | ||
|---|---|---|
| 415 | AFAIK std::deque is a kind of linked-list, right? I think it's better to just shift the pointers once here. Also from my testing FlushQueue() is not used at all as all messages are usually written in time. | |
: this fixes crashes that are not really trivial to reproduce.
| third_party/wayland-proxy/wayland-proxy.cpp | ||
|---|---|---|
| 415 | Not really, it's the equivalent to rust's VecDeque, it's an std::vector-like thing and has constant time random access, see https://en.cppreference.com/w/cpp/container/deque But sure. | |
| third_party/wayland-proxy/wayland-proxy.h | ||
| 16 | Probably remove this typedef from the header. | |
| widget/gtk/moz.build | ||
| 2 | Please fix the lint. | |