Please tell if you find this WTF::Vector change advisable
To view, visit change 620649. To unsubscribe, or for help writing mail filters, visit settings.
yutak: would you take a look at this one?
Yuta Kitamura would like Mark Pilgrim to review this change.
Implement WTF::Vector::erase(iterator)
This CL makes WTF::Vector::erase() semantics identical to the
stl::vector::erase(), i.e. it accepts an iterator and returns an
iterator.
Rationals:
1) This semantics is expected by developers
2) Compatibility with std algorithms, e.g.
auto it = std::lower_bound(
sorted_vector.begin(), sorted_vector.end(), item);
active_frequencies_.erase(it);
3) Allows to create template classes (e.g. algorithms) theat call
erase() and can operate with both WTF and std vectors.
The old version of WTF::Vector::erase() is renamed to
WTF::Vector::eraseAtIndex()
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I2677541d3ed188d89035c6a11a0312d5cd248080
---
M third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp
M third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp
M third_party/WebKit/Source/bindings/core/v8/serialization/SerializedScriptValue.cpp
M third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp
M third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
M third_party/WebKit/Source/core/clipboard/DataObject.cpp
M third_party/WebKit/Source/core/clipboard/DataTransferItem.cpp
M third_party/WebKit/Source/core/css/CSSGradientValue.cpp
M third_party/WebKit/Source/core/css/CSSGroupingRule.cpp
M third_party/WebKit/Source/core/css/CSSKeyframesRule.cpp
M third_party/WebKit/Source/core/css/CSSStyleSheet.cpp
M third_party/WebKit/Source/core/css/CSSValueList.cpp
M third_party/WebKit/Source/core/css/MediaList.cpp
M third_party/WebKit/Source/core/css/MediaQuery.cpp
M third_party/WebKit/Source/core/css/StylePropertySet.cpp
M third_party/WebKit/Source/core/css/StyleRule.cpp
M third_party/WebKit/Source/core/css/StyleSheetContents.cpp
M third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h
M third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
M third_party/WebKit/Source/core/dom/AccessibleNode.cpp
M third_party/WebKit/Source/core/dom/AccessibleNodeList.cpp
M third_party/WebKit/Source/core/dom/AttributeCollection.h
M third_party/WebKit/Source/core/dom/Document.cpp
M third_party/WebKit/Source/core/dom/Element.cpp
M third_party/WebKit/Source/core/dom/FrameRequestCallbackCollection.cpp
M third_party/WebKit/Source/core/dom/NodeRareData.h
M third_party/WebKit/Source/core/dom/SpaceSplitString.cpp
M third_party/WebKit/Source/core/dom/StyleEngine.cpp
M third_party/WebKit/Source/core/editing/EditingStyle.cpp
M third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp
M third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.cpp
M third_party/WebKit/Source/core/events/EventListenerMap.cpp
M third_party/WebKit/Source/core/events/GenericEventQueue.cpp
M third_party/WebKit/Source/core/fullscreen/Fullscreen.cpp
M third_party/WebKit/Source/core/html/FormData.cpp
M third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
M third_party/WebKit/Source/core/html/TimeRanges.cpp
M third_party/WebKit/Source/core/html/custom/V0CustomElementSyncMicrotaskQueue.cpp
M third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp
M third_party/WebKit/Source/core/html/parser/HTMLFormattingElementList.cpp
M third_party/WebKit/Source/core/html/track/CueTimeline.cpp
M third_party/WebKit/Source/core/html/track/TextTrackCueList.cpp
M third_party/WebKit/Source/core/html/track/TextTrackList.cpp
M third_party/WebKit/Source/core/html/track/TrackListBase.h
M third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
M third_party/WebKit/Source/core/layout/LayoutObject.cpp
M third_party/WebKit/Source/core/layout/LayoutTable.cpp
M third_party/WebKit/Source/core/layout/ng/inline/ng_inline_items_builder.cc
M third_party/WebKit/Source/core/loader/resource/MultipartImageResourceParser.cpp
M third_party/WebKit/Source/core/page/ChromeClientImpl.cpp
M third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp
M third_party/WebKit/Source/core/paint/compositing/CompositingRequirementsUpdater.cpp
M third_party/WebKit/Source/core/style/ComputedStyle.cpp
M third_party/WebKit/Source/core/svg/SVGStringList.cpp
M third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
M third_party/WebKit/Source/core/svg/properties/SVGListPropertyHelper.h
M third_party/WebKit/Source/core/url/URLSearchParams.cpp
M third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.cpp
M third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
M third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp
M third_party/WebKit/Source/modules/mediasource/SourceBufferList.cpp
M third_party/WebKit/Source/modules/mediastream/MediaStream.cpp
M third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp
M third_party/WebKit/Source/modules/presentation/PresentationConnectionList.cpp
M third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
M third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
M third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
M third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
M third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
M third_party/WebKit/Source/platform/json/JSONValues.cpp
M third_party/WebKit/Source/platform/mediastream/MediaStreamDescriptor.cpp
M third_party/WebKit/Source/platform/network/NetworkStateNotifier.cpp
M third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp
M third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp
M third_party/WebKit/Source/platform/wtf/Vector.h
M third_party/WebKit/Source/platform/wtf/VectorTest.cpp
M third_party/WebKit/Source/platform/wtf/text/StringBuilder.cpp
77 files changed, 173 insertions(+), 137 deletions(-)
+pilgrim WDYT?
I feel this is mostly OK except eraseAtIndex() should perhaps be named as EraseAt(), because (1) it's our non-standard extension (so CamelStyle), and (2) "Index" sounds a bit extra to me.
Another option is to completely remove current erase() and migrate all the use sites to std-style erase(). It's hard to say which approach is better.
Patch Set 3:
+pilgrim WDYT?
I feel this is mostly OK except eraseAtIndex() should perhaps be named as EraseAt(), because (1) it's our non-standard extension (so CamelStyle), and (2) "Index" sounds a bit extra to me.
Another option is to completely remove current erase() and migrate all the use sites to std-style erase(). It's hard to say which approach is better.
Love this patch! No opinion about renaming the old method. Make the bots happy and LGTM.
Patch Set 3:
+pilgrim WDYT?
I feel this is mostly OK except eraseAtIndex() should perhaps be named as EraseAt(), because (1) it's our non-standard extension (so CamelStyle), and (2) "Index" sounds a bit extra to me.
Another option is to completely remove current erase() and migrate all the use sites to std-style erase(). It's hard to say which approach is better.
Sorry for taking so long. I've renamed `eraseAtIndex` to `EraseAt` as was proposed. Think this approach (1) is less likely to bring regressions comparing it to (2). PTAL.
LGTM
Patch set 5:Code-Review +1
@haraken, could you PTAL?
LGTM
Patch set 6:Code-Review +1
Patch set 6:Commit-Queue +2
Commit Bot merged this change.
Implement WTF::Vector::erase(iterator)
This CL makes WTF::Vector::erase() semantics identical to the
stl::vector::erase(), i.e. it accepts an iterator and returns an
iterator.
Rationals:
1) This semantics is expected by developers
2) Compatibility with std algorithms, e.g.
auto it = std::lower_bound(
sorted_vector.begin(), sorted_vector.end(), item);
active_frequencies_.erase(it);
3) Allows to create template classes (e.g. algorithms) theat call
erase() and can operate with both WTF and std vectors.
The old version of WTF::Vector::erase() is renamed to
WTF: :Vector::eraseAtIndex()
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_layout_tests_layout_ng;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I2677541d3ed188d89035c6a11a0312d5cd248080
Reviewed-on: https://chromium-review.googlesource.com/620649
Reviewed-by: Kentaro Hara <har...@chromium.org>
Reviewed-by: Yuta Kitamura <yu...@chromium.org>
Commit-Queue: Mikhail Pozdnyakov <mikhail.p...@intel.com>
Cr-Commit-Position: refs/heads/master@{#504329}
---
M third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp
M third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp
M third_party/WebKit/Source/bindings/core/v8/serialization/SerializedScriptValue.cpp
M third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp
M third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
M third_party/WebKit/Source/core/clipboard/DataObject.cpp
M third_party/WebKit/Source/core/clipboard/DataTransferItem.cpp
M third_party/WebKit/Source/core/css/CSSGradientValue.cpp
M third_party/WebKit/Source/core/css/CSSGroupingRule.cpp
M third_party/WebKit/Source/core/css/CSSKeyframesRule.cpp
M third_party/WebKit/Source/core/css/CSSStyleSheet.cpp
M third_party/WebKit/Source/core/css/CSSValueList.cpp
M third_party/WebKit/Source/core/css/MediaList.cpp
M third_party/WebKit/Source/core/css/MediaQuery.cpp
M third_party/WebKit/Source/core/css/StyleEngine.cpp
M third_party/WebKit/Source/core/css/StylePropertySet.cpp
M third_party/WebKit/Source/core/css/StyleRule.cpp
M third_party/WebKit/Source/core/css/StyleSheetContents.cpp
M third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h
M third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
M third_party/WebKit/Source/core/dom/AccessibleNode.cpp
M third_party/WebKit/Source/core/dom/AccessibleNodeList.cpp
M third_party/WebKit/Source/core/dom/AttributeCollection.h
M third_party/WebKit/Source/core/dom/Document.cpp
M third_party/WebKit/Source/core/dom/Element.cpp
M third_party/WebKit/Source/core/dom/FrameRequestCallbackCollection.cpp
M third_party/WebKit/Source/core/dom/NodeRareData.h
M third_party/WebKit/Source/core/dom/SpaceSplitString.cpp
M third_party/WebKit/Source/core/dom/events/EventListenerMap.cpp
M third_party/WebKit/Source/core/dom/events/MediaElementEventQueue.cpp
M third_party/WebKit/Source/core/editing/EditingStyle.cpp
M third_party/WebKit/Source/core/editing/markers/SortedDocumentMarkerListEditor.cpp
M third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.cpp
M third_party/WebKit/Source/core/editing/markers/SuggestionMarkerListImpl.cpp
M third_party/WebKit/Source/modules/vibration/VibrationController.cpp
M third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
M third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
M third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
M third_party/WebKit/Source/platform/PODIntervalTreeTest.cpp
M third_party/WebKit/Source/platform/fonts/ScriptRunIterator.cpp
M third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
M third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
M third_party/WebKit/Source/platform/json/JSONValues.cpp
M third_party/WebKit/Source/platform/mediastream/MediaStreamDescriptor.cpp
M third_party/WebKit/Source/platform/network/NetworkStateNotifier.cpp
M third_party/WebKit/Source/platform/testing/ArenaTestHelpers.h
M third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp
M third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp
M third_party/WebKit/Source/platform/wtf/Vector.h
M third_party/WebKit/Source/platform/wtf/VectorTest.cpp
M third_party/WebKit/Source/platform/wtf/text/StringBuilder.cpp
83 files changed, 185 insertions(+), 150 deletions(-)