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 |