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" |
35 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
| 37 #include <memory> |
36 | 38 |
37 using blink::WebString; | 39 using blink::WebString; |
38 | 40 |
39 namespace blink { | 41 namespace blink { |
40 | 42 |
41 // Factory method | 43 // Factory method |
42 PassOwnPtr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) | 44 std::unique_ptr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) |
43 { | 45 { |
44 return adoptPtr(new MIDIAccessor(client)); | 46 return wrapUnique(new MIDIAccessor(client)); |
45 } | 47 } |
46 | 48 |
47 MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client) | 49 MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client) |
48 : m_client(client) | 50 : m_client(client) |
49 { | 51 { |
50 DCHECK(client); | 52 DCHECK(client); |
51 | 53 |
52 m_accessor = adoptPtr(Platform::current()->createMIDIAccessor(this)); | 54 m_accessor = wrapUnique(Platform::current()->createMIDIAccessor(this)); |
53 | 55 |
54 DCHECK(m_accessor); | 56 DCHECK(m_accessor); |
55 } | 57 } |
56 | 58 |
57 void MIDIAccessor::startSession() | 59 void MIDIAccessor::startSession() |
58 { | 60 { |
59 m_accessor->startSession(); | 61 m_accessor->startSession(); |
60 } | 62 } |
61 | 63 |
62 void MIDIAccessor::sendMIDIData(unsigned portIndex, const unsigned char* data, s
ize_t length, double timeStamp) | 64 void MIDIAccessor::sendMIDIData(unsigned portIndex, const unsigned char* data, s
ize_t length, double timeStamp) |
(...skipping 25 matching lines...) Expand all Loading... |
88 { | 90 { |
89 m_client->didStartSession(success, error, message); | 91 m_client->didStartSession(success, error, message); |
90 } | 92 } |
91 | 93 |
92 void MIDIAccessor::didReceiveMIDIData(unsigned portIndex, const unsigned char* d
ata, size_t length, double timeStamp) | 94 void MIDIAccessor::didReceiveMIDIData(unsigned portIndex, const unsigned char* d
ata, size_t length, double timeStamp) |
93 { | 95 { |
94 m_client->didReceiveMIDIData(portIndex, data, length, timeStamp); | 96 m_client->didReceiveMIDIData(portIndex, data, length, timeStamp); |
95 } | 97 } |
96 | 98 |
97 } // namespace blink | 99 } // namespace blink |
OLD | NEW |