| OLD | NEW |
| 1 // Copyright (c) 2011 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/test_audio_input_controller_factory.h" | 5 #include "media/audio/test_audio_input_controller_factory.h" |
| 6 #include "media/audio/audio_io.h" | 6 #include "media/audio/audio_io.h" |
| 7 | 7 |
| 8 namespace media { | 8 namespace media { |
| 9 | 9 |
| 10 TestAudioInputController::TestAudioInputController( | 10 TestAudioInputController::TestAudioInputController( |
| 11 TestAudioInputControllerFactory* factory, | 11 TestAudioInputControllerFactory* factory, |
| 12 AudioManager* audio_manager, |
| 12 EventHandler* event_handler, | 13 EventHandler* event_handler, |
| 13 SyncWriter* sync_writer) | 14 SyncWriter* sync_writer) |
| 14 : AudioInputController(event_handler, sync_writer), | 15 : AudioInputController(audio_manager, event_handler, sync_writer), |
| 15 factory_(factory), | 16 factory_(factory), |
| 16 event_handler_(event_handler) { | 17 event_handler_(event_handler) { |
| 17 } | 18 } |
| 18 | 19 |
| 19 TestAudioInputController::~TestAudioInputController() { | 20 TestAudioInputController::~TestAudioInputController() { |
| 20 // Inform the factory so that it allows creating new instances in future. | 21 // Inform the factory so that it allows creating new instances in future. |
| 21 factory_->OnTestAudioInputControllerDestroyed(this); | 22 factory_->OnTestAudioInputControllerDestroyed(this); |
| 22 } | 23 } |
| 23 | 24 |
| 24 TestAudioInputControllerFactory::TestAudioInputControllerFactory() | 25 TestAudioInputControllerFactory::TestAudioInputControllerFactory() |
| 25 : controller_(NULL) { | 26 : controller_(NULL) { |
| 26 } | 27 } |
| 27 | 28 |
| 28 AudioInputController* TestAudioInputControllerFactory::Create( | 29 AudioInputController* TestAudioInputControllerFactory::Create( |
| 30 AudioManager* audio_manager, |
| 29 AudioInputController::EventHandler* event_handler, | 31 AudioInputController::EventHandler* event_handler, |
| 30 AudioParameters params) { | 32 AudioParameters params) { |
| 31 DCHECK(!controller_); // Only one test instance managed at a time. | 33 DCHECK(!controller_); // Only one test instance managed at a time. |
| 32 controller_ = new TestAudioInputController(this, event_handler, NULL); | 34 controller_ = new TestAudioInputController(this, audio_manager, |
| 35 event_handler, NULL); |
| 33 return controller_; | 36 return controller_; |
| 34 } | 37 } |
| 35 | 38 |
| 36 void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed( | 39 void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed( |
| 37 TestAudioInputController* controller) { | 40 TestAudioInputController* controller) { |
| 38 DCHECK_EQ(controller_, controller); | 41 DCHECK_EQ(controller_, controller); |
| 39 controller_ = NULL; | 42 controller_ = NULL; |
| 40 } | 43 } |
| 41 | 44 |
| 42 } // namespace media | 45 } // namespace media |
| OLD | NEW |