Bug 1999999 - Implement per-tab MediaControlKeyManager - #1
Conversation
168c5bb to
4911c90
Compare
There was a problem hiding this comment.
Pull Request Overview
This pull request implements per-tab MPRIS (Media Player Remote Interfacing Specification) support for Firefox on GTK/Linux. Instead of having a single global media control service, each browser tab with media content gets its own MPRIS instance with unique service names and track paths.
- Refactored MediaControlKeyManager to be tab-specific with instance and tab IDs
- Modified MPRISServiceHandler to create unique DBus connections per tab
- Replaced global media control key manager with per-tab managers stored in a map
- Updated media control routing to direct actions to specific tab controllers
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| widget/gtk/MediaKeysEventSourceFactory.cpp | Updated factory function signature to accept instanceId and tabId parameters |
| widget/gtk/MPRISServiceHandler.h | Added member variables for instance/tab tracking and removed service name setting method |
| widget/gtk/MPRISServiceHandler.cpp | Replaced shared bus connection with per-instance connections and simplified service identity generation |
| widget/MediaKeysEventSourceFactory.h | Added conditional compilation for GTK-specific factory signature with IDs |
| dom/media/mediacontrol/MediaControlService.h | Replaced global key manager with per-tab manager map and made notification methods no-ops |
| dom/media/mediacontrol/MediaControlService.cpp | Implemented per-tab manager lifecycle in register/unregister and GetControllerByTabId lookup |
| dom/media/mediacontrol/MediaControlKeyManager.h | Added tab/instance ID members and GetTabController method |
| dom/media/mediacontrol/MediaControlKeyManager.cpp | Updated constructor and routing logic to dispatch actions directly to tab controllers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (3)
widget/gtk/MPRISServiceHandler.cpp:281
- The OnNameAcquired method assigns the GDBusConnection pointer without incrementing its reference count. This is inconsistent with the SetConnection method which properly manages reference counting. Either use SetConnection here or add g_object_ref to maintain consistent ownership semantics.
void MPRISServiceHandler::OnNameAcquired(GDBusConnection* aConnection,
const gchar* aName) {
LOGMPRIS("OnNameAcquired: %s", aName);
mConnection = aConnection;
}
widget/gtk/MPRISServiceHandler.cpp:1
- The function name should be std::fmin for C++, but the correct function for double types is std::min in C++. std::fmin is the C math library function. Use std::min from instead for better C++ compatibility and type safety.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
widget/gtk/MPRISServiceHandler.cpp:1
- The function name should be std::fmin for C++, but the correct function for double types is std::min in C++. std::fmin is the C math library function. Use std::min from instead for better C++ compatibility and type safety.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
widget/gtk/MPRISServiceHandler.cpp:280
- The
OnNameAcquiredmethod assignsaConnectiontomConnectionwithout incrementing its reference count. This is inconsistent withSetConnectionwhich properly manages reference counting withg_object_ref. SinceOnNameAcquiredis called by GLib's bus ownership mechanism and the connection lifetime is managed externally, this could lead to use-after-free issues. Consider usingSetConnection(aConnection)instead of direct assignment, or addg_object_ref(aConnection)before the assignment.
mConnection = aConnection;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9cab43a to
1b4424e
Compare
1b4424e to
412501a
Compare
No description provided.