CreateBrowserWindow() Accepts a WebContents On Android [chromium/src : main]

0 views
Skip to first unread message

Aishwarya Rajesh (Gerrit)

unread,
Apr 9, 2026, 7:17:54 PMApr 9
to Jack Thiesen, Linyu He, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Jack Thiesen and Linyu He

Aishwarya Rajesh added 2 comments

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Aishwarya Rajesh . resolved

Initial comment

File chrome/browser/ui/android/multiwindow/java/src/org/chromium/chrome/browser/multiwindow/MultiInstanceOrchestrator.java
Line 54, Patchset 4 (Latest): void attachWebContentsToIntent(
Aishwarya Rajesh . unresolved

This is really creating a new window with a tab holding the specified web contents via a ReparentingTask, which is not clear from the current naming.

My thought is that something like `openWebContentsInNewWindow()` (open to better naming here) might be generally useful. It could look like this:

`openWebContentsInNewWindow(Consumer<Intent> intentDecorator, WebContents webContents, Profile profile, @NewWindowAppSource int source);` to be consistent with our other APIs.

Also on an aside, I'd really like to remove the #createNewWindowIntent() API TBH, since browser_window code is the only external caller currently that invokes this; MultiInstanceOrchestrator should ideally keep the new window intent creation package-private and expose APIs that can internally use this intent (with an optional `Consumer<Intent> intentDecorator` input that callers can use to set additional extras, flags etc.) to create new windows from tabs, links, web contents etc. - +@lin...@google.com for thoughts on this. I know this is a little tricky because of the way browser_window code is currently structured. Could we create a tracking bug to separately explore deprecating and eventually removing the #createNewWindowIntent() API in favor of completely delegating new window creation to the MIO view openNewWindow*() APIs?

Open in Gerrit

Related details

Attention is currently required from:
  • Jack Thiesen
  • Linyu He
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
Gerrit-Change-Number: 7744757
Gerrit-PatchSet: 4
Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
Gerrit-Reviewer: Aishwarya Rajesh <aishw...@google.com>
Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
Gerrit-Reviewer: Linyu He <lin...@google.com>
Gerrit-Attention: Jack Thiesen <jthi...@chromium.org>
Gerrit-Attention: Linyu He <lin...@google.com>
Gerrit-Comment-Date: Thu, 09 Apr 2026 23:17:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Calder Kitagawa (Gerrit)

unread,
Apr 10, 2026, 10:51:06 AMApr 10
to Jack Thiesen, Aishwarya Rajesh, Linyu He, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Jack Thiesen and Linyu He

Calder Kitagawa added 4 comments

File chrome/android/java/src/org/chromium/chrome/browser/multiwindow/MultiInstanceOrchestratorImpl.java
Line 144, Patchset 4 (Latest): TabDelegateFactory delegateFactory = CustomTabDelegateFactory.createEmpty();
WindowAndroid window = new WindowAndroid(context, /* occlusionTrackingAllowed= */ false);
Calder Kitagawa . resolved

These will both get replaced during reparenting so no real concern.

Line 157, Patchset 4 (Latest): android.graphics.Rect bounds = TabUtils.estimateContentSize(context);
Calder Kitagawa . unresolved

Properly import?

Line 160, Patchset 4 (Latest): webContents.setSize(width, height);
Calder Kitagawa . unresolved

I think this will get set when the tab is first foregrounded, but we can do this if it helps for some reason?

File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
Line 29, Patchset 4 (Latest): create_params.web_contents.release());
Calder Kitagawa . unresolved

If the creation fails we will leak the object, but I suppose that is somewhat unavoidable.

Open in Gerrit

Related details

Attention is currently required from:
  • Jack Thiesen
  • Linyu He
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
Gerrit-Change-Number: 7744757
Gerrit-PatchSet: 4
Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
Gerrit-Reviewer: Aishwarya Rajesh <aishw...@google.com>
Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
Gerrit-Reviewer: Linyu He <lin...@google.com>
Gerrit-Attention: Jack Thiesen <jthi...@chromium.org>
Gerrit-Attention: Linyu He <lin...@google.com>
Gerrit-Comment-Date: Fri, 10 Apr 2026 14:50:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Jack Thiesen (Gerrit)

unread,
Apr 10, 2026, 12:11:45 PMApr 10
to Calder Kitagawa, Aishwarya Rajesh, Linyu He, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Aishwarya Rajesh, Calder Kitagawa and Linyu He

Jack Thiesen added 4 comments

File chrome/android/java/src/org/chromium/chrome/browser/multiwindow/MultiInstanceOrchestratorImpl.java
Line 157, Patchset 4: android.graphics.Rect bounds = TabUtils.estimateContentSize(context);
Calder Kitagawa . resolved

Properly import?

Jack Thiesen

Done

Line 160, Patchset 4: webContents.setSize(width, height);
Calder Kitagawa . resolved

I think this will get set when the tab is first foregrounded, but we can do this if it helps for some reason?

Jack Thiesen

