Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Issue 2176683003: Use index instead of iterator into DisplayItemList in PaintController (Closed)

Created:
4 years, 5 months ago by Xianzhu
Modified:
4 years, 5 months ago
Reviewers:
pdr.
CC:
ajuma+watch_chromium.org, blink-reviews, blink-reviews-platform-graphics_chromium.org, Rik, chromium-reviews, danakj+watch_chromium.org, dshwang, drott+blinkwatch_chromium.org, krit, f(malita), jbroman, Justin Novosad, pdr+graphicswatchlist_chromium.org, rwlbuis, Stephen Chennney
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use index instead of iterator into DisplayItemList in PaintController he problem of an iterator is that it will be invalid when the vector reallocates buffer. An index won't be invalid as long as we don't add/remove any item before the index. An examples that we had used indices before this CL is DisplayItemIndicesByClientMap which maps DisplayItemClient to indices of display items. Iterators don't work because the map is built when we are adding items into the list. Once the list reallocates the underlying buffer, all existing iterators might become invalid. Another example is m_underInvalidationCheckingBegin/m_underInvalidationCheckingEnd. Before this CL we had to reset them in appendDebugDrawingAfterCommit() when the list changes. (I had a hard time debugging a flaky crash caused by an invalid iterator before adding the reset code.) Because we have to use indices, if we use iterators we have to convert between them. The main purpose of this CL is for https://codereview.chromium.org/2176573004/ which requires us to find a cached chunk by index of a display item. Otherwise we would add another place converting iterator to index. This CL doesn't expose indices across public api boundary. Run 1093 of ct (https://ct.skia.org/chromium_perf_runs/) showed no performance impact. BUG=596983 Committed: https://crrev.com/dbea1f7009644ea416e5e0129bc255b946a88f73 Cr-Commit-Position: refs/heads/master@{#407683}

Patch Set 1 #

Patch Set 2 : - #

Unified diffs Side-by-side diffs Delta from patch set Stats (+62 lines, -63 lines) Patch
M third_party/WebKit/Source/platform/graphics/paint/PaintController.h View 4 chunks +11 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp View 1 11 chunks +51 lines, -52 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 19 (10 generated)
Xianzhu
4 years, 5 months ago (2016-07-25 21:27:36 UTC) #6
pdr.
Iterators can be nice at the api boundary because they let you return const iterators. ...
4 years, 5 months ago (2016-07-25 22:09:12 UTC) #7
Xianzhu
On 2016/07/25 22:09:12, pdr. wrote: > Iterators can be nice at the api boundary because ...
4 years, 5 months ago (2016-07-25 22:33:55 UTC) #8
Xianzhu
Run 1093 of ct (https://ct.skia.org/chromium_perf_runs/) showed no performance impact.
4 years, 5 months ago (2016-07-25 22:38:04 UTC) #9
pdr.
On 2016/07/25 at 22:33:55, wangxianzhu wrote: > On 2016/07/25 22:09:12, pdr. wrote: > > Iterators ...
4 years, 5 months ago (2016-07-25 23:27:24 UTC) #10
Xianzhu
On 2016/07/25 23:27:24, pdr. wrote: > On 2016/07/25 at 22:33:55, wangxianzhu wrote: > > On ...
4 years, 5 months ago (2016-07-26 00:28:37 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2176683003/20001
4 years, 5 months ago (2016-07-26 00:29:30 UTC) #15
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 5 months ago (2016-07-26 02:03:31 UTC) #17
commit-bot: I haz the power
4 years, 5 months ago (2016-07-26 02:05:08 UTC) #19
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/dbea1f7009644ea416e5e0129bc255b946a88f73
Cr-Commit-Position: refs/heads/master@{#407683}

Powered by Google App Engine
This is Rietveld 408576698