Reland "Remove error-prone constructor: ScopedJavaGlobalWeakRef(env, jobject)"
This reverts commit 12ca279a16cc568023bc07f53655aadef18179ec.
Reason for reland: Still seeing leaks, so this wasn't the cause
Original change's description:
> Revert "Remove error-prone constructor: ScopedJavaGlobalWeakRef(env, jobject)"
>
> This reverts commit ded55b8eb2c9e5227e8983a1f44d67d6e707cd28.
>
> Reason for revert: possibly causing weak ref leaks. https://crbug.com/355975642
>
> Original change's description:
> > Remove error-prone constructor: ScopedJavaGlobalWeakRef(env, jobject)
> >
> > Updates all usages to use the const JavaRef<jobject>& constructor.
> >
> > Bug: 333398683
> > Change-Id: I9838272b76bf2dc353ba8b77f5240e841e60feea
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5648456
> > Commit-Queue: Andrew Grieve <[email protected]>
> > Reviewed-by: Sam Maier <[email protected]>
> > Owners-Override: Andrew Grieve <[email protected]>
> > Cr-Commit-Position: refs/heads/main@{#1318729}
>
> Bug: 333398683, 355975642
> Change-Id: Ib1431247182850fdca101bd32821b738fcf680d8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5767552
> Auto-Submit: Mohamed Heikal <[email protected]>
> Owners-Override: Mohamed Heikal <[email protected]>
> Commit-Queue: Mohamed Heikal <[email protected]>
> Reviewed-by: Henrique Nakashima <[email protected]>
> Commit-Queue: Henrique Nakashima <[email protected]>
> Cr-Commit-Position: refs/heads/main@{#1338128}
Bug: 333398683, 355975642
Change-Id: I506680b021740faffea3e8dd4668781377a5fd54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5825494
Owners-Override: Andrew Grieve <[email protected]>
Reviewed-by: Henrique Nakashima <[email protected]>
Commit-Queue: Henrique Nakashima <[email protected]>
Auto-Submit: Andrew Grieve <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1349414}
diff --git a/components/navigation_interception/intercept_navigation_delegate.cc b/components/navigation_interception/intercept_navigation_delegate.cc
index b08dab3..02f99bb 100644
--- a/components/navigation_interception/intercept_navigation_delegate.cc
+++ b/components/navigation_interception/intercept_navigation_delegate.cc
@@ -168,7 +168,7 @@
InterceptNavigationDelegate::InterceptNavigationDelegate(
JNIEnv* env,
- jobject jdelegate,
+ const jni_zero::JavaRef<jobject>& jdelegate,
bool escape_external_handler_value)
: weak_jdelegate_(env, jdelegate),
escape_external_handler_value_(escape_external_handler_value) {}