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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 MIDIAccess::~MIDIAccess() | 66 MIDIAccess::~MIDIAccess() |
67 { | 67 { |
68 } | 68 } |
69 | 69 |
70 MIDIInputMap* MIDIAccess::inputs() const | 70 MIDIInputMap* MIDIAccess::inputs() const |
71 { | 71 { |
72 HeapHashMap<String, Member<MIDIInput> > inputs; | 72 HeapHashMap<String, Member<MIDIInput>> inputs; |
73 size_t inactiveCount = 0; | 73 size_t inactiveCount = 0; |
74 for (size_t i = 0; i < m_inputs.size(); ++i) { | 74 for (size_t i = 0; i < m_inputs.size(); ++i) { |
75 MIDIInput* input = m_inputs[i]; | 75 MIDIInput* input = m_inputs[i]; |
76 if (input->isActive()) | 76 if (input->isActive()) |
77 inputs.add(input->id(), input); | 77 inputs.add(input->id(), input); |
78 else | 78 else |
79 inactiveCount++; | 79 inactiveCount++; |
80 } | 80 } |
81 if ((inputs.size() + inactiveCount) != m_inputs.size()) { | 81 if ((inputs.size() + inactiveCount) != m_inputs.size()) { |
82 // There is id duplication that violates the spec. | 82 // There is id duplication that violates the spec. |
83 inputs.clear(); | 83 inputs.clear(); |
84 } | 84 } |
85 return new MIDIInputMap(inputs); | 85 return new MIDIInputMap(inputs); |
86 } | 86 } |
87 | 87 |
88 MIDIOutputMap* MIDIAccess::outputs() const | 88 MIDIOutputMap* MIDIAccess::outputs() const |
89 { | 89 { |
90 HeapHashMap<String, Member<MIDIOutput> > outputs; | 90 HeapHashMap<String, Member<MIDIOutput>> outputs; |
91 size_t inactiveCount = 0; | 91 size_t inactiveCount = 0; |
92 for (size_t i = 0; i < m_outputs.size(); ++i) { | 92 for (size_t i = 0; i < m_outputs.size(); ++i) { |
93 MIDIOutput* output = m_outputs[i]; | 93 MIDIOutput* output = m_outputs[i]; |
94 if (output->isActive()) | 94 if (output->isActive()) |
95 outputs.add(output->id(), output); | 95 outputs.add(output->id(), output); |
96 else | 96 else |
97 inactiveCount++; | 97 inactiveCount++; |
98 } | 98 } |
99 if ((outputs.size() + inactiveCount) != m_outputs.size()) { | 99 if ((outputs.size() + inactiveCount) != m_outputs.size()) { |
100 // There is id duplication that violates the spec. | 100 // There is id duplication that violates the spec. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 void MIDIAccess::trace(Visitor* visitor) | 177 void MIDIAccess::trace(Visitor* visitor) |
178 { | 178 { |
179 visitor->trace(m_inputs); | 179 visitor->trace(m_inputs); |
180 visitor->trace(m_outputs); | 180 visitor->trace(m_outputs); |
181 RefCountedGarbageCollectedEventTargetWithInlineData<MIDIAccess>::trace(visit
or); | 181 RefCountedGarbageCollectedEventTargetWithInlineData<MIDIAccess>::trace(visit
or); |
182 ActiveDOMObject::trace(visitor); | 182 ActiveDOMObject::trace(visitor); |
183 } | 183 } |
184 | 184 |
185 } // namespace blink | 185 } // namespace blink |
OLD | NEW |