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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 ASSERT(m_databaseCallbacks); | 94 ASSERT(m_databaseCallbacks); |
95 | 95 |
96 IDBDatabase* idbDatabase = IDBDatabase::create(getExecutionContext(), std::m
ove(backend), m_databaseCallbacks.release()); | 96 IDBDatabase* idbDatabase = IDBDatabase::create(getExecutionContext(), std::m
ove(backend), m_databaseCallbacks.release()); |
97 idbDatabase->setMetadata(metadata); | 97 idbDatabase->setMetadata(metadata); |
98 | 98 |
99 if (oldVersion == IDBDatabaseMetadata::NoVersion) { | 99 if (oldVersion == IDBDatabaseMetadata::NoVersion) { |
100 // This database hasn't had a version before. | 100 // This database hasn't had a version before. |
101 oldVersion = IDBDatabaseMetadata::DefaultVersion; | 101 oldVersion = IDBDatabaseMetadata::DefaultVersion; |
102 } | 102 } |
103 IDBDatabaseMetadata oldMetadata(metadata); | 103 IDBDatabaseOwnMetadata oldDatabaseMetadata(metadata.own); |
104 oldMetadata.version = oldVersion; | 104 oldDatabaseMetadata.version = oldVersion; |
105 | 105 |
106 m_transaction = IDBTransaction::create(getScriptState(), m_transactionId, id
bDatabase, this, oldMetadata); | 106 m_transaction = IDBTransaction::createVersionChange(getScriptState(), m_tran
sactionId, idbDatabase, this, oldDatabaseMetadata); |
107 setResult(IDBAny::create(idbDatabase)); | 107 setResult(IDBAny::create(idbDatabase)); |
108 | 108 |
109 if (m_version == IDBDatabaseMetadata::NoVersion) | 109 if (m_version == IDBDatabaseMetadata::NoVersion) |
110 m_version = 1; | 110 m_version = 1; |
111 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::upgradeneeded, ol
dVersion, m_version, dataLoss, dataLossMessage)); | 111 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::upgradeneeded, ol
dVersion, m_version, dataLoss, dataLossMessage)); |
112 } | 112 } |
113 | 113 |
114 void IDBOpenDBRequest::onSuccess(std::unique_ptr<WebIDBDatabase> backend, const
IDBDatabaseMetadata& metadata) | 114 void IDBOpenDBRequest::onSuccess(std::unique_ptr<WebIDBDatabase> backend, const
IDBDatabaseMetadata& metadata) |
115 { | 115 { |
116 IDB_TRACE("IDBOpenDBRequest::onSuccess()"); | 116 IDB_TRACE("IDBOpenDBRequest::onSuccess()"); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 dequeueEvent(event); | 171 dequeueEvent(event); |
172 setResult(nullptr); | 172 setResult(nullptr); |
173 onError(DOMException::create(AbortError, "The connection was closed.")); | 173 onError(DOMException::create(AbortError, "The connection was closed.")); |
174 return DispatchEventResult::CanceledBeforeDispatch; | 174 return DispatchEventResult::CanceledBeforeDispatch; |
175 } | 175 } |
176 | 176 |
177 return IDBRequest::dispatchEventInternal(event); | 177 return IDBRequest::dispatchEventInternal(event); |
178 } | 178 } |
179 | 179 |
180 } // namespace blink | 180 } // namespace blink |
OLD | NEW |