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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 ASSERT(m_transaction); | 64 ASSERT(m_transaction); |
65 } | 65 } |
66 | 66 |
67 DEFINE_TRACE(IDBObjectStore) | 67 DEFINE_TRACE(IDBObjectStore) |
68 { | 68 { |
69 visitor->trace(m_transaction); | 69 visitor->trace(m_transaction); |
70 visitor->trace(m_indexMap); | 70 visitor->trace(m_indexMap); |
71 visitor->trace(m_createdIndexes); | 71 visitor->trace(m_createdIndexes); |
72 } | 72 } |
73 | 73 |
| 74 void IDBObjectStore::setName(const String& name, ExceptionState& exceptionState) |
| 75 { |
| 76 IDB_TRACE("IDBObjectStore::setName"); |
| 77 if (!m_transaction->isVersionChange()) { |
| 78 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::notVers
ionChangeTransactionErrorMessage); |
| 79 return; |
| 80 } |
| 81 if (isDeleted()) { |
| 82 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); |
| 83 return; |
| 84 } |
| 85 if (m_transaction->isFinished() || m_transaction->isFinishing()) { |
| 86 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); |
| 87 return; |
| 88 } |
| 89 if (!m_transaction->isActive()) { |
| 90 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); |
| 91 return; |
| 92 } |
| 93 |
| 94 if (m_transaction->db()->containsObjectStore(name)) { |
| 95 exceptionState.throwDOMException(ConstraintError, "An object store with
the specified name already exists."); |
| 96 return; |
| 97 } |
| 98 if (!backendDB()) { |
| 99 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 100 return; |
| 101 } |
| 102 |
| 103 m_metadata.name = name; |
| 104 } |
| 105 |
74 ScriptValue IDBObjectStore::keyPath(ScriptState* scriptState) const | 106 ScriptValue IDBObjectStore::keyPath(ScriptState* scriptState) const |
75 { | 107 { |
76 return ScriptValue::from(scriptState, m_metadata.keyPath); | 108 return ScriptValue::from(scriptState, m_metadata.keyPath); |
77 } | 109 } |
78 | 110 |
79 DOMStringList* IDBObjectStore::indexNames() const | 111 DOMStringList* IDBObjectStore::indexNames() const |
80 { | 112 { |
81 IDB_TRACE("IDBObjectStore::indexNames"); | 113 IDB_TRACE("IDBObjectStore::indexNames"); |
82 DOMStringList* indexNames = DOMStringList::create(DOMStringList::IndexedDB); | 114 DOMStringList* indexNames = DOMStringList::create(DOMStringList::IndexedDB); |
83 for (const auto& it : m_metadata.indexes) | 115 for (const auto& it : m_metadata.indexes) |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 } | 791 } |
760 return IDBIndexMetadata::InvalidId; | 792 return IDBIndexMetadata::InvalidId; |
761 } | 793 } |
762 | 794 |
763 WebIDBDatabase* IDBObjectStore::backendDB() const | 795 WebIDBDatabase* IDBObjectStore::backendDB() const |
764 { | 796 { |
765 return m_transaction->backendDB(); | 797 return m_transaction->backendDB(); |
766 } | 798 } |
767 | 799 |
768 } // namespace blink | 800 } // namespace blink |
OLD | NEW |