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

Unified Diff: third_party/WebKit/Source/modules/webaudio/AudioParamMap.h

Issue 2793593002: AudioWorklet prototype
Patch Set: Rebase after ThreadedWorkletMessaginProxy change Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webaudio/AudioParamMap.h
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioParamMap.h b/third_party/WebKit/Source/modules/webaudio/AudioParamMap.h
new file mode 100644
index 0000000000000000000000000000000000000000..31b0dc38be8a5c78f4756b3ba60c66afbf3004fe
--- /dev/null
+++ b/third_party/WebKit/Source/modules/webaudio/AudioParamMap.h
@@ -0,0 +1,53 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef AudioParamMap_h
+#define AudioParamMap_h
+
+#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/Maplike.h"
+#include "bindings/core/v8/V8BindingForCore.h"
+#include "platform/heap/Handle.h"
+#include "platform/wtf/text/WTFString.h"
+#include "modules/webaudio/AudioParam.h"
+#include "modules/webaudio/AudioParamDescriptor.h"
+#include "platform/bindings/ScriptWrappable.h"
+
+namespace blink {
+
+class AudioParamMap : public GarbageCollected<AudioParamMap>,
+ public Maplike<String, AudioParam*>,
+ public ScriptWrappable {
+ DEFINE_WRAPPERTYPEINFO();
+
+ public:
+ explicit AudioParamMap() {}
+
+ size_t size() const { return parameter_map_.size(); }
+
+ void AddParameter(const String& name, AudioParam* audio_param) {
+ parameter_map_.insert(name, audio_param);
+ }
+
+ DEFINE_INLINE_VIRTUAL_TRACE() { visitor->Trace(parameter_map_); }
+
+ private:
+ bool GetMapEntry(ScriptState*,
+ const String& key,
+ AudioParam*& audio_param,
+ ExceptionState&) {
+ if (parameter_map_.Contains(key)) {
+ audio_param = parameter_map_.at(key);
+ return true;
+ }
+
+ return false;
+ }
+
+ HeapHashMap<String, Member<AudioParam>> parameter_map_;
+};
+
+} // namespace blink
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698