| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 bool operator==(const ScriptValue& value) const { | 113 bool operator==(const ScriptValue& value) const { |
| 114 if (isEmpty()) | 114 if (isEmpty()) |
| 115 return value.isEmpty(); | 115 return value.isEmpty(); |
| 116 if (value.isEmpty()) | 116 if (value.isEmpty()) |
| 117 return false; | 117 return false; |
| 118 return *m_value == *value.m_value; | 118 return *m_value == *value.m_value; |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool operator!=(const ScriptValue& value) const { return !operator==(value); } | 121 bool operator!=(const ScriptValue& value) const { return !operator==(value); } |
| 122 | 122 |
| 123 // This creates a new local Handle; Don't use this in performance-sensitive pl
aces. | 123 // This creates a new local Handle; Don't use this in performance-sensitive |
| 124 // places. |
| 124 bool isFunction() const { | 125 bool isFunction() const { |
| 125 ASSERT(!isEmpty()); | 126 ASSERT(!isEmpty()); |
| 126 v8::Local<v8::Value> value = v8Value(); | 127 v8::Local<v8::Value> value = v8Value(); |
| 127 return !value.IsEmpty() && value->IsFunction(); | 128 return !value.IsEmpty() && value->IsFunction(); |
| 128 } | 129 } |
| 129 | 130 |
| 130 // This creates a new local Handle; Don't use this in performance-sensitive pl
aces. | 131 // This creates a new local Handle; Don't use this in performance-sensitive |
| 132 // places. |
| 131 bool isNull() const { | 133 bool isNull() const { |
| 132 ASSERT(!isEmpty()); | 134 ASSERT(!isEmpty()); |
| 133 v8::Local<v8::Value> value = v8Value(); | 135 v8::Local<v8::Value> value = v8Value(); |
| 134 return !value.IsEmpty() && value->IsNull(); | 136 return !value.IsEmpty() && value->IsNull(); |
| 135 } | 137 } |
| 136 | 138 |
| 137 // This creates a new local Handle; Don't use this in performance-sensitive pl
aces. | 139 // This creates a new local Handle; Don't use this in performance-sensitive |
| 140 // places. |
| 138 bool isUndefined() const { | 141 bool isUndefined() const { |
| 139 ASSERT(!isEmpty()); | 142 ASSERT(!isEmpty()); |
| 140 v8::Local<v8::Value> value = v8Value(); | 143 v8::Local<v8::Value> value = v8Value(); |
| 141 return !value.IsEmpty() && value->IsUndefined(); | 144 return !value.IsEmpty() && value->IsUndefined(); |
| 142 } | 145 } |
| 143 | 146 |
| 144 // This creates a new local Handle; Don't use this in performance-sensitive pl
aces. | 147 // This creates a new local Handle; Don't use this in performance-sensitive |
| 148 // places. |
| 145 bool isObject() const { | 149 bool isObject() const { |
| 146 ASSERT(!isEmpty()); | 150 ASSERT(!isEmpty()); |
| 147 v8::Local<v8::Value> value = v8Value(); | 151 v8::Local<v8::Value> value = v8Value(); |
| 148 return !value.IsEmpty() && value->IsObject(); | 152 return !value.IsEmpty() && value->IsObject(); |
| 149 } | 153 } |
| 150 | 154 |
| 151 bool isEmpty() const { return !m_value.get() || m_value->isEmpty(); } | 155 bool isEmpty() const { return !m_value.get() || m_value->isEmpty(); } |
| 152 | 156 |
| 153 void clear() { m_value = nullptr; } | 157 void clear() { m_value = nullptr; } |
| 154 | 158 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 168 static ScriptValue createNull(ScriptState*); | 172 static ScriptValue createNull(ScriptState*); |
| 169 | 173 |
| 170 private: | 174 private: |
| 171 RefPtr<ScriptState> m_scriptState; | 175 RefPtr<ScriptState> m_scriptState; |
| 172 RefPtr<SharedPersistent<v8::Value>> m_value; | 176 RefPtr<SharedPersistent<v8::Value>> m_value; |
| 173 }; | 177 }; |
| 174 | 178 |
| 175 } // namespace blink | 179 } // namespace blink |
| 176 | 180 |
| 177 #endif // ScriptValue_h | 181 #endif // ScriptValue_h |
| OLD | NEW |