| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
mutable base::WeakPtrFactory<PipScreenCaptureCoordinatorProxyImpl>Is this still needed? Or is it something you anticipate we'll need to do in the future?
base::WeakPtr<PipScreenCaptureCoordinatorImpl> coordinator_;
std::optional<NativeWindowId> pip_window_id_;
scoped_refptr<base::SequencedTaskRunner> bound_sequence_task_runner_;
base::ObserverList<PipScreenCaptureCoordinatorProxy::Observer> observers_;
std::unique_ptr<UiThreadObserver, base::OnTaskRunnerDeleter>
ui_thread_observer_;You may add GUARDED_BY_CONTEXT(sequence_checker_) to the member variables for an extra layer of safety.
// `ui_thread_observer_` is automatically deleted on the UI thread via
// `OnTaskRunnerDeleter`, which will unregister the observer.Nice, I didn't know of this feature.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
mutable base::WeakPtrFactory<PipScreenCaptureCoordinatorProxyImpl>Is this still needed? Or is it something you anticipate we'll need to do in the future?
No, it's no longer needed.
base::WeakPtr<PipScreenCaptureCoordinatorImpl> coordinator_;
std::optional<NativeWindowId> pip_window_id_;
scoped_refptr<base::SequencedTaskRunner> bound_sequence_task_runner_;
base::ObserverList<PipScreenCaptureCoordinatorProxy::Observer> observers_;
std::unique_ptr<UiThreadObserver, base::OnTaskRunnerDeleter>
ui_thread_observer_;You may add GUARDED_BY_CONTEXT(sequence_checker_) to the member variables for an extra layer of safety.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
10 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: content/browser/media/capture/pip_screen_capture_coordinator_proxy_impl.h
Insertions: 11, Deletions: 9.
@@ -35,19 +35,21 @@
void SetPipWindowId(const std::optional<NativeWindowId>& new_pip_window_id);
- base::WeakPtr<PipScreenCaptureCoordinatorImpl> coordinator_;
- std::optional<NativeWindowId> pip_window_id_;
- scoped_refptr<base::SequencedTaskRunner> bound_sequence_task_runner_;
- base::ObserverList<PipScreenCaptureCoordinatorProxy::Observer> observers_;
+ base::WeakPtr<PipScreenCaptureCoordinatorImpl> coordinator_
+ GUARDED_BY_CONTEXT(sequence_checker_);
+ std::optional<NativeWindowId> pip_window_id_
+ GUARDED_BY_CONTEXT(sequence_checker_);
+ scoped_refptr<base::SequencedTaskRunner> bound_sequence_task_runner_
+ GUARDED_BY_CONTEXT(sequence_checker_);
+ base::ObserverList<PipScreenCaptureCoordinatorProxy::Observer> observers_
+ GUARDED_BY_CONTEXT(sequence_checker_);
std::unique_ptr<UiThreadObserver, base::OnTaskRunnerDeleter>
- ui_thread_observer_;
+ ui_thread_observer_ GUARDED_BY_CONTEXT(sequence_checker_);
SEQUENCE_CHECKER(sequence_checker_);
- // The weak factory is mutable to allow `GetWeakPtr()` to be called from
- // const methods.
- mutable base::WeakPtrFactory<PipScreenCaptureCoordinatorProxyImpl>
- weak_factory_{this};
+ base::WeakPtrFactory<PipScreenCaptureCoordinatorProxyImpl> weak_factory_{
+ this};
};
} // namespace content
```
Added PipScreenCaptureCoordinatorProxy for device-UI-thread coordination
This change introduces a proxy mechanism to enable cross-thread
communication for tracking Picture-in-Picture (PiP) window states. The
screen capturer, which operates on the device thread, needs to be aware
of PiP windows managed by the UI thread in order to exclude them from
screen captures.
The `PipScreenCaptureCoordinator`, which lives on the UI thread, can now
create a proxy. This proxy can be used by components on other threads,
such as the screen capturer on the device thread, to safely observe the
PiP window's ID.
In the first iteration, PiP-exclusion is implemented for macOS, so
PipScreenCaptureCoordinatorProxyImpl is initially compiled for macOS
only.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |