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

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: drop STACK_ALLOCATED 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
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 "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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698