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

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

Issue 2476393003: V8ObjectBuilder::addString support Nullable. (Closed)
Patch Set: Add V8ObjectBuilderTest Created 4 years, 1 month 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8ObjectBuilder_h 5 #ifndef V8ObjectBuilder_h
6 #define V8ObjectBuilder_h 6 #define V8ObjectBuilder_h
7 7
8 #include "bindings/core/v8/ToV8.h" 8 #include "bindings/core/v8/ToV8.h"
9 #include "core/CoreExport.h" 9 #include "core/CoreExport.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
(...skipping 11 matching lines...) Expand all
22 public: 22 public:
23 explicit V8ObjectBuilder(ScriptState*); 23 explicit V8ObjectBuilder(ScriptState*);
24 24
25 ScriptState* getScriptState() const { return m_scriptState.get(); } 25 ScriptState* getScriptState() const { return m_scriptState.get(); }
26 26
27 V8ObjectBuilder& add(const String& name, const V8ObjectBuilder&); 27 V8ObjectBuilder& add(const String& name, const V8ObjectBuilder&);
28 28
29 V8ObjectBuilder& addNull(const String& name); 29 V8ObjectBuilder& addNull(const String& name);
30 V8ObjectBuilder& addBoolean(const String& name, bool value); 30 V8ObjectBuilder& addBoolean(const String& name, bool value);
31 V8ObjectBuilder& addNumber(const String& name, double value); 31 V8ObjectBuilder& addNumber(const String& name, double value);
32 V8ObjectBuilder& addString(const String& name, const String& value); 32 V8ObjectBuilder& addString(const String& name,
Yuki 2016/11/09 07:25:50 It's okay to follow the old style, but const S
33 const String& value,
34 bool isNullable = false);
Yuki 2016/11/09 07:25:50 In general, we should avoid a boolean flag, I thin
33 35
34 template <typename T> 36 template <typename T>
35 V8ObjectBuilder& add(const String& name, const T& value) { 37 V8ObjectBuilder& add(const String& name, const T& value) {
36 addInternal(name, v8::Local<v8::Value>( 38 addInternal(name, v8::Local<v8::Value>(
37 toV8(value, m_scriptState->context()->Global(), 39 toV8(value, m_scriptState->context()->Global(),
38 m_scriptState->isolate()))); 40 m_scriptState->isolate())));
39 return *this; 41 return *this;
40 } 42 }
41 43
42 ScriptValue scriptValue() const; 44 ScriptValue scriptValue() const;
43 v8::Local<v8::Object> v8Value() const { return m_object; } 45 v8::Local<v8::Object> v8Value() const { return m_object; }
44 46
45 private: 47 private:
46 void addInternal(const String& name, v8::Local<v8::Value>); 48 void addInternal(const String& name, v8::Local<v8::Value>);
47 49
48 RefPtr<ScriptState> m_scriptState; 50 RefPtr<ScriptState> m_scriptState;
49 v8::Local<v8::Object> m_object; 51 v8::Local<v8::Object> m_object;
50 }; 52 };
51 53
52 } // namespace blink 54 } // namespace blink
53 55
54 #endif // V8ObjectBuilder_h 56 #endif // V8ObjectBuilder_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/bindings.gni ('k') | third_party/WebKit/Source/bindings/core/v8/V8ObjectBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698