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

Issue 2917963003: Refactor DocumentMarkerListEditor::ShiftMarkersContent{Ind,D}ependent (Closed)

Created:
3 years, 6 months ago by rlanday
Modified:
3 years, 6 months ago
Reviewers:
yosin_UTC9, Xiaocheng
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactor DocumentMarkerListEditor::ShiftMarkersContent{Ind,D}ependent The current implementations of DocumentMarkerListEditor::ShiftMarkersContentDependent() and ShiftMarkersContentIndependent() can potentially take quadratic time in the number of markers if we have to remove them all, since we call Vector::erase() on them one-by-one. We can avoid this by creating a new MarkerList and swapping afterward. The best-case runtime should still be linear for both the old and new implementations. BUG=707867 Review-Url: https://codereview.chromium.org/2917963003 Cr-Commit-Position: refs/heads/master@{#477055} Committed: https://chromium.googlesource.com/chromium/src/+/6ee691bbd589760fec30ee27dcb408a70feb66d3

Patch Set 1 #

Total comments: 5

Patch Set 2 : Use std::move() #

Patch Set 3 : Rewrite to be more efficient #

Total comments: 4

Patch Set 4 : Fix nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+38 lines, -14 lines) Patch
M third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp View 1 2 3 3 chunks +38 lines, -14 lines 0 comments Download

Messages

Total messages: 25 (15 generated)
rlanday
3 years, 6 months ago (2017-06-02 01:19:50 UTC) #3
yosin_UTC9
https://codereview.chromium.org/2917963003/diff/1/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp (right): https://codereview.chromium.org/2917963003/diff/1/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp#newcode112 third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp:112: std::swap(*list, new_list); nit: |*list = std::move(new_list);| Let's do C++11-ish, ...
3 years, 6 months ago (2017-06-02 04:28:56 UTC) #4
rlanday
Updated to use std::move()
3 years, 6 months ago (2017-06-02 15:22:54 UTC) #6
rlanday
https://codereview.chromium.org/2917963003/diff/1/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp (right): https://codereview.chromium.org/2917963003/diff/1/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp#newcode113 third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp:113: return did_shift_marker; On 2017/06/02 at 04:28:56, yosin_UTC9 wrote: > ...
3 years, 6 months ago (2017-06-02 15:23:01 UTC) #7
Xiaocheng
I think we should not create a new list, which adds burden to GC. It's ...
3 years, 6 months ago (2017-06-02 17:53:43 UTC) #11
rlanday
On 2017/06/02 at 17:53:43, xiaochengh wrote: > I think we should not create a new ...
3 years, 6 months ago (2017-06-02 21:08:16 UTC) #12
Xiaocheng
lgtm
3 years, 6 months ago (2017-06-03 02:25:39 UTC) #17
yosin_UTC9
lgtm w/ nits https://codereview.chromium.org/2917963003/diff/40001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp File third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp (right): https://codereview.chromium.org/2917963003/diff/40001/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp#newcode84 third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp:84: MarkerList::iterator shift_range_begin = nit: s/MarkerList::iterator/const MarkerList::iterator&/ ...
3 years, 6 months ago (2017-06-05 03:35:40 UTC) #18
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/2917963003/60001
3 years, 6 months ago (2017-06-05 17:02:25 UTC) #22
commit-bot: I haz the power
3 years, 6 months ago (2017-06-05 19:27:06 UTC) #25
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as
https://chromium.googlesource.com/chromium/src/+/6ee691bbd589760fec30ee27dcb4...

Powered by Google App Engine
This is Rietveld 408576698