| OLD | NEW |
| 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 18 matching lines...) Expand all Loading... |
| 29 V8ObjectBuilder& addNull(const StringView& name); | 29 V8ObjectBuilder& addNull(const StringView& name); |
| 30 V8ObjectBuilder& addBoolean(const StringView& name, bool value); | 30 V8ObjectBuilder& addBoolean(const StringView& name, bool value); |
| 31 V8ObjectBuilder& addNumber(const StringView& name, double value); | 31 V8ObjectBuilder& addNumber(const StringView& name, double value); |
| 32 V8ObjectBuilder& addString(const StringView& name, const StringView& value); | 32 V8ObjectBuilder& addString(const StringView& name, const StringView& value); |
| 33 V8ObjectBuilder& addStringOrNull(const StringView& name, | 33 V8ObjectBuilder& addStringOrNull(const StringView& name, |
| 34 const StringView& value); | 34 const StringView& value); |
| 35 | 35 |
| 36 template <typename T> | 36 template <typename T> |
| 37 V8ObjectBuilder& add(const StringView& name, const T& value) { | 37 V8ObjectBuilder& add(const StringView& name, const T& value) { |
| 38 addInternal(name, v8::Local<v8::Value>( | 38 addInternal(name, v8::Local<v8::Value>( |
| 39 toV8(value, m_scriptState->context()->Global(), | 39 ToV8(value, m_scriptState->context()->Global(), |
| 40 m_scriptState->isolate()))); | 40 m_scriptState->isolate()))); |
| 41 return *this; | 41 return *this; |
| 42 } | 42 } |
| 43 | 43 |
| 44 ScriptValue scriptValue() const; | 44 ScriptValue scriptValue() const; |
| 45 v8::Local<v8::Object> v8Value() const { return m_object; } | 45 v8::Local<v8::Object> v8Value() const { return m_object; } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 void addInternal(const StringView& name, v8::Local<v8::Value>); | 48 void addInternal(const StringView& name, v8::Local<v8::Value>); |
| 49 | 49 |
| 50 RefPtr<ScriptState> m_scriptState; | 50 RefPtr<ScriptState> m_scriptState; |
| 51 v8::Local<v8::Object> m_object; | 51 v8::Local<v8::Object> m_object; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace blink | 54 } // namespace blink |
| 55 | 55 |
| 56 #endif // V8ObjectBuilder_h | 56 #endif // V8ObjectBuilder_h |
| OLD | NEW |