OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MIDIPortMap_h | 5 #ifndef MIDIPortMap_h |
6 #define MIDIPortMap_h | 6 #define MIDIPortMap_h |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "bindings/core/v8/ScriptValue.h" | 10 #include "bindings/core/v8/ScriptValue.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 template <typename Selector> | 60 template <typename Selector> |
61 class MapIterator : public Iterator { | 61 class MapIterator : public Iterator { |
62 public: | 62 public: |
63 MapIterator(MIDIPortMap<T>* map, IteratorType iterator, IteratorType end
) | 63 MapIterator(MIDIPortMap<T>* map, IteratorType iterator, IteratorType end
) |
64 : m_map(map) | 64 : m_map(map) |
65 , m_iterator(iterator) | 65 , m_iterator(iterator) |
66 , m_end(end) | 66 , m_end(end) |
67 { | 67 { |
68 } | 68 } |
69 | 69 |
70 virtual ScriptValue next(ScriptState* scriptState, ExceptionState&) OVER
RIDE | 70 virtual ScriptValue next(ScriptState* scriptState, ExceptionState&) over
ride |
71 { | 71 { |
72 if (m_iterator == m_end) | 72 if (m_iterator == m_end) |
73 return ScriptValue(scriptState, v8DoneIteratorResult(scriptState
->isolate())); | 73 return ScriptValue(scriptState, v8DoneIteratorResult(scriptState
->isolate())); |
74 ScriptValue result(scriptState, v8IteratorResult(scriptState, Select
or::select(scriptState, m_iterator))); | 74 ScriptValue result(scriptState, v8IteratorResult(scriptState, Select
or::select(scriptState, m_iterator))); |
75 ++m_iterator; | 75 ++m_iterator; |
76 return result; | 76 return result; |
77 } | 77 } |
78 | 78 |
79 virtual ScriptValue next(ScriptState* scriptState, ScriptValue, Exceptio
nState& exceptionState) OVERRIDE | 79 virtual ScriptValue next(ScriptState* scriptState, ScriptValue, Exceptio
nState& exceptionState) override |
80 { | 80 { |
81 return next(scriptState, exceptionState); | 81 return next(scriptState, exceptionState); |
82 } | 82 } |
83 | 83 |
84 virtual void trace(Visitor* visitor) OVERRIDE | 84 virtual void trace(Visitor* visitor) override |
85 { | 85 { |
86 visitor->trace(m_map); | 86 visitor->trace(m_map); |
87 Iterator::trace(visitor); | 87 Iterator::trace(visitor); |
88 } | 88 } |
89 | 89 |
90 private: | 90 private: |
91 // m_map is stored just for keeping it alive. It needs to be kept | 91 // m_map is stored just for keeping it alive. It needs to be kept |
92 // alive while JavaScript holds the iterator to it. | 92 // alive while JavaScript holds the iterator to it. |
93 const Member<const MIDIPortMap<T> > m_map; | 93 const Member<const MIDIPortMap<T> > m_map; |
94 IteratorType m_iterator; | 94 IteratorType m_iterator; |
(...skipping 23 matching lines...) Expand all Loading... |
118 | 118 |
119 template <typename T> | 119 template <typename T> |
120 T* MIDIPortMap<T>::get(const String& key) const | 120 T* MIDIPortMap<T>::get(const String& key) const |
121 { | 121 { |
122 return has(key) ? m_entries.get(key) : 0; | 122 return has(key) ? m_entries.get(key) : 0; |
123 } | 123 } |
124 | 124 |
125 } // namespace blink | 125 } // namespace blink |
126 | 126 |
127 #endif | 127 #endif |
OLD | NEW |