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..e8f5a8ee9875c8e656fa0d6a6fa17f6f10eb79cd |
--- /dev/null |
+++ b/Source/bindings/core/v8/V8ObjectBuilder.h |
@@ -0,0 +1,40 @@ |
+// 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 { |
haraken
2015/03/24 14:33:33
Can we add STACK_ALLOCATED?
Jens Widell
2015/03/24 15:16:29
Done.
Jens Widell
2015/03/24 16:22:37
Actually this was a bit problematic. (I didn't not
|
+public: |
+ V8ObjectBuilder(v8::Isolate*); |
haraken
2015/03/24 14:33:33
Add explicit.
Jens Widell
2015/03/24 15:16:29
Done.
|
+ |
+ ScriptValue scriptValue() const; |
+ v8::Local<v8::Object> v8Value() const { return m_object; } |
+ v8::Isolate* isolate() const { return m_isolate; } |
+ |
+ V8ObjectBuilder& add(String name, const ScriptValue&); |
+ V8ObjectBuilder& add(String name, const V8ObjectBuilder&); |
+ |
+ V8ObjectBuilder& addNull(String name); |
+ V8ObjectBuilder& addBoolean(String name, bool value); |
+ V8ObjectBuilder& addNumber(String name, double value); |
+ V8ObjectBuilder& addString(String name, String value); |
haraken
2015/03/24 14:33:33
Nit: I'd call all of these functions "add".
Jens Widell
2015/03/24 14:51:46
Including addNull()?
Also, I think this might pro
|
+ |
+private: |
+ void add(String name, v8::Local<v8::Value>); |
+ |
+ v8::Isolate* m_isolate; |
+ v8::Local<v8::Object> m_object; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // V8ObjectBuilder_h |