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/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 AudioManager* audio_manager, |
13 const AudioParameters& audio_parameters, | 13 const AudioParameters& audio_parameters, |
14 EventHandler* event_handler, | 14 EventHandler* event_handler, |
15 SyncWriter* sync_writer, | 15 SyncWriter* sync_writer) |
16 UserInputMonitor* user_input_monitor) | 16 : AudioInputController(event_handler, sync_writer), |
17 : AudioInputController(event_handler, sync_writer, user_input_monitor), | |
18 audio_parameters_(audio_parameters), | 17 audio_parameters_(audio_parameters), |
19 factory_(factory), | 18 factory_(factory), |
20 event_handler_(event_handler) { | 19 event_handler_(event_handler) { |
21 message_loop_ = audio_manager->GetMessageLoop(); | 20 message_loop_ = audio_manager->GetMessageLoop(); |
22 } | 21 } |
23 | 22 |
24 TestAudioInputController::~TestAudioInputController() { | 23 TestAudioInputController::~TestAudioInputController() { |
25 // Inform the factory so that it allows creating new instances in future. | 24 // Inform the factory so that it allows creating new instances in future. |
26 factory_->OnTestAudioInputControllerDestroyed(this); | 25 factory_->OnTestAudioInputControllerDestroyed(this); |
27 } | 26 } |
(...skipping 14 matching lines...) Expand all Loading... |
42 delegate_(NULL) { | 41 delegate_(NULL) { |
43 } | 42 } |
44 | 43 |
45 TestAudioInputControllerFactory::~TestAudioInputControllerFactory() { | 44 TestAudioInputControllerFactory::~TestAudioInputControllerFactory() { |
46 DCHECK(!controller_); | 45 DCHECK(!controller_); |
47 } | 46 } |
48 | 47 |
49 AudioInputController* TestAudioInputControllerFactory::Create( | 48 AudioInputController* TestAudioInputControllerFactory::Create( |
50 AudioManager* audio_manager, | 49 AudioManager* audio_manager, |
51 AudioInputController::EventHandler* event_handler, | 50 AudioInputController::EventHandler* event_handler, |
52 AudioParameters params, | 51 AudioParameters params) { |
53 UserInputMonitor* user_input_monitor) { | |
54 DCHECK(!controller_); // Only one test instance managed at a time. | 52 DCHECK(!controller_); // Only one test instance managed at a time. |
55 controller_ = new TestAudioInputController( | 53 controller_ = new TestAudioInputController(this, audio_manager, params, |
56 this, audio_manager, params, event_handler, NULL, user_input_monitor); | 54 event_handler, NULL); |
57 return controller_; | 55 return controller_; |
58 } | 56 } |
59 | 57 |
60 void TestAudioInputControllerFactory::SetDelegateForTests( | 58 void TestAudioInputControllerFactory::SetDelegateForTests( |
61 TestAudioInputControllerDelegate* delegate) { | 59 TestAudioInputControllerDelegate* delegate) { |
62 delegate_ = delegate; | 60 delegate_ = delegate; |
63 } | 61 } |
64 | 62 |
65 void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed( | 63 void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed( |
66 TestAudioInputController* controller) { | 64 TestAudioInputController* controller) { |
67 DCHECK_EQ(controller_, controller); | 65 DCHECK_EQ(controller_, controller); |
68 controller_ = NULL; | 66 controller_ = NULL; |
69 } | 67 } |
70 | 68 |
71 } // namespace media | 69 } // namespace media |
OLD | NEW |