Chromium Code Reviews| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 bool isEmpty() const | 128 bool isEmpty() const |
| 129 { | 129 { |
| 130 return !m_value.get() || m_value->isEmpty(); | 130 return !m_value.get() || m_value->isEmpty(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void clear() | 133 void clear() |
| 134 { | 134 { |
| 135 m_value = nullptr; | 135 m_value = nullptr; |
| 136 } | 136 } |
| 137 | 137 |
| 138 int identityHash() const; | |
| 139 | |
| 138 v8::Handle<v8::Value> v8Value() const; | 140 v8::Handle<v8::Value> v8Value() const; |
| 139 v8::Handle<v8::Value> v8ValueUnsafe() const; | 141 v8::Handle<v8::Value> v8ValueUnsafe() const; |
| 140 | 142 |
| 141 bool toString(String&) const; | 143 bool toString(String&) const; |
| 142 PassRefPtr<JSONValue> toJSONValue(ScriptState*) const; | 144 PassRefPtr<JSONValue> toJSONValue(ScriptState*) const; |
| 143 | 145 |
| 146 // Hash table deleted values, which are only constructed and never copied or destroyed. | |
| 147 ScriptValue(WTF::HashTableDeletedValueType) : m_scriptState(WTF::HashTableDe letedValue) { } | |
|
yurys
2014/10/03 15:08:05
If we init m_value with WTF::HashTableDeletedValue
aandrey
2014/10/06 10:52:56
m_value->isEmpty(); will deref (-1) pointer
| |
| 148 bool isHashTableDeletedValue() const { return m_scriptState.isHashTableDelet edValue(); } | |
| 149 | |
| 144 private: | 150 private: |
| 145 RefPtr<ScriptState> m_scriptState; | 151 RefPtr<ScriptState> m_scriptState; |
| 146 RefPtr<SharedPersistent<v8::Value> > m_value; | 152 RefPtr<SharedPersistent<v8::Value> > m_value; |
| 147 }; | 153 }; |
| 148 | 154 |
| 149 } // namespace blink | 155 } // namespace blink |
| 150 | 156 |
| 151 #endif // ScriptValue_h | 157 #endif // ScriptValue_h |
| OLD | NEW |