OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef AudioParamMap_h |
| 6 #define AudioParamMap_h |
| 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/Maplike.h" |
| 10 #include "bindings/core/v8/V8BindingForCore.h" |
| 11 #include "platform/heap/Handle.h" |
| 12 #include "platform/wtf/text/WTFString.h" |
| 13 #include "modules/webaudio/AudioParam.h" |
| 14 #include "modules/webaudio/AudioParamDescriptor.h" |
| 15 #include "platform/bindings/ScriptWrappable.h" |
| 16 |
| 17 namespace blink { |
| 18 |
| 19 class AudioParamMap : public GarbageCollected<AudioParamMap>, |
| 20 public Maplike<String, AudioParam*>, |
| 21 public ScriptWrappable { |
| 22 DEFINE_WRAPPERTYPEINFO(); |
| 23 |
| 24 public: |
| 25 explicit AudioParamMap() {} |
| 26 |
| 27 size_t size() const { return parameter_map_.size(); } |
| 28 |
| 29 void AddParameter(const String& name, AudioParam* audio_param) { |
| 30 parameter_map_.insert(name, audio_param); |
| 31 } |
| 32 |
| 33 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->Trace(parameter_map_); } |
| 34 |
| 35 private: |
| 36 bool GetMapEntry(ScriptState*, |
| 37 const String& key, |
| 38 AudioParam*& audio_param, |
| 39 ExceptionState&) { |
| 40 if (parameter_map_.Contains(key)) { |
| 41 audio_param = parameter_map_.at(key); |
| 42 return true; |
| 43 } |
| 44 |
| 45 return false; |
| 46 } |
| 47 |
| 48 HeapHashMap<String, Member<AudioParam>> parameter_map_; |
| 49 }; |
| 50 |
| 51 } // namespace blink |
| 52 |
| 53 #endif |
OLD | NEW |