OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/audio/audio_output_proxy.h" | 5 #include "media/audio/audio_output_proxy.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "media/audio/audio_manager.h" | 10 #include "media/audio/audio_manager.h" |
11 #include "media/audio/audio_output_dispatcher.h" | 11 #include "media/audio/audio_output_dispatcher.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void AudioOutputProxy::GetVolume(double* volume) { | 77 void AudioOutputProxy::GetVolume(double* volume) { |
78 DCHECK_EQ(MessageLoop::current(), dispatcher_->message_loop()); | 78 DCHECK_EQ(MessageLoop::current(), dispatcher_->message_loop()); |
79 *volume = volume_; | 79 *volume = volume_; |
80 } | 80 } |
81 | 81 |
82 void AudioOutputProxy::Close() { | 82 void AudioOutputProxy::Close() { |
83 DCHECK_EQ(MessageLoop::current(), dispatcher_->message_loop()); | 83 DCHECK_EQ(MessageLoop::current(), dispatcher_->message_loop()); |
84 DCHECK(state_ == kCreated || state_ == kError || state_ == kOpened); | 84 DCHECK(state_ == kCreated || state_ == kError || state_ == kOpened); |
85 DCHECK(!physical_stream_); | 85 DCHECK(!physical_stream_); |
86 | 86 |
87 if (state_ != kCreated) { | 87 if (state_ != kCreated) |
88 dispatcher_->StreamClosed(); | 88 dispatcher_->StreamClosed(); |
89 } | 89 |
90 dispatcher_->message_loop()->DeleteSoon(FROM_HERE, this); | |
91 state_ = kClosed; | 90 state_ = kClosed; |
| 91 |
| 92 // Delete the object now like is done in the Close() implementation of |
| 93 // physical stream objects. If we delete the object via DeleteSoon, we |
| 94 // unnecessarily complicate the Shutdown procedure of the |
| 95 // dispatcher+audio manager. |
| 96 delete this; |
92 } | 97 } |
OLD | NEW |