Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Side by Side Diff: Source/bindings/core/v8/V8ObjectBuilder.h

Issue 1031783003: Add V8ObjectBuilder helper and use in modules/crypto/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use ScriptState Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/bindings/core/v8/Dictionary.cpp ('k') | Source/bindings/core/v8/V8ObjectBuilder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/Dictionary.cpp ('k') | Source/bindings/core/v8/V8ObjectBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698