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

Unified Diff: Source/bindings/core/v8/V8ObjectBuilder.h

Issue 1029093003: [WIP] IDL: Add limited serializer support and use for RTCIceCandidate (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use V8ObjectBuilder in modules/crypto Created 5 years, 9 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: Source/bindings/core/v8/V8ObjectBuilder.h
diff --git a/Source/bindings/core/v8/V8ObjectBuilder.h b/Source/bindings/core/v8/V8ObjectBuilder.h
new file mode 100644
index 0000000000000000000000000000000000000000..aa5689536a2c7355420de25c24d30a1e9a5de4f3
--- /dev/null
+++ b/Source/bindings/core/v8/V8ObjectBuilder.h
@@ -0,0 +1,39 @@
+// Copyright 2015 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 V8ObjectBuilder_h
+#define V8ObjectBuilder_h
+
+#include "wtf/text/WTFString.h"
+#include <v8.h>
+
+namespace blink {
+
+class ScriptValue;
+
+class V8ObjectBuilder {
+public:
+ V8ObjectBuilder(v8::Isolate*);
+
+ ScriptValue scriptValue() const;
+ v8::Local<v8::Object> v8Value() const { return m_object; }
+
+ void add(String name, const ScriptValue&);
bashi 2015/03/24 00:49:05 nit: How about making add methods return *this? Th
Jens Widell 2015/03/24 07:10:03 Yeah, might as well do this, if we drop the curren
+ void addNull(String name);
+ void addBoolean(String name, bool value);
+ void addNumber(String name, double value);
+ void addString(String name, String value);
+
+ V8ObjectBuilder addObject(String name);
+
+private:
+ void add(String name, v8::Local<v8::Value>);
+
+ v8::Isolate* m_isolate;
+ v8::Local<v8::Object> m_object;
+};
+
+} // namespace blink
+
+#endif // V8ObjectBuilder_h

Powered by Google App Engine
This is Rietveld 408576698