Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: media/midi/midi_manager_usb.cc

Issue 1544313002: Convert Pass()→std::move() in //media (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/midi/midi_manager_alsa_unittest.cc ('k') | media/midi/midi_manager_usb_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/midi/midi_manager_usb.h" 5 #include "media/midi/midi_manager_usb.h"
6 6
7 #include <utility>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
9 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
10 #include "media/midi/midi_scheduler.h" 12 #include "media/midi/midi_scheduler.h"
11 #include "media/midi/usb_midi_descriptor_parser.h" 13 #include "media/midi/usb_midi_descriptor_parser.h"
12 14
13 namespace media { 15 namespace media {
14 namespace midi { 16 namespace midi {
15 17
16 MidiManagerUsb::MidiManagerUsb(scoped_ptr<UsbMidiDevice::Factory> factory) 18 MidiManagerUsb::MidiManagerUsb(scoped_ptr<UsbMidiDevice::Factory> factory)
17 : device_factory_(factory.Pass()) { 19 : device_factory_(std::move(factory)) {}
18 }
19 20
20 MidiManagerUsb::~MidiManagerUsb() { 21 MidiManagerUsb::~MidiManagerUsb() {
21 } 22 }
22 23
23 void MidiManagerUsb::StartInitialization() { 24 void MidiManagerUsb::StartInitialization() {
24 Initialize( 25 Initialize(
25 base::Bind(&MidiManager::CompleteInitialization, base::Unretained(this))); 26 base::Bind(&MidiManager::CompleteInitialization, base::Unretained(this)));
26 } 27 }
27 28
28 void MidiManagerUsb::Initialize(base::Callback<void(Result result)> callback) { 29 void MidiManagerUsb::Initialize(base::Callback<void(Result result)> callback) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return; 63 return;
63 input_stream_->OnReceivedData(device, 64 input_stream_->OnReceivedData(device,
64 endpoint_number, 65 endpoint_number,
65 data, 66 data,
66 size, 67 size,
67 time); 68 time);
68 } 69 }
69 70
70 void MidiManagerUsb::OnDeviceAttached(scoped_ptr<UsbMidiDevice> device) { 71 void MidiManagerUsb::OnDeviceAttached(scoped_ptr<UsbMidiDevice> device) {
71 int device_id = static_cast<int>(devices_.size()); 72 int device_id = static_cast<int>(devices_.size());
72 devices_.push_back(device.Pass()); 73 devices_.push_back(std::move(device));
73 AddPorts(devices_.back(), device_id); 74 AddPorts(devices_.back(), device_id);
74 } 75 }
75 76
76 void MidiManagerUsb::OnDeviceDetached(size_t index) { 77 void MidiManagerUsb::OnDeviceDetached(size_t index) {
77 if (index >= devices_.size()) { 78 if (index >= devices_.size()) {
78 return; 79 return;
79 } 80 }
80 UsbMidiDevice* device = devices_[index]; 81 UsbMidiDevice* device = devices_[index];
81 for (size_t i = 0; i < output_streams_.size(); ++i) { 82 for (size_t i = 0; i < output_streams_.size(); ++i) {
82 if (output_streams_[i]->jack().device == device) { 83 if (output_streams_[i]->jack().device == device) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 input_stream_->Add(jacks[j]); 148 input_stream_->Add(jacks[j]);
148 AddInputPort(MidiPortInfo(id, manufacturer, product_name, version, 149 AddInputPort(MidiPortInfo(id, manufacturer, product_name, version,
149 MIDI_PORT_OPENED)); 150 MIDI_PORT_OPENED));
150 } 151 }
151 } 152 }
152 return true; 153 return true;
153 } 154 }
154 155
155 } // namespace midi 156 } // namespace midi
156 } // namespace media 157 } // namespace media
OLDNEW
« no previous file with comments | « media/midi/midi_manager_alsa_unittest.cc ('k') | media/midi/midi_manager_usb_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698