 Chromium Code Reviews
 Chromium Code Reviews Issue 2741713002:
  Web MIDI: implement TaskService  (Closed)
    
  
    Issue 2741713002:
  Web MIDI: implement TaskService  (Closed) 
  | Index: media/midi/midi_service.h | 
| diff --git a/media/midi/midi_service.h b/media/midi/midi_service.h | 
| index 3017b862239c6b61081ca0b1e872ebb44b10a86e..37625ad571fe3ce3987a97c32bda60eb0e283d2c 100644 | 
| --- a/media/midi/midi_service.h | 
| +++ b/media/midi/midi_service.h | 
| @@ -20,6 +20,8 @@ | 
| namespace midi { | 
| +class TaskService; | 
| + | 
| // Manages MidiManager backends. This class expects to be constructed and | 
| // destructed on the browser main thread, but methods can be called on both | 
| // the main thread and the I/O thread. | 
| @@ -54,14 +56,21 @@ class MIDI_EXPORT MidiService final { | 
| // MidiManager, each task should ensure that MidiManager that posted the task | 
| // is still alive while accessing |this|. TaskRunners will be reused when | 
| // another MidiManager is instantiated. | 
| + // TODO(toyoshim): Remove this interface. | 
| scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(size_t runner_id); | 
| + // Obtains a TaskService that lives with MidiService. | 
| + TaskService* task() { return task_service_.get(); } | 
| 
yhirano
2017/06/07 09:21:03
Maybe task_service is better?
 
Takashi Toyoshima
2017/06/07 13:00:07
Done.
 | 
| + | 
| private: | 
| // Holds MidiManager instance. If the dynamic instantiation feature is | 
| // enabled, the MidiManager would be constructed and destructed on the I/O | 
| // thread, and all MidiManager methods would be called on the I/O thread. | 
| std::unique_ptr<MidiManager> manager_; | 
| + // Holds TaskService instance. | 
| + std::unique_ptr<TaskService> task_service_; | 
| + | 
| // TaskRunner to destruct |manager_| on the right thread. | 
| scoped_refptr<base::SingleThreadTaskRunner> manager_destructor_runner_; |