Fix crash on app list start page contents not existing.
[chromium-blink-merge.git] / content / renderer / media / renderer_webmidiaccessor_impl.cc
blobb67f48a7ae69447c6a1c2ed6949764081fa60979
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
3 // found in the LICENSE file.
5 #include "content/renderer/media/renderer_webmidiaccessor_impl.h"
7 #include "base/logging.h"
8 #include "content/renderer/media/midi_message_filter.h"
9 #include "content/renderer/render_thread_impl.h"
11 namespace content {
13 RendererWebMIDIAccessorImpl::RendererWebMIDIAccessorImpl(
14 blink::WebMIDIAccessorClient* client)
15 : client_(client) {
16 DCHECK(client_);
19 RendererWebMIDIAccessorImpl::~RendererWebMIDIAccessorImpl() {
20 midi_message_filter()->RemoveClient(client_);
23 void RendererWebMIDIAccessorImpl::startSession() {
24 midi_message_filter()->AddClient(client_);
27 void RendererWebMIDIAccessorImpl::sendMIDIData(
28 unsigned port_index,
29 const unsigned char* data,
30 size_t length,
31 double timestamp) {
32 midi_message_filter()->SendMidiData(
33 port_index,
34 data,
35 length,
36 timestamp);
39 MidiMessageFilter* RendererWebMIDIAccessorImpl::midi_message_filter() {
40 return RenderThreadImpl::current()->midi_message_filter();
43 } // namespace content