Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 V8ObjectBuilder_h | |
| 6 #define V8ObjectBuilder_h | |
| 7 | |
| 8 #include "wtf/text/WTFString.h" | |
| 9 #include <v8.h> | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 class ScriptValue; | |
| 14 | |
| 15 class V8ObjectBuilder { | |
| 16 public: | |
| 17 V8ObjectBuilder(v8::Isolate*); | |
| 18 | |
| 19 ScriptValue scriptValue() const; | |
| 20 v8::Local<v8::Object> v8Value() const { return m_object; } | |
| 21 | |
| 22 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
| |
| 23 void addNull(String name); | |
| 24 void addBoolean(String name, bool value); | |
| 25 void addNumber(String name, double value); | |
| 26 void addString(String name, String value); | |
| 27 | |
| 28 V8ObjectBuilder addObject(String name); | |
| 29 | |
| 30 private: | |
| 31 void add(String name, v8::Local<v8::Value>); | |
| 32 | |
| 33 v8::Isolate* m_isolate; | |
| 34 v8::Local<v8::Object> m_object; | |
| 35 }; | |
| 36 | |
| 37 } // namespace blink | |
| 38 | |
| 39 #endif // V8ObjectBuilder_h | |
| OLD | NEW |