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 "platform/heap/Heap.h" | |
haraken
2015/03/24 15:26:25
Heap.h => Handle.h (We normally include Handle.h.)
| |
9 #include "wtf/text/WTFString.h" | |
10 #include <v8.h> | |
11 | |
12 namespace blink { | |
13 | |
14 class ScriptState; | |
15 class ScriptValue; | |
16 | |
17 class V8ObjectBuilder { | |
18 STACK_ALLOCATED(); | |
19 public: | |
20 explicit V8ObjectBuilder(ScriptState*); | |
21 | |
22 ScriptState* scriptState() const { return m_scriptState.get(); } | |
23 | |
24 V8ObjectBuilder& add(String name, const ScriptValue&); | |
25 V8ObjectBuilder& add(String name, const V8ObjectBuilder&); | |
26 | |
27 V8ObjectBuilder& addNull(String name); | |
28 V8ObjectBuilder& addBoolean(String name, bool value); | |
29 V8ObjectBuilder& addNumber(String name, double value); | |
30 V8ObjectBuilder& addString(String name, String value); | |
31 | |
32 ScriptValue scriptValue() const; | |
33 v8::Local<v8::Object> v8Value() const { return m_object; } | |
34 | |
35 private: | |
36 void add(String name, v8::Local<v8::Value>); | |
37 | |
38 RefPtr<ScriptState> m_scriptState; | |
39 v8::Local<v8::Object> m_object; | |
40 }; | |
41 | |
42 } // namespace blink | |
43 | |
44 #endif // V8ObjectBuilder_h | |
OLD | NEW |