| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "modules/webmidi/MIDIAccessor.h" | 31 #include "modules/webmidi/MIDIAccessor.h" |
| 32 | 32 |
| 33 #include <memory> | 33 #include <memory> |
| 34 #include "modules/webmidi/MIDIAccessorClient.h" | 34 #include "modules/webmidi/MIDIAccessorClient.h" |
| 35 #include "platform/wtf/PtrUtil.h" | 35 #include "platform/wtf/PtrUtil.h" |
| 36 #include "platform/wtf/text/WTFString.h" | 36 #include "platform/wtf/text/WTFString.h" |
| 37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 38 #include "public/platform/modules/webmidi/WebMIDIAccessor.h" |
| 38 | 39 |
| 39 using blink::WebString; | 40 using blink::WebString; |
| 40 using midi::mojom::PortState; | 41 using midi::mojom::PortState; |
| 41 using midi::mojom::Result; | 42 using midi::mojom::Result; |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 // Factory method | 46 // Factory method |
| 46 std::unique_ptr<MIDIAccessor> MIDIAccessor::Create(MIDIAccessorClient* client) { | 47 std::unique_ptr<MIDIAccessor> MIDIAccessor::Create(MIDIAccessorClient* client) { |
| 47 return WTF::WrapUnique(new MIDIAccessor(client)); | 48 return WTF::WrapUnique(new MIDIAccessor(client)); |
| 48 } | 49 } |
| 49 | 50 |
| 50 MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client) : client_(client) { | 51 MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client) : client_(client) { |
| 51 DCHECK(client); | 52 DCHECK(client); |
| 52 | 53 |
| 53 accessor_ = WTF::WrapUnique(Platform::Current()->CreateMIDIAccessor(this)); | 54 accessor_ = Platform::Current()->CreateMIDIAccessor(this); |
| 54 | 55 |
| 55 DCHECK(accessor_); | 56 DCHECK(accessor_); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void MIDIAccessor::StartSession() { | 59 void MIDIAccessor::StartSession() { |
| 59 accessor_->StartSession(); | 60 accessor_->StartSession(); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void MIDIAccessor::SendMIDIData(unsigned port_index, | 63 void MIDIAccessor::SendMIDIData(unsigned port_index, |
| 63 const unsigned char* data, | 64 const unsigned char* data, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 96 } |
| 96 | 97 |
| 97 void MIDIAccessor::DidReceiveMIDIData(unsigned port_index, | 98 void MIDIAccessor::DidReceiveMIDIData(unsigned port_index, |
| 98 const unsigned char* data, | 99 const unsigned char* data, |
| 99 size_t length, | 100 size_t length, |
| 100 double time_stamp) { | 101 double time_stamp) { |
| 101 client_->DidReceiveMIDIData(port_index, data, length, time_stamp); | 102 client_->DidReceiveMIDIData(port_index, data, length, time_stamp); |
| 102 } | 103 } |
| 103 | 104 |
| 104 } // namespace blink | 105 } // namespace blink |
| OLD | NEW |