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

Unified Diff: media/midi/java/src/org/chromium/media/midi/MidiOutputPortAndroid.java

Issue 2418493002: //media/midi: use top level namespace midi rather than media.midi (Closed)
Patch Set: TAG name change s/media_midi/midi/ Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: media/midi/java/src/org/chromium/media/midi/MidiOutputPortAndroid.java
diff --git a/media/midi/java/src/org/chromium/media/midi/MidiOutputPortAndroid.java b/media/midi/java/src/org/chromium/media/midi/MidiOutputPortAndroid.java
deleted file mode 100644
index 00ff9a0ff785596070f911ce2a0ebe1ae1a951f3..0000000000000000000000000000000000000000
--- a/media/midi/java/src/org/chromium/media/midi/MidiOutputPortAndroid.java
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.media.midi;
-
-import android.annotation.TargetApi;
-import android.media.midi.MidiDevice;
-import android.media.midi.MidiInputPort;
-import android.os.Build;
-
-import org.chromium.base.Log;
-import org.chromium.base.annotations.CalledByNative;
-import org.chromium.base.annotations.JNINamespace;
-
-import java.io.IOException;
-
-/**
- * A class implementing media::midi::MidiOutputPortAndroid functionality.
- */
-// Note "OutputPort" is named in the Web MIDI manner. It corresponds to MidiInputPort class in the
-// Android API.
-@JNINamespace("media::midi")
-@TargetApi(Build.VERSION_CODES.M)
-class MidiOutputPortAndroid {
- /**
- * The underlying port.
- */
- private MidiInputPort mPort;
- /**
- * The device this port belongs to.
- */
- private final MidiDevice mDevice;
- /**
- * The index of the port in the associated device.
- */
- private final int mIndex;
-
- private static final String TAG = "media_midi";
-
- /**
- * constructor
- * @param device The device this port belongs to.
- * @param index The index of the port in the associated device.
- */
- MidiOutputPortAndroid(MidiDevice device, int index) {
- mDevice = device;
- mIndex = index;
- }
-
- /**
- * Opens this port.
- * @return true when the operation succeeds or the port is already open.
- */
- @CalledByNative
- boolean open() {
- if (mPort != null) {
- return true;
- }
- mPort = mDevice.openInputPort(mIndex);
- return mPort != null;
- }
-
- /**
- * Sends the data to the underlying output port.
- */
- @CalledByNative
- void send(byte[] bs) {
- if (mPort == null) {
- return;
- }
- try {
- mPort.send(bs, 0, bs.length);
- } catch (IOException e) {
- // We can do nothing here. Just ignore the error.
- Log.e(TAG, "MidiOutputPortAndroid.send: " + e);
- }
- }
-
- /**
- * Closes the port.
- */
- @CalledByNative
- void close() {
- if (mPort == null) {
- return;
- }
- try {
- mPort.close();
- } catch (IOException e) {
- // We can do nothing here. Just ignore the error.
- }
- mPort = null;
- }
-}

Powered by Google App Engine
This is Rietveld 408576698