I copied this from [here](https://source.chromium.org/chromium/chromium/src/+/main:chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java;l=299;drc=1b064913f23efc41aefe42c7a3810da86f857d91) which says:

Resize the webContents to avoid expensive post load resize when attaching the tab.

I took this to mean "this was causing lag/jank as some point, and we triaged it to here".

File chrome/browser/ui/android/multiwindow/java/src/org/chromium/chrome/browser/multiwindow/MultiInstanceOrchestrator.java
Line 54, Patchset 4: void attachWebContentsToIntent(
Aishwarya Rajesh . resolved

This is really creating a new window with a tab holding the specified web contents via a ReparentingTask, which is not clear from the current naming.

My thought is that something like `openWebContentsInNewWindow()` (open to better naming here) might be generally useful. It could look like this:

`openWebContentsInNewWindow(Consumer<Intent> intentDecorator, WebContents webContents, Profile profile, @NewWindowAppSource int source);` to be consistent with our other APIs.

Also on an aside, I'd really like to remove the #createNewWindowIntent() API TBH, since browser_window code is the only external caller currently that invokes this; MultiInstanceOrchestrator should ideally keep the new window intent creation package-private and expose APIs that can internally use this intent (with an optional `Consumer<Intent> intentDecorator` input that callers can use to set additional extras, flags etc.) to create new windows from tabs, links, web contents etc. - +@lin...@google.com for thoughts on this. I know this is a little tricky because of the way browser_window code is currently structured. Could we create a tracking bug to separately explore deprecating and eventually removing the #createNewWindowIntent() API in favor of completely delegating new window creation to the MIO view openNewWindow*() APIs?

Jack Thiesen

We agreed offline that the naming of this function is fine.

I've created this bug crbug.com/501427239 to track the second part of this comment and I also added a TODO in `ChromeAndroidTaskTrackerImpl`.

File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
Line 29, Patchset 4: create_params.web_contents.release());
Calder Kitagawa . resolved

If the creation fails we will leak the object, but I suppose that is somewhat unavoidable.

Jack Thiesen

Yeah

Open in Gerrit

Related details

Attention is currently required from:
  • Aishwarya Rajesh
  • Calder Kitagawa
  • Linyu He
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
    Gerrit-Change-Number: 7744757
    Gerrit-PatchSet: 5
    Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
    Gerrit-Reviewer: Aishwarya Rajesh <aishw...@google.com>
    Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
    Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
    Gerrit-Reviewer: Linyu He <lin...@google.com>
    Gerrit-Attention: Aishwarya Rajesh <aishw...@google.com>
    Gerrit-Attention: Linyu He <lin...@google.com>
    Gerrit-Attention: Calder Kitagawa <ckit...@chromium.org>
    Gerrit-Comment-Date: Fri, 10 Apr 2026 16:11:36 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Aishwarya Rajesh <aishw...@google.com>
    Comment-In-Reply-To: Calder Kitagawa <ckit...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Aishwarya Rajesh (Gerrit)

    unread,
    Apr 10, 2026, 12:44:49 PMApr 10
    to Jack Thiesen, Calder Kitagawa, Linyu He, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from Calder Kitagawa, Jack Thiesen and Linyu He

    Aishwarya Rajesh added 1 comment

    File chrome/browser/ui/android/multiwindow/java/src/org/chromium/chrome/browser/multiwindow/MultiInstanceOrchestrator.java
    Line 54, Patchset 4: void attachWebContentsToIntent(
    Aishwarya Rajesh . unresolved

    This is really creating a new window with a tab holding the specified web contents via a ReparentingTask, which is not clear from the current naming.

    My thought is that something like `openWebContentsInNewWindow()` (open to better naming here) might be generally useful. It could look like this:

    `openWebContentsInNewWindow(Consumer<Intent> intentDecorator, WebContents webContents, Profile profile, @NewWindowAppSource int source);` to be consistent with our other APIs.

    Also on an aside, I'd really like to remove the #createNewWindowIntent() API TBH, since browser_window code is the only external caller currently that invokes this; MultiInstanceOrchestrator should ideally keep the new window intent creation package-private and expose APIs that can internally use this intent (with an optional `Consumer<Intent> intentDecorator` input that callers can use to set additional extras, flags etc.) to create new windows from tabs, links, web contents etc. - +@lin...@google.com for thoughts on this. I know this is a little tricky because of the way browser_window code is currently structured. Could we create a tracking bug to separately explore deprecating and eventually removing the #createNewWindowIntent() API in favor of completely delegating new window creation to the MIO view openNewWindow*() APIs?

    Jack Thiesen

    We agreed offline that the naming of this function is fine.

    I've created this bug crbug.com/501427239 to track the second part of this comment and I also added a TODO in `ChromeAndroidTaskTrackerImpl`.

    Aishwarya Rajesh

    Thanks Jack!

    I actually have a WIP CL for this cleanup here: crrev.com/c/7747418.

    Sorry for not looking closely at this earlier; I feel like instead of simply doing #setupIntent() in the new MIO API method in this CL, we should invoke #moveTabsToNewWindow() from this API, that should ideally provide the ability to create a new window from a WebContents object end to end vs only setting up the intent - which is the primary problem we're trying to move away from even with #createNewWindowIntent().

    I'd imagine this new API to be modeled around the #createNewWindow() API I'm adding in the above CL, but with an additional WebContents input. The MIO should be responsible for both creating the tab / intent as well as starting the activity.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Calder Kitagawa
    • Jack Thiesen
    • Linyu He
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
      Gerrit-Change-Number: 7744757
      Gerrit-PatchSet: 5
      Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
      Gerrit-Reviewer: Aishwarya Rajesh <aishw...@google.com>
      Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
      Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
      Gerrit-Reviewer: Linyu He <lin...@google.com>
      Gerrit-Attention: Jack Thiesen <jthi...@chromium.org>
      Gerrit-Attention: Linyu He <lin...@google.com>
      Gerrit-Attention: Calder Kitagawa <ckit...@chromium.org>
      Gerrit-Comment-Date: Fri, 10 Apr 2026 16:44:39 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Jack Thiesen <jthi...@chromium.org>
      Comment-In-Reply-To: Aishwarya Rajesh <aishw...@google.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Jack Thiesen (Gerrit)

      unread,
      Apr 14, 2026, 8:40:45 PMApr 14
      to Calder Kitagawa, Aishwarya Rajesh, Linyu He, chromiu...@luci-project-accounts.iam.gserviceaccount.com, chromium...@chromium.org
      Attention needed from Aishwarya Rajesh, Calder Kitagawa and Linyu He

      Jack Thiesen added 1 comment

      File chrome/android/java/src/org/chromium/chrome/browser/multiwindow/MultiInstanceOrchestratorImpl.java
      Line 168, Patchset 6 (Latest): ReparentingTask.from(tab).setupIntent(intent, null);
      Jack Thiesen . unresolved

      Use reparenting because this is not obvious whats gonna happen.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Aishwarya Rajesh
      • Calder Kitagawa
      • Linyu He
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
      Gerrit-Change-Number: 7744757
      Gerrit-PatchSet: 6
      Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
      Gerrit-Reviewer: Aishwarya Rajesh <aishw...@google.com>
      Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
      Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
      Gerrit-Reviewer: Linyu He <lin...@google.com>
      Gerrit-Attention: Linyu He <lin...@google.com>
      Gerrit-Attention: Calder Kitagawa <ckit...@chromium.org>
      Gerrit-Comment-Date: Wed, 15 Apr 2026 00:40:31 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Jack Thiesen (Gerrit)

      unread,
      Apr 18, 2026, 2:36:01 PM (12 days ago) Apr 18
      to Aishwarya Rajesh, Calder Kitagawa, Linyu He, Chromium LUCI CQ, chromium...@chromium.org

      Jack Thiesen added 2 comments

      File chrome/android/java/src/org/chromium/chrome/browser/multiwindow/MultiInstanceOrchestratorImpl.java
      Line 168, Patchset 6 (Latest): ReparentingTask.from(tab).setupIntent(intent, null);
      Jack Thiesen . resolved

      Use reparenting because this is not obvious whats gonna happen.

      Jack Thiesen

      Obselete

      File chrome/browser/ui/android/multiwindow/java/src/org/chromium/chrome/browser/multiwindow/MultiInstanceOrchestrator.java
      Line 54, Patchset 4: void attachWebContentsToIntent(
      Aishwarya Rajesh . resolved

      This is really creating a new window with a tab holding the specified web contents via a ReparentingTask, which is not clear from the current naming.

      My thought is that something like `openWebContentsInNewWindow()` (open to better naming here) might be generally useful. It could look like this:

      `openWebContentsInNewWindow(Consumer<Intent> intentDecorator, WebContents webContents, Profile profile, @NewWindowAppSource int source);` to be consistent with our other APIs.

      Also on an aside, I'd really like to remove the #createNewWindowIntent() API TBH, since browser_window code is the only external caller currently that invokes this; MultiInstanceOrchestrator should ideally keep the new window intent creation package-private and expose APIs that can internally use this intent (with an optional `Consumer<Intent> intentDecorator` input that callers can use to set additional extras, flags etc.) to create new windows from tabs, links, web contents etc. - +@lin...@google.com for thoughts on this. I know this is a little tricky because of the way browser_window code is currently structured. Could we create a tracking bug to separately explore deprecating and eventually removing the #createNewWindowIntent() API in favor of completely delegating new window creation to the MIO view openNewWindow*() APIs?

      Jack Thiesen

      We agreed offline that the naming of this function is fine.

      I've created this bug crbug.com/501427239 to track the second part of this comment and I also added a TODO in `ChromeAndroidTaskTrackerImpl`.

      Aishwarya Rajesh

      Thanks Jack!

      I actually have a WIP CL for this cleanup here: crrev.com/c/7747418.

      Sorry for not looking closely at this earlier; I feel like instead of simply doing #setupIntent() in the new MIO API method in this CL, we should invoke #moveTabsToNewWindow() from this API, that should ideally provide the ability to create a new window from a WebContents object end to end vs only setting up the intent - which is the primary problem we're trying to move away from even with #createNewWindowIntent().

      I'd imagine this new API to be modeled around the #createNewWindow() API I'm adding in the above CL, but with an additional WebContents input. The MIO should be responsible for both creating the tab / intent as well as starting the activity.

      Jack Thiesen

      Obselete

      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
        Gerrit-Change-Number: 7744757
        Gerrit-PatchSet: 6
        Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
        Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
        Gerrit-Reviewer: Linyu He <lin...@google.com>
        Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
        Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
        Gerrit-Comment-Date: Sat, 18 Apr 2026 18:35:49 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Jack Thiesen (Gerrit)

        unread,
        Apr 20, 2026, 10:07:11 AM (10 days ago) Apr 20
        to Aishwarya Rajesh, Calder Kitagawa, Linyu He, Chromium LUCI CQ, chromium...@chromium.org
        Attention needed from Linyu He

        New activity on the change

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Linyu He
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
        Gerrit-Change-Number: 7744757
        Gerrit-PatchSet: 9
        Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
        Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
        Gerrit-Reviewer: Linyu He <lin...@google.com>
        Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
        Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
        Gerrit-Attention: Linyu He <lin...@google.com>
        Gerrit-Comment-Date: Mon, 20 Apr 2026 14:07:05 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Linyu He (Gerrit)

        unread,
        Apr 20, 2026, 2:00:23 PM (10 days ago) Apr 20
        to Jack Thiesen, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
        Attention needed from Jack Thiesen

        Linyu He added 4 comments

        File chrome/browser/ui/browser_window/internal/BUILD.gn
        Line 234, Patchset 9: "//chrome/android:chrome_java",
        Linyu He . unresolved

        `chrome/browser/ui/browser_window/internal:java` is a modularized target, so it shouldn't depend on the top-level `//chrome/android:chrome_java` target.

        http://go/how-to-modularize-clank

        File chrome/browser/ui/browser_window/internal/android/java/src/org/chromium/chrome/browser/ui/browser_window/ChromeAndroidTaskTrackerImpl.java
        Line 344, Patchset 9: private static boolean createBrowserWindow(
        Linyu He . unresolved

        Add javadoc explaining the return value: what does `true` or `false` mean?

        Line 361, Patchset 9: private static boolean createNormalBrowserWindow(
        Linyu He . unresolved

        ditto: javadoc for the return value.

        Line 387, Patchset 9: private static boolean createPopupBrowserWindow(
        Linyu He . unresolved

        ditto: javadoc for the return value.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Jack Thiesen
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
          Gerrit-Change-Number: 7744757
          Gerrit-PatchSet: 10
          Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
          Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
          Gerrit-Reviewer: Linyu He <lin...@google.com>
          Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
          Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
          Gerrit-Attention: Jack Thiesen <jthi...@chromium.org>
          Gerrit-Comment-Date: Mon, 20 Apr 2026 18:00:15 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Jack Thiesen (Gerrit)

          unread,
          Apr 20, 2026, 2:40:11 PM (10 days ago) Apr 20
          to Aishwarya Rajesh, Calder Kitagawa, Linyu He, Chromium LUCI CQ, chromium...@chromium.org
          Attention needed from Linyu He

          Jack Thiesen added 4 comments

          File chrome/browser/ui/browser_window/internal/BUILD.gn
          Line 234, Patchset 9: "//chrome/android:chrome_java",
          Linyu He . resolved

          `chrome/browser/ui/browser_window/internal:java` is a modularized target, so it shouldn't depend on the top-level `//chrome/android:chrome_java` target.

          http://go/how-to-modularize-clank

          Jack Thiesen

          Thanks for catching this. This was carryover from previous versions of this CL.

          File chrome/browser/ui/browser_window/internal/android/java/src/org/chromium/chrome/browser/ui/browser_window/ChromeAndroidTaskTrackerImpl.java
          Line 344, Patchset 9: private static boolean createBrowserWindow(
          Linyu He . resolved

          Add javadoc explaining the return value: what does `true` or `false` mean?

          Jack Thiesen

          Done

          Line 361, Patchset 9: private static boolean createNormalBrowserWindow(
          Linyu He . resolved

          ditto: javadoc for the return value.

          Jack Thiesen

          Done

          Line 387, Patchset 9: private static boolean createPopupBrowserWindow(
          Linyu He . resolved

          ditto: javadoc for the return value.

          Jack Thiesen

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Linyu He
          Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
            Gerrit-Change-Number: 7744757
            Gerrit-PatchSet: 11
            Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
            Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
            Gerrit-Reviewer: Linyu He <lin...@google.com>
            Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
            Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
            Gerrit-Attention: Linyu He <lin...@google.com>
            Gerrit-Comment-Date: Mon, 20 Apr 2026 18:40:01 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Linyu He <lin...@google.com>
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Linyu He (Gerrit)

            unread,
            Apr 20, 2026, 3:11:01 PM (10 days ago) Apr 20
            to Jack Thiesen, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
            Attention needed from Jack Thiesen

            Linyu He added 1 comment

            File chrome/browser/ui/browser_window/test/android/java/src/org/chromium/chrome/browser/ui/browser_window/ChromeAndroidTaskUnitTestSupport.java
            Line 473, Patchset 11 (Latest): } catch (IllegalStateException e) {
            Linyu He . unresolved

            This looks like `MultiInstanceOrchestratorFactory.setInstanceForTesting()` isn't called early enough. Do we know why and can we call `setInstanceForTesting()` before the first `getInstance()`?

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Jack Thiesen
            Submit Requirements:
              • requirement satisfiedCode-Coverage
              • requirement is not satisfiedCode-Owners
              • requirement is not satisfiedCode-Review
              • requirement is not satisfiedNo-Unresolved-Comments
              • requirement is not satisfiedReview-Enforcement
              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
              Gerrit-MessageType: comment
              Gerrit-Project: chromium/src
              Gerrit-Branch: main
              Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
              Gerrit-Change-Number: 7744757
              Gerrit-PatchSet: 11
              Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
              Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
              Gerrit-Reviewer: Linyu He <lin...@google.com>
              Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
              Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
              Gerrit-Attention: Jack Thiesen <jthi...@chromium.org>
              Gerrit-Comment-Date: Mon, 20 Apr 2026 19:10:52 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              satisfied_requirement
              unsatisfied_requirement
              open
              diffy

              Aishwarya Rajesh (Gerrit)

              unread,
              Apr 20, 2026, 3:14:22 PM (10 days ago) Apr 20
              to Jack Thiesen, Calder Kitagawa, Linyu He, Chromium LUCI CQ, chromium...@chromium.org
              Attention needed from Jack Thiesen

              Aishwarya Rajesh added 1 comment

              File chrome/browser/ui/browser_window/test/android/java/src/org/chromium/chrome/browser/ui/browser_window/ChromeAndroidTaskUnitTestSupport.java
              Line 473, Patchset 11 (Latest): } catch (IllegalStateException e) {
              Linyu He . unresolved

              This looks like `MultiInstanceOrchestratorFactory.setInstanceForTesting()` isn't called early enough. Do we know why and can we call `setInstanceForTesting()` before the first `getInstance()`?

              Aishwarya Rajesh

              can we call setInstanceForTesting() before the first getInstance()

              For tests, yes I think it is okay (and recommended) to set the mock orchestrator in test setup directly

              Gerrit-Comment-Date: Mon, 20 Apr 2026 19:14:15 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Linyu He <lin...@google.com>
              satisfied_requirement
              unsatisfied_requirement
              open
              diffy

              Jack Thiesen (Gerrit)

              unread,
              Apr 20, 2026, 4:11:04 PM (10 days ago) Apr 20
              to Aishwarya Rajesh, Calder Kitagawa, Linyu He, Chromium LUCI CQ, chromium...@chromium.org
              Attention needed from Linyu He

              Jack Thiesen added 1 comment

              File chrome/browser/ui/browser_window/test/android/java/src/org/chromium/chrome/browser/ui/browser_window/ChromeAndroidTaskUnitTestSupport.java
              Line 473, Patchset 11: } catch (IllegalStateException e) {
              Linyu He . resolved

              This looks like `MultiInstanceOrchestratorFactory.setInstanceForTesting()` isn't called early enough. Do we know why and can we call `setInstanceForTesting()` before the first `getInstance()`?

              Aishwarya Rajesh

              can we call setInstanceForTesting() before the first getInstance()

              For tests, yes I think it is okay (and recommended) to set the mock orchestrator in test setup directly

              Jack Thiesen

              I updated these functions to be static.

              Open in Gerrit

              Related details

              Attention is currently required from:
              • Linyu He
              Submit Requirements:
                • requirement satisfiedCode-Coverage
                • requirement is not satisfiedCode-Owners
                • requirement is not satisfiedCode-Review
                • requirement is not satisfiedReview-Enforcement
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: comment
                Gerrit-Project: chromium/src
                Gerrit-Branch: main
                Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                Gerrit-Change-Number: 7744757
                Gerrit-PatchSet: 12
                Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                Gerrit-Reviewer: Linyu He <lin...@google.com>
                Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
                Gerrit-Attention: Linyu He <lin...@google.com>
                Gerrit-Comment-Date: Mon, 20 Apr 2026 20:10:57 +0000
                Gerrit-HasComments: Yes
                Gerrit-Has-Labels: No
                Comment-In-Reply-To: Aishwarya Rajesh <aishw...@google.com>
                Comment-In-Reply-To: Linyu He <lin...@google.com>
                satisfied_requirement
                unsatisfied_requirement
                open
                diffy

                Linyu He (Gerrit)

                unread,
                Apr 20, 2026, 4:22:17 PM (10 days ago) Apr 20
                to Jack Thiesen, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
                Attention needed from Jack Thiesen

                Linyu He voted Code-Review+1

                Code-Review+1
                Open in Gerrit

                Related details

                Attention is currently required from:
                • Jack Thiesen
                Submit Requirements:
                  • requirement satisfiedCode-Coverage
                  • requirement is not satisfiedCode-Owners
                  • requirement satisfiedCode-Review
                  • requirement satisfiedReview-Enforcement
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: chromium/src
                  Gerrit-Branch: main
                  Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                  Gerrit-Change-Number: 7744757
                  Gerrit-PatchSet: 12
                  Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                  Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                  Gerrit-Reviewer: Linyu He <lin...@google.com>
                  Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                  Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
                  Gerrit-Attention: Jack Thiesen <jthi...@chromium.org>
                  Gerrit-Comment-Date: Mon, 20 Apr 2026 20:22:07 +0000
                  Gerrit-HasComments: No
                  Gerrit-Has-Labels: Yes
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Devlin Cronin (Gerrit)

                  unread,
                  Apr 20, 2026, 4:55:46 PM (10 days ago) Apr 20
                  to Jack Thiesen, Devlin Cronin, Linyu He, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
                  Attention needed from Jack Thiesen

                  Devlin Cronin added 6 comments

                  Patchset-level comments
                  File-level comment, Patchset 12 (Latest):
                  Devlin Cronin . resolved

                  Thanks, Jack!

                  Commit Message
                  Line 21, Patchset 12 (Latest):Bug: 477944342
                  Devlin Cronin . unresolved

                  is there a reason this bug needs to be restricted?

                  File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                  Line 29, Patchset 12 (Latest): create_params.web_contents.release());
                  Devlin Cronin . unresolved

                  I'm guessing we can't pass this as a unique_ptr with std::move()?

                  If not, please add a comment about what manages the lifetime of the WebContents; as it stands, this looks like a recipe for a leak.

                  File chrome/browser/ui/browser_window/internal/android/create_browser_window_android_browsertest.cc
                  Line 308, Patchset 12 (Latest): auto* tab = tab_list_interface->GetActiveTab();
                  Devlin Cronin . unresolved

                  let's also check that there's exactly one tab (also below)

                  File chrome/browser/ui/browser_window/public/create_browser_window.h
                  Line 58, Patchset 12 (Latest): std::unique_ptr<content::WebContents> web_contents;
                  Devlin Cronin . unresolved

                  this is only supported on Android right now, right? Should we if-def this to only be on Android to make that clear and enforce it?

                  Line 15, Patchset 12 (Latest):#include "content/public/browser/web_contents.h"
                  Devlin Cronin . unresolved

                  nit: prefer a forward declaration instead of an include here

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Jack Thiesen
                  Submit Requirements:
                    • requirement satisfiedCode-Coverage
                    • requirement is not satisfiedCode-Owners
                    • requirement satisfiedCode-Review
                    • requirement is not satisfiedNo-Unresolved-Comments
                    • requirement satisfiedReview-Enforcement
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: comment
                    Gerrit-Project: chromium/src
                    Gerrit-Branch: main
                    Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                    Gerrit-Change-Number: 7744757
                    Gerrit-PatchSet: 12
                    Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                    Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                    Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                    Gerrit-Reviewer: Linyu He <lin...@google.com>
                    Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                    Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
                    Gerrit-Attention: Jack Thiesen <jthi...@chromium.org>
                    Gerrit-Comment-Date: Mon, 20 Apr 2026 20:55:36 +0000
                    Gerrit-HasComments: Yes
                    Gerrit-Has-Labels: No
                    satisfied_requirement
                    unsatisfied_requirement
                    open
                    diffy

                    Jack Thiesen (Gerrit)

                    unread,
                    Apr 20, 2026, 5:45:08 PM (10 days ago) Apr 20
                    to Devlin Cronin, Linyu He, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
                    Attention needed from Devlin Cronin

                    Jack Thiesen added 5 comments

                    Commit Message
                    Line 21, Patchset 12:Bug: 477944342
                    Devlin Cronin . resolved

                    is there a reason this bug needs to be restricted?

                    Jack Thiesen

                    Done

                    File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                    Line 29, Patchset 12: create_params.web_contents.release());
                    Devlin Cronin . resolved

                    I'm guessing we can't pass this as a unique_ptr with std::move()?

                    If not, please add a comment about what manages the lifetime of the WebContents; as it stands, this looks like a recipe for a leak.

                    Jack Thiesen

                    Done

                    File chrome/browser/ui/browser_window/internal/android/create_browser_window_android_browsertest.cc
                    Line 308, Patchset 12: auto* tab = tab_list_interface->GetActiveTab();
                    Devlin Cronin . resolved

                    let's also check that there's exactly one tab (also below)

                    Jack Thiesen

                    Done

                    File chrome/browser/ui/browser_window/public/create_browser_window.h
                    Line 58, Patchset 12: std::unique_ptr<content::WebContents> web_contents;
                    Devlin Cronin . resolved

                    this is only supported on Android right now, right? Should we if-def this to only be on Android to make that clear and enforce it?

                    Jack Thiesen

                    Done

                    Line 15, Patchset 12:#include "content/public/browser/web_contents.h"
                    Devlin Cronin . resolved

                    nit: prefer a forward declaration instead of an include here

                    Jack Thiesen

                    Ack. This fails on compilation since we are using it in a `unique_ptr`.

                    Open in Gerrit

                    Related details

                    Attention is currently required from:
                    • Devlin Cronin
                    Submit Requirements:
                      • requirement satisfiedCode-Coverage
                      • requirement is not satisfiedCode-Owners
                      • requirement satisfiedCode-Review
                      • requirement satisfiedReview-Enforcement
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: comment
                      Gerrit-Project: chromium/src
                      Gerrit-Branch: main
                      Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                      Gerrit-Change-Number: 7744757
                      Gerrit-PatchSet: 13
                      Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                      Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                      Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                      Gerrit-Reviewer: Linyu He <lin...@google.com>
                      Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                      Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
                      Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
                      Gerrit-Comment-Date: Mon, 20 Apr 2026 21:45:00 +0000
                      Gerrit-HasComments: Yes
                      Gerrit-Has-Labels: No
                      Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
                      satisfied_requirement
                      unsatisfied_requirement
                      open
                      diffy

                      Devlin Cronin (Gerrit)

                      unread,
                      Apr 20, 2026, 6:50:24 PM (10 days ago) Apr 20
                      to Jack Thiesen, Devlin Cronin, Linyu He, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
                      Attention needed from Jack Thiesen

                      Devlin Cronin voted and added 3 comments

                      Votes added by Devlin Cronin

                      Code-Review+1

                      3 comments

                      Patchset-level comments
                      File-level comment, Patchset 13 (Latest):
                      Devlin Cronin . resolved

                      LGTM % remaining comments

                      File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                      Line 29, Patchset 12: create_params.web_contents.release());
                      Devlin Cronin . unresolved

                      I'm guessing we can't pass this as a unique_ptr with std::move()?

                      If not, please add a comment about what manages the lifetime of the WebContents; as it stands, this looks like a recipe for a leak.

                      Jack Thiesen

                      Done

                      Devlin Cronin

                      This doesn't appear to have been done? (I don't see any difference between patch sets here)

                      File chrome/browser/ui/browser_window/public/create_browser_window.h
                      Line 15, Patchset 12:#include "content/public/browser/web_contents.h"
                      Devlin Cronin . unresolved

                      nit: prefer a forward declaration instead of an include here

                      Jack Thiesen

                      Ack. This fails on compilation since we are using it in a `unique_ptr`.

                      Devlin Cronin

                      chatted offline; this should be doable -- we just need to include it in the proper other files

                      Open in Gerrit

                      Related details

                      Attention is currently required from:
                      • Jack Thiesen
                      Submit Requirements:
                      • requirement satisfiedCode-Coverage
                      • requirement satisfiedCode-Owners
                      • requirement satisfiedCode-Review
                      • requirement is not satisfiedNo-Unresolved-Comments
                      • requirement satisfiedReview-Enforcement
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: comment
                      Gerrit-Project: chromium/src
                      Gerrit-Branch: main
                      Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                      Gerrit-Change-Number: 7744757
                      Gerrit-PatchSet: 13
                      Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                      Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                      Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                      Gerrit-Reviewer: Linyu He <lin...@google.com>
                      Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                      Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
                      Gerrit-Attention: Jack Thiesen <jthi...@chromium.org>
                      Gerrit-Comment-Date: Mon, 20 Apr 2026 22:50:16 +0000
                      Gerrit-HasComments: Yes
                      Gerrit-Has-Labels: Yes
                      Comment-In-Reply-To: Jack Thiesen <jthi...@chromium.org>
                      Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
                      satisfied_requirement
                      unsatisfied_requirement
                      open
                      diffy

                      Jack Thiesen (Gerrit)

                      unread,
                      Apr 20, 2026, 7:18:12 PM (10 days ago) Apr 20
                      to Devlin Cronin, Linyu He, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
                      Attention needed from Devlin Cronin and Linyu He

                      Jack Thiesen added 2 comments

                      File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                      Line 29, Patchset 12: create_params.web_contents.release());
                      Devlin Cronin . resolved

                      I'm guessing we can't pass this as a unique_ptr with std::move()?

                      If not, please add a comment about what manages the lifetime of the WebContents; as it stands, this looks like a recipe for a leak.

                      Jack Thiesen

                      Done

                      Devlin Cronin

                      This doesn't appear to have been done? (I don't see any difference between patch sets here)

                      Jack Thiesen

                      I put the requested comment in `create_browser_window.h` as a note.

                      File chrome/browser/ui/browser_window/public/create_browser_window.h
                      Line 15, Patchset 12:#include "content/public/browser/web_contents.h"
                      Devlin Cronin . resolved

                      nit: prefer a forward declaration instead of an include here

                      Jack Thiesen

                      Ack. This fails on compilation since we are using it in a `unique_ptr`.

                      Devlin Cronin

                      chatted offline; this should be doable -- we just need to include it in the proper other files

                      Jack Thiesen

                      Done

                      Open in Gerrit

                      Related details

                      Attention is currently required from:
                      • Devlin Cronin
                      • Linyu He
                      Submit Requirements:
                      • requirement satisfiedCode-Coverage
                      • requirement is not satisfiedCode-Owners
                      • requirement is not satisfiedCode-Review
                      • requirement is not satisfiedReview-Enforcement
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: comment
                      Gerrit-Project: chromium/src
                      Gerrit-Branch: main
                      Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                      Gerrit-Change-Number: 7744757
                      Gerrit-PatchSet: 14
                      Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                      Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                      Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                      Gerrit-Reviewer: Linyu He <lin...@google.com>
                      Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                      Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
                      Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
                      Gerrit-Attention: Linyu He <lin...@google.com>
                      Gerrit-Comment-Date: Mon, 20 Apr 2026 23:18:06 +0000
                      Gerrit-HasComments: Yes
                      Gerrit-Has-Labels: No
                      Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
                      Comment-In-Reply-To: Jack Thiesen <jthi...@chromium.org>
                      satisfied_requirement
                      unsatisfied_requirement
                      open
                      diffy

                      Devlin Cronin (Gerrit)

                      unread,
                      Apr 20, 2026, 8:04:38 PM (10 days ago) Apr 20
                      to Jack Thiesen, Devlin Cronin, Linyu He, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
                      Attention needed from Jack Thiesen

                      Devlin Cronin voted and added 3 comments

                      Votes added by Devlin Cronin

                      Code-Review+1

                      3 comments

                      Patchset-level comments
                      File-level comment, Patchset 14 (Latest):
                      Devlin Cronin . resolved

                      s lgtm % comments

                      File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                      Line 17, Patchset 14 (Latest):// These must be last.
                      Devlin Cronin . unresolved

                      I feel like there should be a different way to handle this, but I'll leave that up to android owners who probably know this better.

                      Line 29, Patchset 12: create_params.web_contents.release());
                      Devlin Cronin . unresolved

                      I'm guessing we can't pass this as a unique_ptr with std::move()?

                      If not, please add a comment about what manages the lifetime of the WebContents; as it stands, this looks like a recipe for a leak.

                      Jack Thiesen

                      Done

                      Devlin Cronin

                      This doesn't appear to have been done? (I don't see any difference between patch sets here)

                      Jack Thiesen

                      I put the requested comment in `create_browser_window.h` as a note.

                      Devlin Cronin

                      Please put one here, too. The `release()` here is alarming in C++-land : ) Also, the comment in create_browser_window.h just says "it's released to Java" -- but what is its lifetime? How do we ensure that it's properly destroyed before other things? (If e.g. we had a web contents that outlived its profile, that'd probably be bad)

                      Open in Gerrit

                      Related details

                      Attention is currently required from:
                      • Jack Thiesen
                      Submit Requirements:
                      • requirement satisfiedCode-Coverage
                      • requirement satisfiedCode-Owners
                      • requirement satisfiedCode-Review
                      • requirement is not satisfiedNo-Unresolved-Comments
                      • requirement satisfiedReview-Enforcement
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: comment
                      Gerrit-Project: chromium/src
                      Gerrit-Branch: main
                      Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                      Gerrit-Change-Number: 7744757
                      Gerrit-PatchSet: 14
                      Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                      Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                      Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                      Gerrit-Reviewer: Linyu He <lin...@google.com>
                      Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                      Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
                      Gerrit-Attention: Jack Thiesen <jthi...@chromium.org>
                      Gerrit-Comment-Date: Tue, 21 Apr 2026 00:04:26 +0000
                      satisfied_requirement
                      unsatisfied_requirement
                      open
                      diffy

                      Jack Thiesen (Gerrit)

                      unread,
                      Apr 20, 2026, 9:33:47 PM (10 days ago) Apr 20
                      to Devlin Cronin, Linyu He, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org

                      Jack Thiesen added 2 comments

                      File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                      Line 17, Patchset 14 (Latest):// These must be last.
                      Devlin Cronin . resolved

                      I feel like there should be a different way to handle this, but I'll leave that up to android owners who probably know this better.

                      Jack Thiesen

                      The reason why this is done is that these are declarations of files that will be automatically generated. They need the previous includes to have been declared before them or they won't know what to include themselves.

                      Line 29, Patchset 12: create_params.web_contents.release());
                      Devlin Cronin . resolved

                      I'm guessing we can't pass this as a unique_ptr with std::move()?

                      If not, please add a comment about what manages the lifetime of the WebContents; as it stands, this looks like a recipe for a leak.

                      Jack Thiesen

                      Done

                      Devlin Cronin

                      This doesn't appear to have been done? (I don't see any difference between patch sets here)

                      Jack Thiesen

                      I put the requested comment in `create_browser_window.h` as a note.

                      Devlin Cronin

                      Please put one here, too. The `release()` here is alarming in C++-land : ) Also, the comment in create_browser_window.h just says "it's released to Java" -- but what is its lifetime? How do we ensure that it's properly destroyed before other things? (If e.g. we had a web contents that outlived its profile, that'd probably be bad)

                      Jack Thiesen

                      I don't agree that a comment belongs here.

                      This call is us creating a new `AndroidBrowserWindowCreateParams` Java object whose ctor requires that we pass it a raw pointer. The new object, by accepting a raw pointer, also accepts responsibility for the lifetime of this object. That kind of contract is very common, specifically in JNI, but also in C++ land.

                      The only thing that we might be worried here is a C++ caller might not realize that the `WebContents` they passed in their `BrowserCreateParams` got invalidated and try to use it again later.

                      Open in Gerrit

                      Related details

                      Attention set is empty
                      Submit Requirements:
                        • requirement satisfiedCode-Coverage
                        • requirement satisfiedCode-Owners
                        • requirement satisfiedCode-Review
                        • requirement satisfiedReview-Enforcement
                        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                        Gerrit-MessageType: comment
                        Gerrit-Project: chromium/src
                        Gerrit-Branch: main
                        Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                        Gerrit-Change-Number: 7744757
                        Gerrit-PatchSet: 14
                        Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                        Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                        Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                        Gerrit-Reviewer: Linyu He <lin...@google.com>
                        Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                        Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
                        Gerrit-Comment-Date: Tue, 21 Apr 2026 01:33:42 +0000
                        satisfied_requirement
                        open
                        diffy

                        Jack Thiesen (Gerrit)

                        unread,
                        Apr 21, 2026, 1:32:05 AM (10 days ago) Apr 21
                        to Devlin Cronin, Linyu He, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
                        Attention needed from Devlin Cronin

                        Jack Thiesen added 1 comment

                        File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                        Line 29, Patchset 12: create_params.web_contents.release());
                        Devlin Cronin . unresolved

                        I'm guessing we can't pass this as a unique_ptr with std::move()?

                        If not, please add a comment about what manages the lifetime of the WebContents; as it stands, this looks like a recipe for a leak.

                        Jack Thiesen

                        Done

                        Devlin Cronin

                        This doesn't appear to have been done? (I don't see any difference between patch sets here)

                        Jack Thiesen

                        I put the requested comment in `create_browser_window.h` as a note.

                        Devlin Cronin

                        Please put one here, too. The `release()` here is alarming in C++-land : ) Also, the comment in create_browser_window.h just says "it's released to Java" -- but what is its lifetime? How do we ensure that it's properly destroyed before other things? (If e.g. we had a web contents that outlived its profile, that'd probably be bad)

                        Jack Thiesen

                        I don't agree that a comment belongs here.

                        This call is us creating a new `AndroidBrowserWindowCreateParams` Java object whose ctor requires that we pass it a raw pointer. The new object, by accepting a raw pointer, also accepts responsibility for the lifetime of this object. That kind of contract is very common, specifically in JNI, but also in C++ land.

                        The only thing that we might be worried here is a C++ caller might not realize that the `WebContents` they passed in their `BrowserCreateParams` got invalidated and try to use it again later.

                        Jack Thiesen

                        I added the comments and also patched what was a memory leak.

                        Open in Gerrit

                        Related details

                        Attention is currently required from:
                        • Devlin Cronin
                        Submit Requirements:
                          • requirement satisfiedCode-Coverage
                          • requirement satisfiedCode-Owners
                          • requirement is not satisfiedCode-Review
                          • requirement is not satisfiedNo-Unresolved-Comments
                          • requirement is not satisfiedReview-Enforcement
                          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                          Gerrit-MessageType: comment
                          Gerrit-Project: chromium/src
                          Gerrit-Branch: main
                          Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                          Gerrit-Change-Number: 7744757
                          Gerrit-PatchSet: 18
                          Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                          Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                          Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                          Gerrit-Reviewer: Linyu He <lin...@google.com>
                          Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                          Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
                          Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
                          Gerrit-Comment-Date: Tue, 21 Apr 2026 05:31:58 +0000
                          Gerrit-HasComments: Yes
                          Gerrit-Has-Labels: No
                          satisfied_requirement
                          unsatisfied_requirement
                          open
                          diffy

                          Devlin Cronin (Gerrit)

                          unread,
                          Apr 21, 2026, 2:20:39 PM (9 days ago) Apr 21
                          to Jack Thiesen, Devlin Cronin, Linyu He, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
                          Attention needed from Jack Thiesen and Linyu He

                          Devlin Cronin voted and added 2 comments

                          Votes added by Devlin Cronin

                          Code-Review+1

                          2 comments

                          Patchset-level comments
                          File-level comment, Patchset 21 (Latest):
                          Devlin Cronin . resolved

                          non-java lgtm

                          File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                          Line 29, Patchset 12: create_params.web_contents.release());
                          Devlin Cronin . unresolved

                          I'm guessing we can't pass this as a unique_ptr with std::move()?

                          If not, please add a comment about what manages the lifetime of the WebContents; as it stands, this looks like a recipe for a leak.

                          Jack Thiesen

                          Done

                          Devlin Cronin

                          This doesn't appear to have been done? (I don't see any difference between patch sets here)

                          Jack Thiesen

                          I put the requested comment in `create_browser_window.h` as a note.

                          Devlin Cronin

                          Please put one here, too. The `release()` here is alarming in C++-land : ) Also, the comment in create_browser_window.h just says "it's released to Java" -- but what is its lifetime? How do we ensure that it's properly destroyed before other things? (If e.g. we had a web contents that outlived its profile, that'd probably be bad)

                          Jack Thiesen

                          I don't agree that a comment belongs here.

                          This call is us creating a new `AndroidBrowserWindowCreateParams` Java object whose ctor requires that we pass it a raw pointer. The new object, by accepting a raw pointer, also accepts responsibility for the lifetime of this object. That kind of contract is very common, specifically in JNI, but also in C++ land.

                          The only thing that we might be worried here is a C++ caller might not realize that the `WebContents` they passed in their `BrowserCreateParams` got invalidated and try to use it again later.

                          Jack Thiesen

                          I added the comments and also patched what was a memory leak.

                          Devlin Cronin

                          Thanks for adding these in and fixing the leak!

                          For future reference:

                          The new object, by accepting a raw pointer, also accepts responsibility for the lifetime of this object

                          This is not at all common or guaranteed in chromium -- very, very many times, a raw pointer (either c-style or wrapped in raw_ptr) being passed into a class means that the class expects that item to _outlive_ the newly created object. As a concrete example, this is true for almost every instance of passing in a Profile* (or, on Desktop, a Browser*) to a ctor, which happens hundreds or even thousands of times in the codebase ([super naive search](https://source.chromium.org/search?q=%22raw_ptr%3CProfile%3E%22%20Profile%5C*%20f:.h$%20-f:test%20-f:out%20-f:%5Egen))

                          Open in Gerrit

                          Related details

                          Attention is currently required from:
                          • Jack Thiesen
                          • Linyu He
                          Submit Requirements:
                            • requirement satisfiedCode-Coverage
                            • requirement satisfiedCode-Owners
                            • requirement satisfiedCode-Review
                            • requirement is not satisfiedNo-Unresolved-Comments
                            • requirement satisfiedReview-Enforcement
                            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                            Gerrit-MessageType: comment
                            Gerrit-Project: chromium/src
                            Gerrit-Branch: main
                            Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                            Gerrit-Change-Number: 7744757
                            Gerrit-PatchSet: 21
                            Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                            Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                            Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                            Gerrit-Reviewer: Linyu He <lin...@google.com>
                            Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                            Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
                            Gerrit-Attention: Jack Thiesen <jthi...@chromium.org>
                            Gerrit-Attention: Linyu He <lin...@google.com>
                            Gerrit-Comment-Date: Tue, 21 Apr 2026 18:20:30 +0000
                            Gerrit-HasComments: Yes
                            Gerrit-Has-Labels: Yes
                            satisfied_requirement
                            unsatisfied_requirement
                            open
                            diffy

                            Jack Thiesen (Gerrit)

                            unread,
                            Apr 21, 2026, 2:32:02 PM (9 days ago) Apr 21
                            to Devlin Cronin, Linyu He, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
                            Attention needed from Linyu He

                            Jack Thiesen added 1 comment

                            File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                            Line 29, Patchset 12: create_params.web_contents.release());
                            Devlin Cronin . resolved

                            I'm guessing we can't pass this as a unique_ptr with std::move()?

                            If not, please add a comment about what manages the lifetime of the WebContents; as it stands, this looks like a recipe for a leak.

                            Jack Thiesen

                            Done

                            Devlin Cronin

                            This doesn't appear to have been done? (I don't see any difference between patch sets here)

                            Jack Thiesen

                            I put the requested comment in `create_browser_window.h` as a note.

                            Devlin Cronin

                            Please put one here, too. The `release()` here is alarming in C++-land : ) Also, the comment in create_browser_window.h just says "it's released to Java" -- but what is its lifetime? How do we ensure that it's properly destroyed before other things? (If e.g. we had a web contents that outlived its profile, that'd probably be bad)

                            Jack Thiesen

                            I don't agree that a comment belongs here.

                            This call is us creating a new `AndroidBrowserWindowCreateParams` Java object whose ctor requires that we pass it a raw pointer. The new object, by accepting a raw pointer, also accepts responsibility for the lifetime of this object. That kind of contract is very common, specifically in JNI, but also in C++ land.

                            The only thing that we might be worried here is a C++ caller might not realize that the `WebContents` they passed in their `BrowserCreateParams` got invalidated and try to use it again later.

                            Jack Thiesen

                            I added the comments and also patched what was a memory leak.

                            Devlin Cronin

                            Thanks for adding these in and fixing the leak!

                            For future reference:

                            The new object, by accepting a raw pointer, also accepts responsibility for the lifetime of this object

                            This is not at all common or guaranteed in chromium -- very, very many times, a raw pointer (either c-style or wrapped in raw_ptr) being passed into a class means that the class expects that item to _outlive_ the newly created object. As a concrete example, this is true for almost every instance of passing in a Profile* (or, on Desktop, a Browser*) to a ctor, which happens hundreds or even thousands of times in the codebase ([super naive search](https://source.chromium.org/search?q=%22raw_ptr%3CProfile%3E%22%20Profile%5C*%20f:.h$%20-f:test%20-f:out%20-f:%5Egen))

                            Jack Thiesen

                            Thanks!

                            Open in Gerrit

                            Related details

                            Attention is currently required from:
                            • Linyu He
                            Submit Requirements:
                              • requirement satisfiedCode-Coverage
                              • requirement satisfiedCode-Owners
                              • requirement satisfiedCode-Review
                              • requirement satisfiedReview-Enforcement
                              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                              Gerrit-MessageType: comment
                              Gerrit-Project: chromium/src
                              Gerrit-Branch: main
                              Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                              Gerrit-Change-Number: 7744757
                              Gerrit-PatchSet: 21
                              Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                              Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                              Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                              Gerrit-Reviewer: Linyu He <lin...@google.com>
                              Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                              Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
                              Gerrit-Attention: Linyu He <lin...@google.com>
                              Gerrit-Comment-Date: Tue, 21 Apr 2026 18:31:54 +0000
                              Gerrit-HasComments: Yes
                              Gerrit-Has-Labels: No
                              satisfied_requirement
                              open
                              diffy

                              Linyu He (Gerrit)

                              unread,
                              Apr 21, 2026, 4:12:57 PM (9 days ago) Apr 21
                              to Jack Thiesen, Devlin Cronin, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
                              Attention needed from Jack Thiesen

                              Linyu He added 1 comment

                              File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                              Line 36, Patchset 22 (Latest): int64_t window_ptr =
                              Java_BrowserWindowCreatorBridge_createBrowserWindow(env, j_create_params);

                              if (window_ptr != 0) {
                              // The Java Tab has taken ownership.
                              create_params.web_contents.release();
                              }
                              Linyu He . unresolved

                              Strictly speaking, this isn't correct. For the sync `CreateBrowserWindow()`, the returned `window_ptr` is like an empty shell, i.e., there is no tab or feature inside the object.

                              Do we have to support the sync `CreateBrowserWindow()` for `create_params.web_contents` right now? If not, I would suggest immediately return `nullptr` if `create_params.web_contents` is non-null.

                              Open in Gerrit

                              Related details

                              Attention is currently required from:
                              • Jack Thiesen
                              Submit Requirements:
                                • requirement satisfiedCode-Coverage
                                • requirement satisfiedCode-Owners
                                • requirement satisfiedCode-Review
                                • requirement is not satisfiedNo-Unresolved-Comments
                                • requirement satisfiedReview-Enforcement
                                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                                Gerrit-MessageType: comment
                                Gerrit-Project: chromium/src
                                Gerrit-Branch: main
                                Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                                Gerrit-Change-Number: 7744757
                                Gerrit-PatchSet: 22
                                Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                                Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                                Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                                Gerrit-Reviewer: Linyu He <lin...@google.com>
                                Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                                Gerrit-CC: Calder Kitagawa <ckit...@chromium.org>
                                Gerrit-Attention: Jack Thiesen <jthi...@chromium.org>
                                Gerrit-Comment-Date: Tue, 21 Apr 2026 20:12:46 +0000
                                Gerrit-HasComments: Yes
                                Gerrit-Has-Labels: No
                                satisfied_requirement
                                unsatisfied_requirement
                                open
                                diffy

                                Linyu He (Gerrit)

                                unread,
                                Apr 21, 2026, 4:23:25 PM (9 days ago) Apr 21
                                to Jack Thiesen, Devlin Cronin, Aishwarya Rajesh, Calder Kitagawa, Chromium LUCI CQ, chromium...@chromium.org
                                Attention needed from Jack Thiesen

                                Linyu He voted and added 1 comment

                                Votes added by Linyu He

                                Code-Review+1

                                1 comment

                                File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                                Line 36, Patchset 22 (Latest): int64_t window_ptr =
                                Java_BrowserWindowCreatorBridge_createBrowserWindow(env, j_create_params);

                                if (window_ptr != 0) {
                                // The Java Tab has taken ownership.
                                create_params.web_contents.release();
                                }
                                Linyu He . unresolved

                                Strictly speaking, this isn't correct. For the sync `CreateBrowserWindow()`, the returned `window_ptr` is like an empty shell, i.e., there is no tab or feature inside the object.

                                Do we have to support the sync `CreateBrowserWindow()` for `create_params.web_contents` right now? If not, I would suggest immediately return `nullptr` if `create_params.web_contents` is non-null.

                                Linyu He

                                Chatted offline; so there is something in Java that holds `create_params.web_contents`, but it's not a tab as described at Line 40.

                                We should clarify the comment.

                                Gerrit-Comment-Date: Tue, 21 Apr 2026 20:23:18 +0000
                                Gerrit-HasComments: Yes
                                Gerrit-Has-Labels: Yes
                                Comment-In-Reply-To: Linyu He <lin...@google.com>
                                satisfied_requirement
                                unsatisfied_requirement
                                open
                                diffy

                                Calder Kitagawa (Gerrit)

                                unread,
                                Apr 21, 2026, 4:33:24 PM (9 days ago) Apr 21
                                to Jack Thiesen, Linyu He, Devlin Cronin, Aishwarya Rajesh, Chromium LUCI CQ, chromium...@chromium.org
                                Attention needed from Jack Thiesen

                                Calder Kitagawa voted and added 2 comments

                                Votes added by Calder Kitagawa

                                Code-Review+1

                                2 comments

                                File chrome/browser/ui/browser_window/internal/android/java/src/org/chromium/chrome/browser/ui/browser_window/AndroidBrowserWindowCreateParamsImpl.java
                                Line 27, Patchset 22 (Latest): private final @Nullable WebContents mWebContents;
                                Calder Kitagawa . unresolved

                                This java WebContent's will own the pointer to the C++ WebContents.

                                We do need to make sure that this `AndroidBrowserWindowCreateParamsImpl` always is consumed or if not it needs to destroy the `mWebContents` as it is the explicit owner of that object now.

                                In response to https://chromium-review.git.corp.google.com/c/chromium/src/+/7744757/comment/010eccdd_7b4a3367/

                                File chrome/browser/ui/browser_window/internal/android/java/src/org/chromium/chrome/browser/ui/browser_window/ChromeAndroidTaskTrackerImpl.java
                                Line 386, Patchset 22 (Latest): .createNewWindowFromWebContents(
                                Calder Kitagawa . unresolved

                                We should probably metion on the Javadoc for this method and createNewPopupFromWebContents that these take ownership of the WebContents.

                                Open in Gerrit

                                Related details

                                Attention is currently required from:
                                • Jack Thiesen
                                Submit Requirements:
                                • requirement satisfiedCode-Coverage
                                • requirement satisfiedCode-Owners
                                • requirement satisfiedCode-Review
                                • requirement is not satisfiedNo-Unresolved-Comments
                                • requirement satisfiedReview-Enforcement
                                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                                Gerrit-MessageType: comment
                                Gerrit-Project: chromium/src
                                Gerrit-Branch: main
                                Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                                Gerrit-Change-Number: 7744757
                                Gerrit-PatchSet: 22
                                Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                                Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
                                Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                                Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                                Gerrit-Reviewer: Linyu He <lin...@google.com>
                                Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                                Gerrit-Attention: Jack Thiesen <jthi...@chromium.org>
                                Gerrit-Comment-Date: Tue, 21 Apr 2026 20:33:15 +0000
                                Gerrit-HasComments: Yes
                                Gerrit-Has-Labels: Yes
                                satisfied_requirement
                                unsatisfied_requirement
                                open
                                diffy

                                Jack Thiesen (Gerrit)

                                unread,
                                Apr 21, 2026, 4:50:13 PM (9 days ago) Apr 21
                                to Calder Kitagawa, Linyu He, Devlin Cronin, Aishwarya Rajesh, Chromium LUCI CQ, chromium...@chromium.org

                                Jack Thiesen added 3 comments

                                File chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                                Line 36, Patchset 22: int64_t window_ptr =

                                Java_BrowserWindowCreatorBridge_createBrowserWindow(env, j_create_params);

                                if (window_ptr != 0) {
                                // The Java Tab has taken ownership.
                                create_params.web_contents.release();
                                }
                                Linyu He . resolved

                                Strictly speaking, this isn't correct. For the sync `CreateBrowserWindow()`, the returned `window_ptr` is like an empty shell, i.e., there is no tab or feature inside the object.

                                Do we have to support the sync `CreateBrowserWindow()` for `create_params.web_contents` right now? If not, I would suggest immediately return `nullptr` if `create_params.web_contents` is non-null.

                                Linyu He

                                Chatted offline; so there is something in Java that holds `create_params.web_contents`, but it's not a tab as described at Line 40.

                                We should clarify the comment.

                                Jack Thiesen

                                Done

                                File chrome/browser/ui/browser_window/internal/android/java/src/org/chromium/chrome/browser/ui/browser_window/AndroidBrowserWindowCreateParamsImpl.java
                                Line 27, Patchset 22: private final @Nullable WebContents mWebContents;
                                Calder Kitagawa . resolved

                                This java WebContent's will own the pointer to the C++ WebContents.

                                We do need to make sure that this `AndroidBrowserWindowCreateParamsImpl` always is consumed or if not it needs to destroy the `mWebContents` as it is the explicit owner of that object now.

                                In response to https://chromium-review.git.corp.google.com/c/chromium/src/+/7744757/comment/010eccdd_7b4a3367/

                                Jack Thiesen

                                Marked as resolved.

                                File chrome/browser/ui/browser_window/internal/android/java/src/org/chromium/chrome/browser/ui/browser_window/ChromeAndroidTaskTrackerImpl.java
                                Line 386, Patchset 22: .createNewWindowFromWebContents(
                                Calder Kitagawa . resolved

                                We should probably metion on the Javadoc for this method and createNewPopupFromWebContents that these take ownership of the WebContents.

                                Jack Thiesen

                                I will add this in a followup.

                                Open in Gerrit

                                Related details

                                Attention set is empty
                                Submit Requirements:
                                  • requirement satisfiedCode-Coverage
                                  • requirement satisfiedCode-Owners
                                  • requirement satisfiedCode-Review
                                  • requirement satisfiedReview-Enforcement
                                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                                  Gerrit-MessageType: comment
                                  Gerrit-Project: chromium/src
                                  Gerrit-Branch: main
                                  Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                                  Gerrit-Change-Number: 7744757
                                  Gerrit-PatchSet: 23
                                  Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                                  Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
                                  Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                                  Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                                  Gerrit-Reviewer: Linyu He <lin...@google.com>
                                  Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                                  Gerrit-Comment-Date: Tue, 21 Apr 2026 20:50:04 +0000
                                  Gerrit-HasComments: Yes
                                  Gerrit-Has-Labels: No
                                  Comment-In-Reply-To: Linyu He <lin...@google.com>
                                  Comment-In-Reply-To: Calder Kitagawa <ckit...@chromium.org>
                                  satisfied_requirement
                                  open
                                  diffy

                                  Jack Thiesen (Gerrit)

                                  unread,
                                  Apr 21, 2026, 4:50:28 PM (9 days ago) Apr 21
                                  to Calder Kitagawa, Linyu He, Devlin Cronin, Aishwarya Rajesh, Chromium LUCI CQ, chromium...@chromium.org

                                  Jack Thiesen voted Commit-Queue+2

                                  Commit-Queue+2
                                  Open in Gerrit

                                  Related details

                                  Attention set is empty
                                  Submit Requirements:
                                  • requirement satisfiedCode-Coverage
                                  • requirement satisfiedCode-Owners
                                  • requirement satisfiedCode-Review
                                  • requirement satisfiedReview-Enforcement
                                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                                  Gerrit-MessageType: comment
                                  Gerrit-Project: chromium/src
                                  Gerrit-Branch: main
                                  Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                                  Gerrit-Change-Number: 7744757
                                  Gerrit-PatchSet: 23
                                  Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                                  Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
                                  Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                                  Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                                  Gerrit-Reviewer: Linyu He <lin...@google.com>
                                  Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                                  Gerrit-Comment-Date: Tue, 21 Apr 2026 20:50:19 +0000
                                  Gerrit-HasComments: No
                                  Gerrit-Has-Labels: Yes
                                  satisfied_requirement
                                  open
                                  diffy

                                  Chromium LUCI CQ (Gerrit)

                                  unread,
                                  Apr 21, 2026, 6:08:18 PM (9 days ago) Apr 21
                                  to Jack Thiesen, Calder Kitagawa, Linyu He, Devlin Cronin, Aishwarya Rajesh, chromium...@chromium.org

                                  Chromium LUCI CQ submitted the change with unreviewed changes

                                  Unreviewed changes

                                  22 is the latest approved patch-set.
                                  The change was submitted with unreviewed changes in the following files:

                                  ```
                                  The name of the file: chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                                  Insertions: 8, Deletions: 6.

                                  @@ -23,8 +23,8 @@
                                  JNIEnv* env = base::android::AttachCurrentThread();
                                  const gfx::Rect& bounds = create_params.initial_bounds;

                                  - // Ownership of the WebContents is retained in C++ until the window creation
                                  - // is successful.
                                  + // This code is still responsible for the WebContents until it receives a
                                  + // signal that the window creation is possible.
                                  base::android::ScopedJavaLocalRef<jobject> j_create_params =
                                  Java_AndroidBrowserWindowCreateParamsImpl_create(
                                  env, static_cast<int>(create_params.type),
                                  @@ -37,7 +37,8 @@

                                  Java_BrowserWindowCreatorBridge_createBrowserWindow(env, j_create_params);

                                  if (window_ptr != 0) {
                                  -    // The Java Tab has taken ownership.
                                  + // Java has created a detached Tab which has assumed ownership of this
                                  + // WebContents (and is being reparented asynchronously).
                                  create_params.web_contents.release();
                                  }

                                  @@ -50,8 +51,8 @@
                                  JNIEnv* env = base::android::AttachCurrentThread();
                                  const gfx::Rect& bounds = create_params.initial_bounds;

                                  - // Ownership of the WebContents is retained in C++ until the window creation
                                  - // is successful.
                                  + // This code is still responsible for the WebContents until it receives a
                                  + // signal that the window creation is possible.
                                  base::android::ScopedJavaLocalRef<jobject> j_create_params =
                                  Java_AndroidBrowserWindowCreateParamsImpl_create(
                                  env, static_cast<int>(create_params.type),
                                  @@ -66,7 +67,8 @@
                                  [](base::OnceCallback<void(BrowserWindowInterface*)> cb,
                                  std::unique_ptr<content::WebContents> web_contents, int64_t ptr) {
                                  if (ptr != 0) {
                                  - // Java will assume ownership of this WebContents.
                                  + // Java has created a detached Tab which has assumed ownership of this
                                  + // WebContents (and is being reparented asynchronously).
                                  web_contents.release();
                                  }
                                  std::move(cb).Run(reinterpret_cast<BrowserWindowInterface*>(ptr));
                                  ```

                                  Change information

                                  Commit message:
                                  CreateBrowserWindow() Accepts a WebContents On Android

                                  Sometimes a new browser window should be created using an existing
                                  WebContents as its first tab. This change enables Android to handle such
                                  a call from the C++. This is accomplished by:

                                  1. Updating the BrowserWindowCreateParams to hold the WebContents
                                  2. Calling the MultiInstanceOrchestrator or PopupCreator to handle
                                  creating a new window/popup using the provided WebContents.

                                  This change also patches a silent failure inside of
                                  ChromeAndroidTaskTrackerImpl#createPendingTask() where the callback
                                  might never receive a signal. Browser testing is included.
                                  Bug: 477944342
                                  Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                                  Reviewed-by: Devlin Cronin <rdevlin...@chromium.org>
                                  Reviewed-by: Calder Kitagawa <ckit...@chromium.org>
                                  Reviewed-by: Linyu He <lin...@google.com>
                                  Commit-Queue: Jack Thiesen <jthi...@chromium.org>
                                  Cr-Commit-Position: refs/heads/main@{#1618474}
                                  Files:
                                  • M chrome/browser/ui/browser_window/internal/BUILD.gn
                                  • M chrome/browser/ui/browser_window/internal/android/create_browser_window_android.cc
                                  • M chrome/browser/ui/browser_window/internal/android/create_browser_window_android_browsertest.cc
                                  • M chrome/browser/ui/browser_window/internal/android/java/src/org/chromium/chrome/browser/ui/browser_window/AndroidBrowserWindowCreateParamsImpl.java
                                  • M chrome/browser/ui/browser_window/internal/android/java/src/org/chromium/chrome/browser/ui/browser_window/AndroidBrowserWindowCreateParamsImplUnitTest.java
                                  • M chrome/browser/ui/browser_window/internal/android/java/src/org/chromium/chrome/browser/ui/browser_window/ChromeAndroidTaskIntegrationTest.java
                                  • M chrome/browser/ui/browser_window/internal/android/java/src/org/chromium/chrome/browser/ui/browser_window/ChromeAndroidTaskTrackerImpl.java
                                  • M chrome/browser/ui/browser_window/internal/android/java/src/org/chromium/chrome/browser/ui/browser_window/ChromeAndroidTaskTrackerImplUnitTest.java
                                  • M chrome/browser/ui/browser_window/internal/create_browser_window.cc
                                  • M chrome/browser/ui/browser_window/public/android/BUILD.gn
                                  • M chrome/browser/ui/browser_window/public/android/java/src/org/chromium/chrome/browser/ui/browser_window/AndroidBrowserWindowCreateParams.java
                                  • M chrome/browser/ui/browser_window/public/create_browser_window.h
                                  • M chrome/browser/ui/browser_window/test/BUILD.gn
                                  • M chrome/browser/ui/browser_window/test/android/java/src/org/chromium/chrome/browser/ui/browser_window/ChromeAndroidTaskUnitTestSupport.java
                                  Change size: L
                                  Delta: 14 files changed, 327 insertions(+), 36 deletions(-)
                                  Branch: refs/heads/main
                                  Submit Requirements:
                                  • requirement satisfiedCode-Review: +1 by Calder Kitagawa, +1 by Linyu He, +1 by Devlin Cronin
                                  Open in Gerrit
                                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                                  Gerrit-MessageType: merged
                                  Gerrit-Project: chromium/src
                                  Gerrit-Branch: main
                                  Gerrit-Change-Id: I874fc2ab3de171107e74d1c5e4a16e3918c1e7b3
                                  Gerrit-Change-Number: 7744757
                                  Gerrit-PatchSet: 24
                                  Gerrit-Owner: Jack Thiesen <jthi...@chromium.org>
                                  Gerrit-Reviewer: Calder Kitagawa <ckit...@chromium.org>
                                  Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
                                  Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
                                  Gerrit-Reviewer: Jack Thiesen <jthi...@chromium.org>
                                  Gerrit-Reviewer: Linyu He <lin...@google.com>
                                  Gerrit-CC: Aishwarya Rajesh <aishw...@google.com>
                                  open
                                  diffy
                                  satisfied_requirement
                                  Reply all
                                  Reply to author
                                  Forward
                                  0 new messages