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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // The first error to be set is the true cause of the | 132 // The first error to be set is the true cause of the |
133 // transaction abort. | 133 // transaction abort. |
134 if (!m_error) { | 134 if (!m_error) { |
135 m_error = error; | 135 m_error = error; |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 PassRefPtr<IDBObjectStore> IDBTransaction::objectStore(const String& name, Excep
tionCode& ec) | 139 PassRefPtr<IDBObjectStore> IDBTransaction::objectStore(const String& name, Excep
tionCode& ec) |
140 { | 140 { |
141 if (m_state == Finished) { | 141 if (m_state == Finished) { |
142 ec = INVALID_STATE_ERR; | 142 ec = InvalidStateError; |
143 return 0; | 143 return 0; |
144 } | 144 } |
145 | 145 |
146 IDBObjectStoreMap::iterator it = m_objectStoreMap.find(name); | 146 IDBObjectStoreMap::iterator it = m_objectStoreMap.find(name); |
147 if (it != m_objectStoreMap.end()) | 147 if (it != m_objectStoreMap.end()) |
148 return it->value; | 148 return it->value; |
149 | 149 |
150 if (!isVersionChange() && !m_objectStoreNames.contains(name)) { | 150 if (!isVersionChange() && !m_objectStoreNames.contains(name)) { |
151 // FIXME: Should use (NotFoundError, "..."). | 151 // FIXME: Should use (NotFoundError, "..."). |
152 ec = IDBNotFoundError; | 152 ec = IDBNotFoundError; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 ASSERT(active != (m_state == Active)); | 199 ASSERT(active != (m_state == Active)); |
200 m_state = active ? Active : Inactive; | 200 m_state = active ? Active : Inactive; |
201 | 201 |
202 if (!active && m_requestList.isEmpty()) | 202 if (!active && m_requestList.isEmpty()) |
203 backendDB()->commit(m_id); | 203 backendDB()->commit(m_id); |
204 } | 204 } |
205 | 205 |
206 void IDBTransaction::abort(ExceptionCode& ec) | 206 void IDBTransaction::abort(ExceptionCode& ec) |
207 { | 207 { |
208 if (m_state == Finishing || m_state == Finished) { | 208 if (m_state == Finishing || m_state == Finished) { |
209 ec = INVALID_STATE_ERR; | 209 ec = InvalidStateError; |
210 return; | 210 return; |
211 } | 211 } |
212 | 212 |
213 m_state = Finishing; | 213 m_state = Finishing; |
214 | 214 |
215 if (!m_contextStopped) { | 215 if (!m_contextStopped) { |
216 while (!m_requestList.isEmpty()) { | 216 while (!m_requestList.isEmpty()) { |
217 RefPtr<IDBRequest> request = *m_requestList.begin(); | 217 RefPtr<IDBRequest> request = *m_requestList.begin(); |
218 m_requestList.remove(request); | 218 m_requestList.remove(request); |
219 request->abort(); | 219 request->abort(); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 { | 446 { |
447 return &m_eventTargetData; | 447 return &m_eventTargetData; |
448 } | 448 } |
449 | 449 |
450 IDBDatabaseBackendInterface* IDBTransaction::backendDB() const | 450 IDBDatabaseBackendInterface* IDBTransaction::backendDB() const |
451 { | 451 { |
452 return db()->backend(); | 452 return db()->backend(); |
453 } | 453 } |
454 | 454 |
455 } // namespace WebCore | 455 } // namespace WebCore |
OLD | NEW |