New issue
Advanced search Search tips

Issue 693041 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Feb 2017
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Unnecessary casts in AudioManagerDeleter::operator()

Project Member Reported by maxmorin@chromium.org, Feb 16 2017

Issue description

The code currently does a const_cast (ewwww), and then a
static_cast<AudioManagerMac*>. The const cast is not needed, since
delete works on const pointers, and the static_cast is not needed
either, since the destructor is virtual so the correct one will be
called either way.

This also means that tests currently invokes undefined behavior when
using ScopedAudioManagerPtr with an mock/fake AudioManager.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Feb 16 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2fcc731a7f1502b514d622723b7aecd4771ee422

commit 2fcc731a7f1502b514d622723b7aecd4771ee422
Author: maxmorin <maxmorin@chromium.org>
Date: Thu Feb 16 19:28:36 2017

Remove unnecessary casts in AudioManagerDeleter on Mac.

The code currently does a const_cast (ewwww), and then a
static_cast<AudioManagerMac*>. The const cast is not needed, since
delete works on const pointers, and the static_cast is not needed
either, since the destructor is virtual so the correct one will be
called either way.

This also means that tests currently invokes undefined behavior when
using ScopedAudioManagerPtr with a mock/fake AudioManager. Oops.
This Cl fixes that.

BUG= 693041 
CQ_INCLUDE_TRYBOTS=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

Review-Url: https://codereview.chromium.org/2698503005
Cr-Commit-Position: refs/heads/master@{#451050}

[modify] https://crrev.com/2fcc731a7f1502b514d622723b7aecd4771ee422/media/audio/audio_manager.cc
[modify] https://crrev.com/2fcc731a7f1502b514d622723b7aecd4771ee422/media/audio/audio_manager.h
[modify] https://crrev.com/2fcc731a7f1502b514d622723b7aecd4771ee422/media/audio/mac/audio_manager_mac.h

Status: Verified (was: Started)

Sign in to add a comment