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

Side by Side Diff: content/browser/media/midi_host.cc

Issue 1217853007: Web MIDI: add a new UMA entry for the final result code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review #16 Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/media/midi_host.h" 5 #include "content/browser/media/midi_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/process/process.h" 9 #include "base/process/process.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 sent_bytes_in_flight_ += data.size(); 123 sent_bytes_in_flight_ += data.size();
124 } 124 }
125 midi_manager_->DispatchSendMidiData(this, port, data, timestamp); 125 midi_manager_->DispatchSendMidiData(this, port, data, timestamp);
126 } 126 }
127 127
128 void MidiHost::OnEndSession() { 128 void MidiHost::OnEndSession() {
129 is_session_requested_ = false; 129 is_session_requested_ = false;
130 midi_manager_->EndSession(this); 130 midi_manager_->EndSession(this);
131 } 131 }
132 132
133 void MidiHost::CompleteStartSession(media::midi::MidiResult result) { 133 void MidiHost::CompleteStartSession(media::midi::Result result) {
134 DCHECK(is_session_requested_); 134 DCHECK(is_session_requested_);
135 if (result == media::midi::MIDI_OK) { 135 if (result == media::midi::Result::OK) {
136 // ChildSecurityPolicy is set just before OnStartSession by 136 // ChildSecurityPolicy is set just before OnStartSession by
137 // MidiDispatcherHost. So we can safely cache the policy. 137 // MidiDispatcherHost. So we can safely cache the policy.
138 has_sys_ex_permission_ = ChildProcessSecurityPolicyImpl::GetInstance()-> 138 has_sys_ex_permission_ = ChildProcessSecurityPolicyImpl::GetInstance()->
139 CanSendMidiSysExMessage(renderer_process_id_); 139 CanSendMidiSysExMessage(renderer_process_id_);
140 } 140 }
141 Send(new MidiMsg_SessionStarted(result)); 141 Send(new MidiMsg_SessionStarted(result));
142 } 142 }
143 143
144 void MidiHost::AddInputPort(const media::midi::MidiPortInfo& info) { 144 void MidiHost::AddInputPort(const media::midi::MidiPortInfo& info) {
145 base::AutoLock auto_lock(messages_queues_lock_); 145 base::AutoLock auto_lock(messages_queues_lock_);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 243 }
244 waiting_data_length = media::midi::GetMidiMessageLength(current); 244 waiting_data_length = media::midi::GetMidiMessageLength(current);
245 if (waiting_data_length == 0) 245 if (waiting_data_length == 0)
246 return false; // Error: |current| should have been a valid status byte. 246 return false; // Error: |current| should have been a valid status byte.
247 --waiting_data_length; // Found status byte 247 --waiting_data_length; // Found status byte
248 } 248 }
249 return waiting_data_length == 0 && !in_sysex; 249 return waiting_data_length == 0 && !in_sysex;
250 } 250 }
251 251
252 } // namespace content 252 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698