Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: Source/modules/webmidi/MIDIPortMap.h

Issue 864533002: Fix template angle bracket syntax in modules (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "bindings/core/v8/V8Binding.h" 11 #include "bindings/core/v8/V8Binding.h"
12 #include "bindings/core/v8/V8IteratorResultValue.h" 12 #include "bindings/core/v8/V8IteratorResultValue.h"
13 #include "core/dom/Iterator.h" 13 #include "core/dom/Iterator.h"
14 #include "platform/heap/Handle.h" 14 #include "platform/heap/Handle.h"
15 #include "wtf/HashMap.h" 15 #include "wtf/HashMap.h"
16 #include "wtf/text/StringHash.h" 16 #include "wtf/text/StringHash.h"
17 #include "wtf/text/WTFString.h" 17 #include "wtf/text/WTFString.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 template <typename T> 21 template <typename T>
22 class MIDIPortMap : public GarbageCollected<MIDIPortMap<T> > { 22 class MIDIPortMap : public GarbageCollected<MIDIPortMap<T>> {
23 public: 23 public:
24 explicit MIDIPortMap(const HeapHashMap<String, Member<T> >& entries) : m_ent ries(entries) { } 24 explicit MIDIPortMap(const HeapHashMap<String, Member<T>>& entries) : m_entr ies(entries) { }
25 25
26 // IDL attributes / methods 26 // IDL attributes / methods
27 size_t size() const { return m_entries.size(); } 27 size_t size() const { return m_entries.size(); }
28 Iterator* keys(); 28 Iterator* keys();
29 Iterator* entries(); 29 Iterator* entries();
30 Iterator* values(); 30 Iterator* values();
31 T* get(const String& key) const; 31 T* get(const String& key) const;
32 bool has(const String& key) const { return m_entries.contains(key); } 32 bool has(const String& key) const { return m_entries.contains(key); }
33 Iterator* iterator(ScriptState*, ExceptionState&) { return entries(); } 33 Iterator* iterator(ScriptState*, ExceptionState&) { return entries(); }
34 34
35 virtual void trace(Visitor* visitor) 35 virtual void trace(Visitor* visitor)
36 { 36 {
37 visitor->trace(m_entries); 37 visitor->trace(m_entries);
38 } 38 }
39 39
40 private: 40 private:
41 typedef HeapHashMap<String, Member<T> > MapType; 41 typedef HeapHashMap<String, Member<T>> MapType;
42 typedef typename HeapHashMap<String, Member<T> >::const_iterator IteratorTyp e; 42 typedef typename HeapHashMap<String, Member<T>>::const_iterator IteratorType ;
43 struct KeySelector { 43 struct KeySelector {
44 static const String& select(ScriptState*, IteratorType i) { return i->ke y; } 44 static const String& select(ScriptState*, IteratorType i) { return i->ke y; }
45 }; 45 };
46 struct ValueSelector { 46 struct ValueSelector {
47 static T* select(ScriptState*, IteratorType i) { return i->value; } 47 static T* select(ScriptState*, IteratorType i) { return i->value; }
48 }; 48 };
49 struct EntrySelector { 49 struct EntrySelector {
50 static Vector<ScriptValue> select(ScriptState* scriptState, IteratorType i) 50 static Vector<ScriptValue> select(ScriptState* scriptState, IteratorType i)
51 { 51 {
52 Vector<ScriptValue> entry; 52 Vector<ScriptValue> entry;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 virtual void trace(Visitor* visitor) override 85 virtual void trace(Visitor* visitor) override
86 { 86 {
87 visitor->trace(m_map); 87 visitor->trace(m_map);
88 Iterator::trace(visitor); 88 Iterator::trace(visitor);
89 } 89 }
90 90
91 private: 91 private:
92 // m_map is stored just for keeping it alive. It needs to be kept 92 // m_map is stored just for keeping it alive. It needs to be kept
93 // alive while JavaScript holds the iterator to it. 93 // alive while JavaScript holds the iterator to it.
94 const Member<const MIDIPortMap<T> > m_map; 94 const Member<const MIDIPortMap<T>> m_map;
95 IteratorType m_iterator; 95 IteratorType m_iterator;
96 const IteratorType m_end; 96 const IteratorType m_end;
97 }; 97 };
98 98
99 const MapType m_entries; 99 const MapType m_entries;
100 }; 100 };
101 101
102 template <typename T> 102 template <typename T>
103 Iterator* MIDIPortMap<T>::keys() 103 Iterator* MIDIPortMap<T>::keys()
104 { 104 {
(...skipping 14 matching lines...) Expand all
119 119
120 template <typename T> 120 template <typename T>
121 T* MIDIPortMap<T>::get(const String& key) const 121 T* MIDIPortMap<T>::get(const String& key) const
122 { 122 {
123 return has(key) ? m_entries.get(key) : 0; 123 return has(key) ? m_entries.get(key) : 0;
124 } 124 }
125 125
126 } // namespace blink 126 } // namespace blink
127 127
128 #endif 128 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698