• Bartek Nowierski's avatar
    Avoid unnecessary std::swap · 3dd3d3f5
    Bartek Nowierski authored
    The old code is undesirable, because:
    
    1. It was not following go/totw/28 advice about using the following
       pattern:
    
          VideoDecodeAccelerator::Client* client = nullptr;
          using std::swap;
          swap(client, client_);
    
    2. Is not really needed, because the swap is with a known constant.
    
    3. Might not compile if in the future, hypothetically the type of
       |client_| becomes |base::CheckedPtr<VideoDecodeAccelerator::Client>|.
       (this last issue may be fixable either by: A) using the new pattern
       or B) implementing |swap(T*&, CheckedPtr<T>&)| function in the base
       namespace).
    
    Bug: 1080832
    Change-Id: I937a60cae6d9d164b088227cca209f4bcc0473a0
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2435171
    Auto-Submit: Bartek Nowierski <bartekn@chromium.org>
    Reviewed-by: default avatarKen Rockot <rockot@google.com>
    Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
    Commit-Queue: Andrew Grieve <agrieve@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#811338}
    3dd3d3f5
scoped_hardware_buffer_handle.cc 3.26 KB