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

Issue 1530723004: Use clampTo instead of chaining std::max(std::min(...)) (Closed)

Created:
5 years ago by Daniel Bratell
Modified:
5 years ago
CC:
Raymond Toy, darktears, blink-layers+watch_chromium.org, blink-reviews, blink-reviews-animation_chromium.org, blink-reviews-platform-graphics_chromium.org, Rik, chromium-reviews, danakj, dshwang, drott+blinkwatch_chromium.org, krit, Eric Willigers, f(malita), jbroman, Justin Novosad, pdr+graphicswatchlist_chromium.org, rjwright, rwlbuis, Stephen Chennney, shans, vmpstr+blinkwatch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use clampTo instead of chaining std::max(std::min(...)) It's common to make a value end up between two other values by using std::min and std::max but we have a clampTo function that will make the code much easier to read so we should use it. The performance is the same (both end up doing inline comparisons and value selection) but not having to include <algorithm> can bring a very slight compilation speed boost. BUG=563433 Committed: https://crrev.com/881b6566ecacfe9154e1f115c588e76cec8a513a Cr-Commit-Position: refs/heads/master@{#366585}

Patch Set 1 #

Patch Set 2 : Removed one include too many. #

Patch Set 3 : Handling that minimumThumbLength > trackLen. #

Total comments: 6

Patch Set 4 : Rebased to newer master #

Patch Set 5 : More rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+68 lines, -56 lines) Patch
M third_party/WebKit/Source/platform/audio/AudioDelayDSPKernel.cpp View 1 2 3 3 chunks +3 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/audio/AudioResamplerKernel.cpp View 1 2 3 2 chunks +2 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/audio/Biquad.cpp View 1 2 3 8 chunks +8 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp View 1 2 3 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp View 1 2 3 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp View 1 2 3 2 chunks +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/audio/HRTFKernel.cpp View 1 2 3 2 chunks +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/audio/HRTFPanner.cpp View 1 2 3 2 chunks +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/audio/VectorMath.cpp View 1 2 3 2 chunks +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/graphics/Color.cpp View 1 2 3 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp View 1 2 3 2 chunks +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/graphics/filters/FEComponentTransfer.cpp View 1 2 3 5 chunks +6 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/filters/FELighting.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/graphics/filters/FESpecularLighting.cpp View 1 2 3 2 chunks +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/graphics/filters/SpotLightSource.h View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/filters/SpotLightSource.cpp View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm View 1 2 3 3 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/scroll/ScrollableArea.h View 2 chunks +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp View 1 2 3 2 chunks +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesisUtterance.h View 2 chunks +4 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/transforms/TransformationMatrix.cpp View 1 2 3 3 chunks +5 lines, -3 lines 0 comments Download

Messages

Total messages: 21 (7 generated)
Daniel Bratell
Can you please look at this switch to clampTo() in platform and in particular in ...
5 years ago (2015-12-17 16:51:36 UTC) #2
Ken Russell (switch to Gerrit)
+hongchan. I'd like to defer review to Ray and Hongchan.
5 years ago (2015-12-17 19:13:10 UTC) #4
Raymond Toy
https://codereview.chromium.org/1530723004/diff/40001/third_party/WebKit/Source/platform/audio/Biquad.cpp File third_party/WebKit/Source/platform/audio/Biquad.cpp (right): https://codereview.chromium.org/1530723004/diff/40001/third_party/WebKit/Source/platform/audio/Biquad.cpp#newcode40 third_party/WebKit/Source/platform/audio/Biquad.cpp:40: #include <complex> Why is <complex> needed now? https://codereview.chromium.org/1530723004/diff/40001/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp File ...
5 years ago (2015-12-17 19:45:55 UTC) #5
Daniel Bratell
https://codereview.chromium.org/1530723004/diff/40001/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp File third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp (right): https://codereview.chromium.org/1530723004/diff/40001/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp#newcode39 third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp:39: #include <cmath> On 2015/12/17 19:45:55, Raymond Toy wrote: > ...
5 years ago (2015-12-17 22:56:16 UTC) #6
Daniel Bratell
https://codereview.chromium.org/1530723004/diff/40001/third_party/WebKit/Source/platform/audio/Biquad.cpp File third_party/WebKit/Source/platform/audio/Biquad.cpp (right): https://codereview.chromium.org/1530723004/diff/40001/third_party/WebKit/Source/platform/audio/Biquad.cpp#newcode40 third_party/WebKit/Source/platform/audio/Biquad.cpp:40: #include <complex> On 2015/12/17 19:45:55, Raymond Toy wrote: > ...
5 years ago (2015-12-17 22:58:19 UTC) #7
Raymond Toy
Thanks for the explanations. lgtm for the platform/audio parts.
5 years ago (2015-12-17 23:03:39 UTC) #8
hongchan
I had a same set of questions with rtoy@. Thanks for the explanation. lgtm
5 years ago (2015-12-18 15:46:16 UTC) #9
Daniel Bratell
On 2015/12/18 15:46:16, hoch wrote: > I had a same set of questions with rtoy@. ...
5 years ago (2015-12-18 16:07:11 UTC) #10
Ken Russell (switch to Gerrit)
lgtm
5 years ago (2015-12-21 22:09:23 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1530723004/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1530723004/40001
5 years ago (2015-12-22 09:02:36 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_compile_dbg_32_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_compile_dbg_32_ng/builds/138869) ios_dbg_simulator_ninja on tryserver.chromium.mac (JOB_FAILED, ...
5 years ago (2015-12-22 09:04:36 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1530723004/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1530723004/80001
5 years ago (2015-12-22 09:39:56 UTC) #18
commit-bot: I haz the power
Committed patchset #5 (id:80001)
5 years ago (2015-12-22 10:58:47 UTC) #19
commit-bot: I haz the power
5 years ago (2015-12-22 10:59:37 UTC) #21
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/881b6566ecacfe9154e1f115c588e76cec8a513a
Cr-Commit-Position: refs/heads/master@{#366585}

Powered by Google App Engine
This is Rietveld 408576698