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 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
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 "modules/webmidi/MIDIAccessorClient.h" | 33 #include "modules/webmidi/MIDIAccessorClient.h" |
34 #include "public/platform/Platform.h" | 34 #include "public/platform/Platform.h" |
35 #include "wtf/PtrUtil.h" | |
36 #include "wtf/text/WTFString.h" | 35 #include "wtf/text/WTFString.h" |
37 #include <memory> | |
38 | 36 |
39 using blink::WebString; | 37 using blink::WebString; |
40 | 38 |
41 namespace blink { | 39 namespace blink { |
42 | 40 |
43 // Factory method | 41 // Factory method |
44 std::unique_ptr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) | 42 PassOwnPtr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) |
45 { | 43 { |
46 return wrapUnique(new MIDIAccessor(client)); | 44 return adoptPtr(new MIDIAccessor(client)); |
47 } | 45 } |
48 | 46 |
49 MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client) | 47 MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client) |
50 : m_client(client) | 48 : m_client(client) |
51 { | 49 { |
52 DCHECK(client); | 50 DCHECK(client); |
53 | 51 |
54 m_accessor = wrapUnique(Platform::current()->createMIDIAccessor(this)); | 52 m_accessor = adoptPtr(Platform::current()->createMIDIAccessor(this)); |
55 | 53 |
56 DCHECK(m_accessor); | 54 DCHECK(m_accessor); |
57 } | 55 } |
58 | 56 |
59 void MIDIAccessor::startSession() | 57 void MIDIAccessor::startSession() |
60 { | 58 { |
61 m_accessor->startSession(); | 59 m_accessor->startSession(); |
62 } | 60 } |
63 | 61 |
64 void MIDIAccessor::sendMIDIData(unsigned portIndex, const unsigned char* data, s
ize_t length, double timeStamp) | 62 void MIDIAccessor::sendMIDIData(unsigned portIndex, const unsigned char* data, s
ize_t length, double timeStamp) |
(...skipping 25 matching lines...) Expand all Loading... |
90 { | 88 { |
91 m_client->didStartSession(success, error, message); | 89 m_client->didStartSession(success, error, message); |
92 } | 90 } |
93 | 91 |
94 void MIDIAccessor::didReceiveMIDIData(unsigned portIndex, const unsigned char* d
ata, size_t length, double timeStamp) | 92 void MIDIAccessor::didReceiveMIDIData(unsigned portIndex, const unsigned char* d
ata, size_t length, double timeStamp) |
95 { | 93 { |
96 m_client->didReceiveMIDIData(portIndex, data, length, timeStamp); | 94 m_client->didReceiveMIDIData(portIndex, data, length, timeStamp); |
97 } | 95 } |
98 | 96 |
99 } // namespace blink | 97 } // namespace blink |
OLD | NEW |