New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 768515 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Task



Sign in to add a comment

Stop using raw pointers for owning Audio{In|Out}putStreams

Project Member Reported by maxmorin@chromium.org, Sep 25 2017

Issue description

Currently, raw pointers to streams denote ownership (sometimes), meaning that the holder of the pointer must call Close on it to avoid leaking resources. This can be quite confusing and error prone (there have probably been a few bugs due to this, though I cannot remember on the top of my head). Ideal would be to use the destructor instead of Close for cleaning up streams, but some streams have their memory released by the AudioManager, or have some other special arrangement for cleanup. It would probably be easier to have owning pointers in a smart pointer like
"using UniqueAudioInputStreamPtr = std::unique_ptr<AudioInputStream, AudioStreamCloser>", where AudioStreamCloser calls Close. This wouldn't require updating all the Audio{In,Out}putStream implementations.

Possibly a good starter bug?
 
I think we should just ditch the Open/Close() model in favor of having the constructor and destructor handle it automatically. It's always felt kind of silly that we have construct/destruct + open/close + start/stop. Especially when open/close are one time operations. 
Yes, RAII FTW

Comment 3 Deleted

Im a newbie to chromium and aware of usage of RAII pattern, would like to take up this work. Can someone throw some light on the pointers which needs to be replaced with RAII pattern.

Thanks,
Is there any some reference already been implemented? plz guide


Thanks
Project Member

Comment 6 by sheriffbot@chromium.org, Oct 25

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment