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 UserInputMonitor* user_input_monitor) |
17 : AudioInputController(event_handler, sync_writer, user_input_monitor), | 17 : AudioInputController(event_handler, sync_writer, user_input_monitor), |
18 audio_parameters_(audio_parameters), | 18 audio_parameters_(audio_parameters), |
19 factory_(factory), | 19 factory_(factory), |
20 event_handler_(event_handler) { | 20 event_handler_(event_handler) { |
21 message_loop_ = audio_manager->GetMessageLoop(); | 21 task_runner_ = audio_manager->GetTaskRunner(); |
22 } | 22 } |
23 | 23 |
24 TestAudioInputController::~TestAudioInputController() { | 24 TestAudioInputController::~TestAudioInputController() { |
25 // Inform the factory so that it allows creating new instances in future. | 25 // Inform the factory so that it allows creating new instances in future. |
26 factory_->OnTestAudioInputControllerDestroyed(this); | 26 factory_->OnTestAudioInputControllerDestroyed(this); |
27 } | 27 } |
28 | 28 |
29 void TestAudioInputController::Record() { | 29 void TestAudioInputController::Record() { |
30 if (factory_->delegate_) | 30 if (factory_->delegate_) |
31 factory_->delegate_->TestAudioControllerOpened(this); | 31 factory_->delegate_->TestAudioControllerOpened(this); |
32 } | 32 } |
33 | 33 |
34 void TestAudioInputController::Close(const base::Closure& closed_task) { | 34 void TestAudioInputController::Close(const base::Closure& closed_task) { |
35 message_loop_->PostTask(FROM_HERE, closed_task); | 35 task_runner_->PostTask(FROM_HERE, closed_task); |
36 if (factory_->delegate_) | 36 if (factory_->delegate_) |
37 factory_->delegate_->TestAudioControllerClosed(this); | 37 factory_->delegate_->TestAudioControllerClosed(this); |
38 } | 38 } |
39 | 39 |
40 TestAudioInputControllerFactory::TestAudioInputControllerFactory() | 40 TestAudioInputControllerFactory::TestAudioInputControllerFactory() |
41 : controller_(NULL), | 41 : controller_(NULL), |
42 delegate_(NULL) { | 42 delegate_(NULL) { |
43 } | 43 } |
44 | 44 |
45 TestAudioInputControllerFactory::~TestAudioInputControllerFactory() { | 45 TestAudioInputControllerFactory::~TestAudioInputControllerFactory() { |
(...skipping 11 matching lines...) Expand all Loading... |
57 return controller_; | 57 return controller_; |
58 } | 58 } |
59 | 59 |
60 void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed( | 60 void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed( |
61 TestAudioInputController* controller) { | 61 TestAudioInputController* controller) { |
62 DCHECK_EQ(controller_, controller); | 62 DCHECK_EQ(controller_, controller); |
63 controller_ = NULL; | 63 controller_ = NULL; |
64 } | 64 } |
65 | 65 |
66 } // namespace media | 66 } // namespace media |
OLD | NEW |