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 : m_value(value.IsEmpty() ? 0 : SharedPersistent<v8::Value>::create(valu
e)) | 64 : m_value(value.IsEmpty() ? 0 : SharedPersistent<v8::Value>::create(valu
e)) |
65 { | 65 { |
66 } | 66 } |
67 | 67 |
68 ScriptValue(const ScriptValue& value) | 68 ScriptValue(const ScriptValue& value) |
69 : m_value(value.m_value) | 69 : m_value(value.m_value) |
70 { | 70 { |
71 } | 71 } |
72 | 72 |
73 static ScriptValue createNull() { return ScriptValue(v8::Null()); } | 73 static ScriptValue createNull() { return ScriptValue(v8::Null()); } |
| 74 static ScriptValue createBoolean(bool b) { return ScriptValue(b ? v8::True()
: v8::False()); } |
74 | 75 |
75 ScriptValue& operator=(const ScriptValue& value) | 76 ScriptValue& operator=(const ScriptValue& value) |
76 { | 77 { |
77 if (this != &value) | 78 if (this != &value) |
78 m_value = value.m_value; | 79 m_value = value.m_value; |
79 return *this; | 80 return *this; |
80 } | 81 } |
81 | 82 |
82 bool operator==(const ScriptValue& value) const | 83 bool operator==(const ScriptValue& value) const |
83 { | 84 { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 161 |
161 PassRefPtr<JSONValue> toJSONValue(ScriptState*) const; | 162 PassRefPtr<JSONValue> toJSONValue(ScriptState*) const; |
162 | 163 |
163 private: | 164 private: |
164 RefPtr<SharedPersistent<v8::Value> > m_value; | 165 RefPtr<SharedPersistent<v8::Value> > m_value; |
165 }; | 166 }; |
166 | 167 |
167 } // namespace WebCore | 168 } // namespace WebCore |
168 | 169 |
169 #endif // ScriptValue_h | 170 #endif // ScriptValue_h |
OLD | NEW |