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

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: 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 ScriptValue;
14
15 class V8ObjectBuilder {
haraken 2015/03/24 14:33:33 Can we add STACK_ALLOCATED?
Jens Widell 2015/03/24 15:16:29 Done.
Jens Widell 2015/03/24 16:22:37 Actually this was a bit problematic. (I didn't not
16 public:
17 V8ObjectBuilder(v8::Isolate*);
haraken 2015/03/24 14:33:33 Add explicit.
Jens Widell 2015/03/24 15:16:29 Done.
18
19 ScriptValue scriptValue() const;
20 v8::Local<v8::Object> v8Value() const { return m_object; }
21 v8::Isolate* isolate() const { return m_isolate; }
22
23 V8ObjectBuilder& add(String name, const ScriptValue&);
24 V8ObjectBuilder& add(String name, const V8ObjectBuilder&);
25
26 V8ObjectBuilder& addNull(String name);
27 V8ObjectBuilder& addBoolean(String name, bool value);
28 V8ObjectBuilder& addNumber(String name, double value);
29 V8ObjectBuilder& addString(String name, String value);
haraken 2015/03/24 14:33:33 Nit: I'd call all of these functions "add".
Jens Widell 2015/03/24 14:51:46 Including addNull()? Also, I think this might pro
30
31 private:
32 void add(String name, v8::Local<v8::Value>);
33
34 v8::Isolate* m_isolate;
35 v8::Local<v8::Object> m_object;
36 };
37
38 } // namespace blink
39
40 #endif // V8ObjectBuilder_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698