| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef MEDIA_MIDI_MIDI_SERVICE_H_ | 5 #ifndef MEDIA_MIDI_MIDI_SERVICE_H_ |
| 6 #define MEDIA_MIDI_MIDI_SERVICE_H_ | 6 #define MEDIA_MIDI_MIDI_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // TaskRunner will be constructed on demand. | 53 // TaskRunner will be constructed on demand. |
| 54 // MidiManager that supports the dynamic instantiation feature will use this | 54 // MidiManager that supports the dynamic instantiation feature will use this |
| 55 // method to post tasks that should not run on I/O. Since TaskRunners outlive | 55 // method to post tasks that should not run on I/O. Since TaskRunners outlive |
| 56 // MidiManager, each task should ensure that MidiManager that posted the task | 56 // MidiManager, each task should ensure that MidiManager that posted the task |
| 57 // is still alive while accessing |this|. TaskRunners will be reused when | 57 // is still alive while accessing |this|. TaskRunners will be reused when |
| 58 // another MidiManager is instantiated. | 58 // another MidiManager is instantiated. |
| 59 // TODO(toyoshim): Remove this interface. | 59 // TODO(toyoshim): Remove this interface. |
| 60 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(size_t runner_id); | 60 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(size_t runner_id); |
| 61 | 61 |
| 62 // Obtains a TaskService that lives with MidiService. | 62 // Obtains a TaskService that lives with MidiService. |
| 63 TaskService* task() { return task_service_.get(); } | 63 TaskService* task_service() { return task_service_.get(); } |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 // Holds MidiManager instance. If the dynamic instantiation feature is | 66 // Holds MidiManager instance. If the dynamic instantiation feature is |
| 67 // enabled, the MidiManager would be constructed and destructed on the I/O | 67 // enabled, the MidiManager would be constructed and destructed on the I/O |
| 68 // thread, and all MidiManager methods would be called on the I/O thread. | 68 // thread, and all MidiManager methods would be called on the I/O thread. |
| 69 std::unique_ptr<MidiManager> manager_; | 69 std::unique_ptr<MidiManager> manager_; |
| 70 | 70 |
| 71 // Holds TaskService instance. | 71 // Holds TaskService instance. |
| 72 std::unique_ptr<TaskService> task_service_; | 72 std::unique_ptr<TaskService> task_service_; |
| 73 | 73 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 89 | 89 |
| 90 // Protects |threads_|. | 90 // Protects |threads_|. |
| 91 base::Lock threads_lock_; | 91 base::Lock threads_lock_; |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(MidiService); | 93 DISALLOW_COPY_AND_ASSIGN(MidiService); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } // namespace midi | 96 } // namespace midi |
| 97 | 97 |
| 98 #endif // MEDIA_MIDI_MIDI_SERVICE_H_ | 98 #endif // MEDIA_MIDI_MIDI_SERVICE_H_ |
| OLD | NEW |