OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 DCHECK(m_databaseCallbacks); | 101 DCHECK(m_databaseCallbacks); |
102 | 102 |
103 IDBDatabase* idbDatabase = IDBDatabase::create( | 103 IDBDatabase* idbDatabase = IDBDatabase::create( |
104 getExecutionContext(), std::move(backend), m_databaseCallbacks.release()); | 104 getExecutionContext(), std::move(backend), m_databaseCallbacks.release()); |
105 idbDatabase->setMetadata(metadata); | 105 idbDatabase->setMetadata(metadata); |
106 | 106 |
107 if (oldVersion == IDBDatabaseMetadata::NoVersion) { | 107 if (oldVersion == IDBDatabaseMetadata::NoVersion) { |
108 // This database hasn't had a version before. | 108 // This database hasn't had a version before. |
109 oldVersion = IDBDatabaseMetadata::DefaultVersion; | 109 oldVersion = IDBDatabaseMetadata::DefaultVersion; |
110 } | 110 } |
111 IDBDatabaseMetadata oldMetadata(metadata); | 111 IDBDatabaseMetadata oldDatabaseMetadata( |
112 oldMetadata.version = oldVersion; | 112 metadata.name, metadata.id, oldVersion, metadata.maxObjectStoreId); |
113 | 113 |
114 m_transaction = IDBTransaction::createVersionChange( | 114 m_transaction = IDBTransaction::createVersionChange( |
115 getScriptState(), m_transactionId, idbDatabase, this, oldMetadata); | 115 getScriptState(), m_transactionId, idbDatabase, this, |
| 116 oldDatabaseMetadata); |
116 setResult(IDBAny::create(idbDatabase)); | 117 setResult(IDBAny::create(idbDatabase)); |
117 | 118 |
118 if (m_version == IDBDatabaseMetadata::NoVersion) | 119 if (m_version == IDBDatabaseMetadata::NoVersion) |
119 m_version = 1; | 120 m_version = 1; |
120 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::upgradeneeded, | 121 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::upgradeneeded, |
121 oldVersion, m_version, dataLoss, | 122 oldVersion, m_version, dataLoss, |
122 dataLossMessage)); | 123 dataLossMessage)); |
123 } | 124 } |
124 | 125 |
125 void IDBOpenDBRequest::onSuccess(std::unique_ptr<WebIDBDatabase> backend, | 126 void IDBOpenDBRequest::onSuccess(std::unique_ptr<WebIDBDatabase> backend, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 dequeueEvent(event); | 184 dequeueEvent(event); |
184 setResult(nullptr); | 185 setResult(nullptr); |
185 onError(DOMException::create(AbortError, "The connection was closed.")); | 186 onError(DOMException::create(AbortError, "The connection was closed.")); |
186 return DispatchEventResult::CanceledBeforeDispatch; | 187 return DispatchEventResult::CanceledBeforeDispatch; |
187 } | 188 } |
188 | 189 |
189 return IDBRequest::dispatchEventInternal(event); | 190 return IDBRequest::dispatchEventInternal(event); |
190 } | 191 } |
191 | 192 |
192 } // namespace blink | 193 } // namespace blink |
OLD | NEW |