| 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 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ScriptValue_h | 31 #ifndef ScriptValue_h |
| 32 #define ScriptValue_h | 32 #define ScriptValue_h |
| 33 | 33 |
| 34 #include "bindings/common/AbstractScriptValue.h" | 34 #include "bindings/common/AbstractScriptValue.h" |
| 35 #include "bindings/v8/SharedPersistent.h" | 35 #include "bindings/v8/SharedPersistent.h" |
| 36 #include "bindings/v8/V8ScriptValue.h" | 36 #include "bindings/v8/V8ScriptValue.h" |
| 37 #include "bindings/dart/DartScriptValue.h" |
| 37 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
| 38 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 39 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 40 #include <v8.h> | 41 #include <v8.h> |
| 41 | 42 |
| 42 namespace WebCore { | 43 namespace WebCore { |
| 43 | 44 |
| 44 class JSONValue; | 45 class JSONValue; |
| 45 class ScriptState; | 46 class ScriptState; |
| 46 | 47 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 { | 84 { |
| 84 return ScriptValue(V8ScriptValue::createBoolean(b)); | 85 return ScriptValue(V8ScriptValue::createBoolean(b)); |
| 85 } | 86 } |
| 86 | 87 |
| 87 v8::Isolate* isolate() const | 88 v8::Isolate* isolate() const |
| 88 { | 89 { |
| 89 ASSERT(m_implScriptValue->isV8()); | 90 ASSERT(m_implScriptValue->isV8()); |
| 90 return static_cast<V8ScriptValue*>(m_implScriptValue.get())->isolate(); | 91 return static_cast<V8ScriptValue*>(m_implScriptValue.get())->isolate(); |
| 91 } | 92 } |
| 92 | 93 |
| 94 // FIXMEMULTIVM: Remove. |
| 93 v8::Handle<v8::Value> v8Value() const | 95 v8::Handle<v8::Value> v8Value() const |
| 94 { | 96 { |
| 95 ASSERT(m_implScriptValue->isV8()); | 97 if (m_implScriptValue->isV8()) { |
| 96 return static_cast<V8ScriptValue*>(m_implScriptValue.get())->v8Value(); | 98 return static_cast<V8ScriptValue*>(m_implScriptValue.get())->v8Value
(); |
| 99 } |
| 100 if (m_implScriptValue->isDart()) { |
| 101 return static_cast<DartScriptValue*>(m_implScriptValue.get())->v8Val
ue(); |
| 102 } |
| 103 ASSERT_NOT_REACHED(); |
| 104 return v8::Handle<v8::Value>(); |
| 97 } | 105 } |
| 98 | 106 |
| 99 ScriptValue& operator=(const ScriptValue& value) | 107 ScriptValue& operator=(const ScriptValue& value) |
| 100 { | 108 { |
| 101 if (this != &value) { | 109 if (this != &value) { |
| 102 m_implScriptValue = value.m_implScriptValue; | 110 m_implScriptValue = value.m_implScriptValue; |
| 103 } | 111 } |
| 104 return *this; | 112 return *this; |
| 105 } | 113 } |
| 106 | 114 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return m_implScriptValue->getString(result); | 170 return m_implScriptValue->getString(result); |
| 163 } | 171 } |
| 164 | 172 |
| 165 String toString() const | 173 String toString() const |
| 166 { | 174 { |
| 167 return m_implScriptValue->toString(); | 175 return m_implScriptValue->toString(); |
| 168 } | 176 } |
| 169 | 177 |
| 170 PassRefPtr<JSONValue> toJSONValue(ScriptState* state) const; | 178 PassRefPtr<JSONValue> toJSONValue(ScriptState* state) const; |
| 171 | 179 |
| 180 AbstractScriptValue* scriptValue() const |
| 181 { |
| 182 return m_implScriptValue.get(); |
| 183 } |
| 184 |
| 172 private: | 185 private: |
| 173 RefPtr<AbstractScriptValue> m_implScriptValue; | 186 RefPtr<AbstractScriptValue> m_implScriptValue; |
| 174 }; | 187 }; |
| 175 | 188 |
| 176 } // namespace WebCore | 189 } // namespace WebCore |
| 177 | 190 |
| 178 #endif // ScriptValue_h | 191 #endif // ScriptValue_h |
| OLD | NEW |