| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_controller.h" | 5 #include "media/audio/audio_output_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 volume_(1.0), | 48 volume_(1.0), |
| 49 state_(kEmpty), | 49 state_(kEmpty), |
| 50 num_allowed_io_(0), | 50 num_allowed_io_(0), |
| 51 sync_reader_(sync_reader), | 51 sync_reader_(sync_reader), |
| 52 message_loop_(audio_manager->GetMessageLoop()), | 52 message_loop_(audio_manager->GetMessageLoop()), |
| 53 number_polling_attempts_left_(0), | 53 number_polling_attempts_left_(0), |
| 54 weak_this_(this) { | 54 weak_this_(this) { |
| 55 DCHECK(audio_manager); | 55 DCHECK(audio_manager); |
| 56 DCHECK(handler_); | 56 DCHECK(handler_); |
| 57 DCHECK(sync_reader_); | 57 DCHECK(sync_reader_); |
| 58 DCHECK(message_loop_); | 58 DCHECK(message_loop_.get()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 AudioOutputController::~AudioOutputController() { | 61 AudioOutputController::~AudioOutputController() { |
| 62 DCHECK_EQ(kClosed, state_); | 62 DCHECK_EQ(kClosed, state_); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // static | 65 // static |
| 66 scoped_refptr<AudioOutputController> AudioOutputController::Create( | 66 scoped_refptr<AudioOutputController> AudioOutputController::Create( |
| 67 AudioManager* audio_manager, | 67 AudioManager* audio_manager, |
| 68 EventHandler* event_handler, | 68 EventHandler* event_handler, |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 DCHECK(base::AtomicRefCountIsZero(&num_allowed_io_)); | 437 DCHECK(base::AtomicRefCountIsZero(&num_allowed_io_)); |
| 438 base::AtomicRefCountInc(&num_allowed_io_); | 438 base::AtomicRefCountInc(&num_allowed_io_); |
| 439 } | 439 } |
| 440 | 440 |
| 441 void AudioOutputController::DisallowEntryToOnMoreIOData() { | 441 void AudioOutputController::DisallowEntryToOnMoreIOData() { |
| 442 const bool is_zero = !base::AtomicRefCountDec(&num_allowed_io_); | 442 const bool is_zero = !base::AtomicRefCountDec(&num_allowed_io_); |
| 443 DCHECK(is_zero); | 443 DCHECK(is_zero); |
| 444 } | 444 } |
| 445 | 445 |
| 446 } // namespace media | 446 } // namespace media |
| OLD | NEW |