| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "IDBAny.h" | 27 #include "IDBAny.h" |
| 28 | 28 |
| 29 #if ENABLE(INDEXED_DATABASE) | 29 #if ENABLE(INDEXED_DATABASE) |
| 30 | 30 |
| 31 #include "IDBCursorWithValue.h" | 31 #include "IDBCursorWithValue.h" |
| 32 #include "IDBDatabase.h" | 32 #include "IDBDatabase.h" |
| 33 #include "IDBFactory.h" | 33 #include "IDBFactory.h" |
| 34 #include "IDBIndex.h" | 34 #include "IDBIndex.h" |
| 35 #include "IDBKeyPath.h" | 35 #include "IDBKeyPath.h" |
| 36 #include "IDBObjectStore.h" | 36 #include "IDBObjectStore.h" |
| 37 #include "SerializedScriptValue.h" |
| 37 | 38 |
| 38 namespace WebCore { | 39 namespace WebCore { |
| 39 | 40 |
| 40 PassRefPtr<IDBAny> IDBAny::createInvalid() | 41 PassRefPtr<IDBAny> IDBAny::createInvalid() |
| 41 { | 42 { |
| 42 return adoptRef(new IDBAny()); | 43 return adoptRef(new IDBAny()); |
| 43 } | 44 } |
| 44 | 45 |
| 45 PassRefPtr<IDBAny> IDBAny::createNull() | 46 PassRefPtr<IDBAny> IDBAny::createNull() |
| 46 { | 47 { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 ASSERT(m_type == IDBObjectStoreType); | 113 ASSERT(m_type == IDBObjectStoreType); |
| 113 return m_idbObjectStore; | 114 return m_idbObjectStore; |
| 114 } | 115 } |
| 115 | 116 |
| 116 PassRefPtr<IDBTransaction> IDBAny::idbTransaction() | 117 PassRefPtr<IDBTransaction> IDBAny::idbTransaction() |
| 117 { | 118 { |
| 118 ASSERT(m_type == IDBTransactionType); | 119 ASSERT(m_type == IDBTransactionType); |
| 119 return m_idbTransaction; | 120 return m_idbTransaction; |
| 120 } | 121 } |
| 121 | 122 |
| 122 ScriptValue IDBAny::scriptValue() | 123 PassRefPtr<SerializedScriptValue> IDBAny::serializedScriptValue() |
| 123 { | 124 { |
| 124 ASSERT(m_type == ScriptValueType); | 125 ASSERT(m_type == SerializedScriptValueType); |
| 125 return m_scriptValue; | 126 return m_serializedScriptValue; |
| 126 } | 127 } |
| 127 | 128 |
| 128 const String& IDBAny::string() | 129 const String& IDBAny::string() |
| 129 { | 130 { |
| 130 ASSERT(m_type == StringType); | 131 ASSERT(m_type == StringType); |
| 131 return m_string; | 132 return m_string; |
| 132 } | 133 } |
| 133 | 134 |
| 134 int64_t IDBAny::integer() | |
| 135 { | |
| 136 ASSERT(m_type == IntegerType); | |
| 137 return m_integer; | |
| 138 } | |
| 139 | |
| 140 void IDBAny::setNull() | 135 void IDBAny::setNull() |
| 141 { | 136 { |
| 142 ASSERT(m_type == UndefinedType); | 137 ASSERT(m_type == UndefinedType); |
| 143 m_type = NullType; | 138 m_type = NullType; |
| 144 } | 139 } |
| 145 | 140 |
| 146 void IDBAny::set(PassRefPtr<DOMStringList> value) | 141 void IDBAny::set(PassRefPtr<DOMStringList> value) |
| 147 { | 142 { |
| 148 ASSERT(m_type == UndefinedType); | 143 ASSERT(m_type == UndefinedType); |
| 149 m_type = DOMStringListType; | 144 m_type = DOMStringListType; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 m_idbTransaction = value; | 194 m_idbTransaction = value; |
| 200 } | 195 } |
| 201 | 196 |
| 202 void IDBAny::set(PassRefPtr<IDBObjectStore> value) | 197 void IDBAny::set(PassRefPtr<IDBObjectStore> value) |
| 203 { | 198 { |
| 204 ASSERT(m_type == UndefinedType); | 199 ASSERT(m_type == UndefinedType); |
| 205 m_type = IDBObjectStoreType; | 200 m_type = IDBObjectStoreType; |
| 206 m_idbObjectStore = value; | 201 m_idbObjectStore = value; |
| 207 } | 202 } |
| 208 | 203 |
| 209 void IDBAny::set(const ScriptValue& value) | 204 void IDBAny::set(PassRefPtr<SerializedScriptValue> value) |
| 210 { | 205 { |
| 211 ASSERT(m_type == UndefinedType); | 206 ASSERT(m_type == UndefinedType); |
| 212 m_type = ScriptValueType; | 207 m_type = SerializedScriptValueType; |
| 213 m_scriptValue = value; | 208 m_serializedScriptValue = value; |
| 214 } | 209 } |
| 215 | 210 |
| 216 void IDBAny::set(const IDBKeyPath& value) | 211 void IDBAny::set(const IDBKeyPath& value) |
| 217 { | 212 { |
| 218 ASSERT(m_type == UndefinedType); | 213 ASSERT(m_type == UndefinedType); |
| 219 switch (value.type()) { | 214 switch (value.type()) { |
| 220 case IDBKeyPath::NullType: | 215 case IDBKeyPath::NullType: |
| 221 m_type = NullType; | 216 m_type = NullType; |
| 222 break; | 217 break; |
| 223 case IDBKeyPath::StringType: | 218 case IDBKeyPath::StringType: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 234 } | 229 } |
| 235 } | 230 } |
| 236 | 231 |
| 237 void IDBAny::set(const String& value) | 232 void IDBAny::set(const String& value) |
| 238 { | 233 { |
| 239 ASSERT(m_type == UndefinedType); | 234 ASSERT(m_type == UndefinedType); |
| 240 m_type = StringType; | 235 m_type = StringType; |
| 241 m_string = value; | 236 m_string = value; |
| 242 } | 237 } |
| 243 | 238 |
| 244 void IDBAny::set(int64_t value) | |
| 245 { | |
| 246 ASSERT(m_type == UndefinedType); | |
| 247 m_type = IntegerType; | |
| 248 m_integer = value; | |
| 249 } | |
| 250 | |
| 251 } // namespace WebCore | 239 } // namespace WebCore |
| 252 | 240 |
| 253 #endif | 241 #endif |
| OLD | NEW |