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 ScriptState; | |
14 class ScriptValue; | |
15 | |
16 class V8ObjectBuilder { | |
bashi
2015/03/25 01:09:25
nit: Add final
Jens Widell
2015/03/25 11:16:04
Done.
| |
17 public: | |
18 explicit V8ObjectBuilder(ScriptState*); | |
19 | |
20 ScriptState* scriptState() const { return m_scriptState.get(); } | |
21 | |
22 V8ObjectBuilder& add(String name, const ScriptValue&); | |
23 V8ObjectBuilder& add(String name, const V8ObjectBuilder&); | |
24 | |
25 V8ObjectBuilder& addNull(String name); | |
26 V8ObjectBuilder& addBoolean(String name, bool value); | |
27 V8ObjectBuilder& addNumber(String name, double value); | |
28 V8ObjectBuilder& addString(String name, String value); | |
29 | |
30 ScriptValue scriptValue() const; | |
31 v8::Local<v8::Object> v8Value() const { return m_object; } | |
32 | |
33 private: | |
34 void add(String name, v8::Local<v8::Value>); | |
35 | |
36 RefPtr<ScriptState> m_scriptState; | |
37 v8::Local<v8::Object> m_object; | |
38 }; | |
39 | |
40 } // namespace blink | |
41 | |
42 #endif // V8ObjectBuilder_h | |
OLD | NEW |