Bug 192708 - clang-tidy: Fix unnecessary object copies in WebCore/platform/graphics/avfoundation/objc/
Summary: clang-tidy: Fix unnecessary object copies in WebCore/platform/graphics/avfoun...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-12-14 11:14 PST by David Kilzer (:ddkilzer)
Modified: 2018-12-14 13:12 PST (History)
4 users (show)

See Also:


Attachments
Patch v1 (11.20 KB, patch)
2018-12-14 11:26 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2018-12-14 11:14:29 PST
Running `clang-tidy -checks='-*,performance-*,-performance-noexcept-*' ...` on WebCore source files found these unnecessary object copies:

Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:303:83: warning: the parameter 'pair' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
static ImageDecoderAVFObjCSample* toSample(PresentationOrderSampleMap::value_type pair)
                                                                                  ^
                                           const                                 &

Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:1533:65: warning: the parameter 'asset' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
void MediaPlayerPrivateAVFoundationObjC::setAsset(RetainPtr<id> asset)
                                                                ^
                                                  const        &
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3056:30: warning: parameter 'seekableRanges' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
    m_cachedSeekableRanges = seekableRanges;
                             ^
                             std::move(    )
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3064:28: warning: parameter 'loadedRanges' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
    m_cachedLoadedRanges = loadedRanges;
                           ^
                           std::move(  )
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3126:79: warning: the parameter 'metadata' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
void MediaPlayerPrivateAVFoundationObjC::metadataDidArrive(RetainPtr<NSArray> metadata, const MediaTime& mediaTime)
                                                                              ^
                                                           const             &
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3168:77: warning: the parameter 'tracks' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
void MediaPlayerPrivateAVFoundationObjC::tracksDidChange(RetainPtr<NSArray> tracks)
                                                                            ^
                                                         const             &

Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:304:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (auto key : m_sampleBufferAudioRendererMap.keys())
              ^
         const  &
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:315:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (auto key : m_sampleBufferAudioRendererMap.keys())
              ^
         const  &
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:463:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (auto key : m_sampleBufferAudioRendererMap.keys())
              ^
         const  &

Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:1162:74: warning: the parameter 'time' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
MediaTime SourceBufferPrivateAVFObjC::fastSeekTimeForMediaTime(MediaTime time, MediaTime negativeThreshold, MediaTime positiveThreshold)
                                                                         ^
                                                               const    &
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:1162:90: warning: the parameter 'negativeThreshold' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
MediaTime SourceBufferPrivateAVFObjC::fastSeekTimeForMediaTime(MediaTime time, MediaTime negativeThreshold, MediaTime positiveThreshold)
                                                                                         ^
                                                                               const    &
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:1162:119: warning: the parameter 'positiveThreshold' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
MediaTime SourceBufferPrivateAVFObjC::fastSeekTimeForMediaTime(MediaTime time, MediaTime negativeThreshold, MediaTime positiveThreshold)
                                                                                                                      ^
                                                                                                            const    &
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:1174:55: warning: the parameter 'time' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
void SourceBufferPrivateAVFObjC::seekToTime(MediaTime time)
                                                      ^
                                            const    &
Comment 1 Radar WebKit Bug Importer 2018-12-14 11:16:30 PST
<rdar://problem/46735907>
Comment 2 David Kilzer (:ddkilzer) 2018-12-14 11:26:17 PST
Created attachment 357325 [details]
Patch v1
Comment 3 WebKit Commit Bot 2018-12-14 13:12:32 PST
Comment on attachment 357325 [details]
Patch v1

Clearing flags on attachment: 357325

Committed r239230: <https://trac.webkit.org/changeset/239230>
Comment 4 WebKit Commit Bot 2018-12-14 13:12:34 PST
All reviewed patches have been landed.  Closing bug.