OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 const ScriptValue& value, | 64 const ScriptValue& value, |
65 ExceptionState& exceptionState, | 65 ExceptionState& exceptionState, |
66 Arguments const&... arguments) { | 66 Arguments const&... arguments) { |
67 return to<T>(isolate, value.v8Value(), exceptionState, arguments...); | 67 return to<T>(isolate, value.v8Value(), exceptionState, arguments...); |
68 } | 68 } |
69 | 69 |
70 ScriptValue() {} | 70 ScriptValue() {} |
71 | 71 |
72 ScriptValue(ScriptState* scriptState, v8::Local<v8::Value> value) | 72 ScriptValue(ScriptState* scriptState, v8::Local<v8::Value> value) |
73 : m_scriptState(scriptState), | 73 : m_scriptState(scriptState), |
74 m_value(value.IsEmpty() ? nullptr : SharedPersistent<v8::Value>::create( | 74 m_value(value.IsEmpty() ? nullptr |
75 value, | 75 : SharedPersistent<v8::Value>::create( |
76 scriptState->isolate())) { | 76 value, |
| 77 scriptState->isolate())) { |
77 ASSERT(isEmpty() || m_scriptState); | 78 ASSERT(isEmpty() || m_scriptState); |
78 } | 79 } |
79 | 80 |
80 template <typename T> | 81 template <typename T> |
81 ScriptValue(ScriptState* scriptState, v8::MaybeLocal<T> value) | 82 ScriptValue(ScriptState* scriptState, v8::MaybeLocal<T> value) |
82 : m_scriptState(scriptState), | 83 : m_scriptState(scriptState), |
83 m_value(value.IsEmpty() ? nullptr : SharedPersistent<v8::Value>::create( | 84 m_value(value.IsEmpty() ? nullptr |
84 value.ToLocalChecked(), | 85 : SharedPersistent<v8::Value>::create( |
85 scriptState->isolate())) { | 86 value.ToLocalChecked(), |
| 87 scriptState->isolate())) { |
86 ASSERT(isEmpty() || m_scriptState); | 88 ASSERT(isEmpty() || m_scriptState); |
87 } | 89 } |
88 | 90 |
89 ScriptValue(const ScriptValue& value) | 91 ScriptValue(const ScriptValue& value) |
90 : m_scriptState(value.m_scriptState), m_value(value.m_value) { | 92 : m_scriptState(value.m_scriptState), m_value(value.m_value) { |
91 ASSERT(isEmpty() || m_scriptState); | 93 ASSERT(isEmpty() || m_scriptState); |
92 } | 94 } |
93 | 95 |
94 ScriptState* getScriptState() const { return m_scriptState.get(); } | 96 ScriptState* getScriptState() const { return m_scriptState.get(); } |
95 | 97 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 static ScriptValue createNull(ScriptState*); | 169 static ScriptValue createNull(ScriptState*); |
168 | 170 |
169 private: | 171 private: |
170 RefPtr<ScriptState> m_scriptState; | 172 RefPtr<ScriptState> m_scriptState; |
171 RefPtr<SharedPersistent<v8::Value>> m_value; | 173 RefPtr<SharedPersistent<v8::Value>> m_value; |
172 }; | 174 }; |
173 | 175 |
174 } // namespace blink | 176 } // namespace blink |
175 | 177 |
176 #endif // ScriptValue_h | 178 #endif // ScriptValue_h |
OLD | NEW |