[CI] Restructure SVGResourcesCycleSolver [chromium/src : master]

3 views
Skip to first unread message

Fredrik Söderquist (Gerrit)

unread,
Mar 16, 2018, 4:58:12 PM3/16/18
to blink-revi...@chromium.org, blink-...@chromium.org, eae+bli...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+renderi...@chromium.org, pdr+svgw...@chromium.org, szager+la...@chromium.org, zol...@webkit.org, Stephen Chenney, Philip Rogers, Commit Bot, chromium...@chromium.org, Dirk Schulze, Gyuyoung Kim, Rob Buis

This change is ready for review.

View Change

    To view, visit change 966661. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: master
    Gerrit-Change-Id: Icd8200a2cd9073487479e32827a9fdeb1d8d04c4
    Gerrit-Change-Number: 966661
    Gerrit-PatchSet: 1
    Gerrit-Owner: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Commit Bot <commi...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Gyuyoung Kim <gyuyou...@chromium.org>
    Gerrit-CC: Rob Buis <rob....@samsung.com>
    Gerrit-Comment-Date: Fri, 16 Mar 2018 20:58:05 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Philip Rogers (Gerrit)

    unread,
    Mar 17, 2018, 1:07:54 PM3/17/18
    to Fredrik Söderquist, blink-revi...@chromium.org, blink-...@chromium.org, eae+bli...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+renderi...@chromium.org, pdr+svgw...@chromium.org, szager+la...@chromium.org, zol...@webkit.org, Stephen Chenney, Commit Bot, chromium...@chromium.org, Dirk Schulze, Gyuyoung Kim, Rob Buis

    View Change

    2 comments:

    • File third_party/WebKit/Source/core/layout/svg/SVGResourcesCycleSolver.h:

      • Patch Set #1, Line 33: class SVGResourcesCycleSolver {

        WYDT about adding a short class comment about how this works? It took me a few minutes to figure out what this is doing.

        Something like:
        // SVGResourcesCycleSolver breaks resource cycles. It maintains a list of active resources and
        // traverses the resource graph looking for references that are already in the active list.
        // After |ResolveCycles| is called, any resources with cycles will be removed.

        WDYT of refactoring this class to be a static function that, internally, creates the class and runs the cycle detection? I think that would make it more clear that this class should only be for a single run of cycle detection. (I initially thought you had introduced a bug because you forgot to clear active_resources_).

    • File third_party/WebKit/Source/core/layout/svg/SVGResourcesCycleSolver.cpp:

      • Patch Set #1, Line 108: if (auto* container_with_cycle = TraverseResources(resources_))

        TraverseResources returns the first container with a cycle which is then cleared. What if there are multiple containers with cycles? Don't we need to call resources_->ClearReferencesTo(...) for each container that has a cycle?

    To view, visit change 966661. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: master
    Gerrit-Change-Id: Icd8200a2cd9073487479e32827a9fdeb1d8d04c4
    Gerrit-Change-Number: 966661
    Gerrit-PatchSet: 1
    Gerrit-Owner: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Commit Bot <commi...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Gyuyoung Kim <gyuyou...@chromium.org>
    Gerrit-CC: Rob Buis <rob....@samsung.com>
    Gerrit-Comment-Date: Sat, 17 Mar 2018 17:07:52 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Fredrik Söderquist (Gerrit)

    unread,
    Mar 17, 2018, 2:00:39 PM3/17/18
    to blink-revi...@chromium.org, blink-...@chromium.org, eae+bli...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+renderi...@chromium.org, pdr+svgw...@chromium.org, szager+la...@chromium.org, zol...@webkit.org, Philip Rogers, Stephen Chenney, Commit Bot, chromium...@chromium.org, Dirk Schulze, Gyuyoung Kim, Rob Buis

    View Change

    2 comments:

      • TraverseResources returns the first container with a cycle which is then cleared. […]

        Yes, you're right. I guess this doesn't clean up as nicely as I'd initially hoped. Should add a test like that (because apparently there aren't one...)

    To view, visit change 966661. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: master
    Gerrit-Change-Id: Icd8200a2cd9073487479e32827a9fdeb1d8d04c4
    Gerrit-Change-Number: 966661
    Gerrit-PatchSet: 1
    Gerrit-Owner: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Commit Bot <commi...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Gyuyoung Kim <gyuyou...@chromium.org>
    Gerrit-CC: Rob Buis <rob....@samsung.com>
    Gerrit-Comment-Date: Sat, 17 Mar 2018 18:00:36 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Philip Rogers <p...@chromium.org>
    Gerrit-MessageType: comment

    Fredrik Söderquist (Gerrit)

    unread,
    Mar 19, 2018, 8:07:49 AM3/19/18
    to blink-revi...@chromium.org, blink-...@chromium.org, eae+bli...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+renderi...@chromium.org, pdr+svgw...@chromium.org, szager+la...@chromium.org, zol...@webkit.org, Philip Rogers, Stephen Chenney, Commit Bot, chromium...@chromium.org, Dirk Schulze, Gyuyoung Kim, Rob Buis

    View Change

    2 comments:

      • I'll look into doing that.

      • Yes, you're right. I guess this doesn't clean up as nicely as I'd initially hoped. […]

        Because of how we do cycle breaking [1] this turns out to be more non-obvious than one would think. Added a additional test regardless. (Maybe some day we'll have predictable/deterministic cycle breaking.)

        [1] I.e when resolving cycles, there may not be a (noticeable) cycle because it has already been broken.

    To view, visit change 966661. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: master
    Gerrit-Change-Id: Icd8200a2cd9073487479e32827a9fdeb1d8d04c4
    Gerrit-Change-Number: 966661
    Gerrit-PatchSet: 2
    Gerrit-Owner: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Commit Bot <commi...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Gyuyoung Kim <gyuyou...@chromium.org>
    Gerrit-CC: Rob Buis <rob....@samsung.com>
    Gerrit-Comment-Date: Mon, 19 Mar 2018 12:07:46 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Philip Rogers <p...@chromium.org>
    Comment-In-Reply-To: Fredrik Söderquist <f...@opera.com>
    Gerrit-MessageType: comment

    Fredrik Söderquist (Gerrit)

    unread,
    Mar 19, 2018, 8:40:14 AM3/19/18
    to Stephen Chenney, Philip Rogers, blink-revi...@chromium.org, blink-...@chromium.org, eae+bli...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+renderi...@chromium.org, pdr+svgw...@chromium.org, szager+la...@chromium.org, zol...@webkit.org, chromium...@chromium.org, Rob Buis, Commit Bot, Dirk Schulze, Gyuyoung Kim

    Fredrik Söderquist uploaded patch set #3 to this change.

    View Change

    [CI] Restructure SVGResourcesCycleSolver

    Restructure the code so that traversing a LayoutObject's resources is
    shared, and rename ResourceContainsCycles to TraverseResourceContainer.
    Hoist the side-effects (clearing out resources with cycles) to the
    caller.

    Bug: 534817, 769774
    Change-Id: Icd8200a2cd9073487479e32827a9fdeb1d8d04c4
    ---
    A third_party/WebKit/LayoutTests/svg/custom/multiple-resource-cycles-expected.html
    A third_party/WebKit/LayoutTests/svg/custom/multiple-resource-cycles.html
    M third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp
    M third_party/WebKit/Source/core/layout/svg/SVGResourcesCycleSolver.cpp
    M third_party/WebKit/Source/core/layout/svg/SVGResourcesCycleSolver.h
    5 files changed, 69 insertions(+), 39 deletions(-)

    To view, visit change 966661. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: master
    Gerrit-Change-Id: Icd8200a2cd9073487479e32827a9fdeb1d8d04c4
    Gerrit-Change-Number: 966661
    Gerrit-PatchSet: 3
    Gerrit-Owner: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Commit Bot <commi...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Gyuyoung Kim <gyuyou...@chromium.org>
    Gerrit-CC: Rob Buis <rob....@samsung.com>
    Gerrit-MessageType: newpatchset

    Philip Rogers (Gerrit)

    unread,
    Mar 19, 2018, 11:15:49 AM3/19/18
    to Fredrik Söderquist, blink-revi...@chromium.org, blink-...@chromium.org, eae+bli...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+renderi...@chromium.org, pdr+svgw...@chromium.org, szager+la...@chromium.org, zol...@webkit.org, Stephen Chenney, Commit Bot, chromium...@chromium.org, Dirk Schulze, Gyuyoung Kim, Rob Buis

    Thanks for the explanations and update. LGTM

    Patch set 4:Code-Review +1

    View Change

      To view, visit change 966661. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: master
      Gerrit-Change-Id: Icd8200a2cd9073487479e32827a9fdeb1d8d04c4
      Gerrit-Change-Number: 966661
      Gerrit-PatchSet: 4
      Gerrit-Owner: Fredrik Söderquist <f...@opera.com>
      Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
      Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
      Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
      Gerrit-CC: Commit Bot <commi...@chromium.org>
      Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
      Gerrit-CC: Gyuyoung Kim <gyuyou...@chromium.org>
      Gerrit-CC: Rob Buis <rob....@samsung.com>
      Gerrit-Comment-Date: Mon, 19 Mar 2018 15:15:47 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      Gerrit-MessageType: comment

      Fredrik Söderquist (Gerrit)

      unread,
      Mar 19, 2018, 11:19:41 AM3/19/18
      to blink-revi...@chromium.org, blink-...@chromium.org, eae+bli...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+renderi...@chromium.org, pdr+svgw...@chromium.org, szager+la...@chromium.org, zol...@webkit.org, Philip Rogers, Stephen Chenney, Commit Bot, chromium...@chromium.org, Dirk Schulze, Gyuyoung Kim, Rob Buis

      Patch set 4:Commit-Queue +2

      View Change

        To view, visit change 966661. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: chromium/src
        Gerrit-Branch: master
        Gerrit-Change-Id: Icd8200a2cd9073487479e32827a9fdeb1d8d04c4
        Gerrit-Change-Number: 966661
        Gerrit-PatchSet: 4
        Gerrit-Owner: Fredrik Söderquist <f...@opera.com>
        Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
        Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
        Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
        Gerrit-CC: Commit Bot <commi...@chromium.org>
        Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
        Gerrit-CC: Gyuyoung Kim <gyuyou...@chromium.org>
        Gerrit-CC: Rob Buis <rob....@samsung.com>
        Gerrit-Comment-Date: Mon, 19 Mar 2018 15:19:38 +0000

        Commit Bot (Gerrit)

        unread,
        Mar 19, 2018, 11:22:07 AM3/19/18
        to Fredrik Söderquist, blink-revi...@chromium.org, blink-...@chromium.org, eae+bli...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+renderi...@chromium.org, pdr+svgw...@chromium.org, szager+la...@chromium.org, zol...@webkit.org, Philip Rogers, Stephen Chenney, chromium...@chromium.org, Dirk Schulze, Gyuyoung Kim, Rob Buis

        Commit Bot merged this change.

        View Change

        Approvals: Philip Rogers: Looks good to me Fredrik Söderquist: Commit
        [CI] Restructure SVGResourcesCycleSolver

        Restructure the code so that traversing a LayoutObject's resources is
        shared, and rename ResourceContainsCycles to TraverseResourceContainer.
        Hoist the side-effects (clearing out resources with cycles) to the
        caller.

        Bug: 534817, 769774
        Change-Id: Icd8200a2cd9073487479e32827a9fdeb1d8d04c4
        Reviewed-on: https://chromium-review.googlesource.com/966661
        Reviewed-by: Philip Rogers <p...@chromium.org>
        Commit-Queue: Fredrik Söderquist <f...@opera.com>
        Cr-Commit-Position: refs/heads/master@{#544037}

        ---
        A third_party/WebKit/LayoutTests/svg/custom/multiple-resource-cycles-expected.html
        A third_party/WebKit/LayoutTests/svg/custom/multiple-resource-cycles.html
        M third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp
        M third_party/WebKit/Source/core/layout/svg/SVGResourcesCycleSolver.cpp
        M third_party/WebKit/Source/core/layout/svg/SVGResourcesCycleSolver.h
        5 files changed, 71 insertions(+), 40 deletions(-)


        To view, visit change 966661. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: chromium/src
        Gerrit-Branch: master
        Gerrit-Change-Id: Icd8200a2cd9073487479e32827a9fdeb1d8d04c4
        Gerrit-Change-Number: 966661
        Gerrit-PatchSet: 5
        Gerrit-Owner: Fredrik Söderquist <f...@opera.com>
        Gerrit-Reviewer: Commit Bot <commi...@chromium.org>
        Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
        Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
        Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
        Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
        Gerrit-CC: Gyuyoung Kim <gyuyou...@chromium.org>
        Gerrit-CC: Rob Buis <rob....@samsung.com>
        Gerrit-MessageType: merged
        Reply all
        Reply to author
        Forward
        0 new messages