[cr145][Android] Split ObservableSupplier into Nullable / Monotonic / NonNull variants
Chromium changes: https://chromium.googlesource.com/chromium/src/+/416a61c418c152a7a7ae568d89302e5ecb6e4a3d commit 416a61c418c152a7a7ae568d89302e5ecb6e4a3d Author: Andrew Grieve <agrieve@chromium.org> Date: Tue Dec 2 14:13:59 2025 -0800 Android: Split ObservableSupplier into Nullable / Monotonic / NonNull variants The goal is to use proper @Nullable annotations with ObservableSuppliers. To achieve this, we use interfaces that define nullness: * (Settable)NullableObservableSupplier * (Settable)ObservableSupplier <-- monotonic * (Settable)NonNullObservableSupplier And we have ObservableSupplierImpl implement all of them. In order to make this migration manageable, I've marked the interfaces as @NullUnmarked, and will fix annotations in batches until they can be marked @NullMarked. This CL includes a batch in order to test out the new interfaces (and because many were necessary to make the change). Monotonic suppliers are by far the most common afaict, so that's why the non-prefixed ObservableSupplier is the monotonic one (that, and because "Monotonic" is a mouthful). One implication of this approach is that we'll never have: ObservableSupplier<@Nullable Foo> We'd have instead: NullableObservableSupplier<Foo> Having the nullness in the interface rather than in the generic allows for defining toNonNull() only on monotonic suppliers, and simplifies the implementation. Bug: 455874046 Change-Id: Id48e235b9ff16a5b21a9c1199863150d17c22736 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7206746 Commit-Queue: Andrew Grieve <agrieve@chromium.org> Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org> Owners-Override: Andrew Grieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/main@{#1553094}
This commit is contained in:
+2
-2
@@ -21,7 +21,7 @@ import androidx.recyclerview.widget.RecyclerView.OnScrollListener;
|
||||
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.base.PathUtils;
|
||||
import org.chromium.base.supplier.ObservableSupplierImpl;
|
||||
import org.chromium.base.supplier.SettableNonNullObservableSupplier;
|
||||
import org.chromium.base.task.PostTask;
|
||||
import org.chromium.base.task.TaskTraits;
|
||||
import org.chromium.chrome.R;
|
||||
@@ -68,7 +68,7 @@ class BraveBookmarkManagerMediator extends BookmarkManagerMediator
|
||||
RecyclerView recyclerView,
|
||||
DragReorderableRecyclerViewAdapter dragReorderableRecyclerViewAdapter,
|
||||
boolean isDialogUi,
|
||||
ObservableSupplierImpl<Boolean> backPressStateSupplier,
|
||||
SettableNonNullObservableSupplier<Boolean> backPressStateSupplier,
|
||||
Profile profile,
|
||||
BookmarkUndoController bookmarkUndoController,
|
||||
ModelList modelList,
|
||||
|
||||
+1
-2
@@ -13,7 +13,6 @@ import androidx.fragment.app.FragmentManager;
|
||||
import org.chromium.base.supplier.ObservableSupplier;
|
||||
import org.chromium.base.supplier.OneshotSupplier;
|
||||
import org.chromium.build.annotations.NullMarked;
|
||||
import org.chromium.build.annotations.Nullable;
|
||||
import org.chromium.chrome.browser.password_entry_edit.CredentialEditUiFactory;
|
||||
import org.chromium.chrome.browser.password_entry_edit.CredentialEntryFragmentViewBase;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
@@ -30,7 +29,7 @@ public class BraveFragmentDependencyProvider extends FragmentDependencyProvider
|
||||
Profile profile,
|
||||
OneshotSupplier<SnackbarManager> snackbarManagerSupplier,
|
||||
OneshotSupplier<BottomSheetController> bottomSheetControllerSupplier,
|
||||
ObservableSupplier<@Nullable ModalDialogManager> modalDialogManagerSupplier) {
|
||||
ObservableSupplier<ModalDialogManager> modalDialogManagerSupplier) {
|
||||
super(
|
||||
context,
|
||||
profile,
|
||||
|
||||
Reference in New Issue
Block a user