Chromium Code Reviews| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 const AtomicString& IDBOpenDBRequest::interfaceName() const | 62 const AtomicString& IDBOpenDBRequest::interfaceName() const |
| 63 { | 63 { |
| 64 return EventTargetNames::IDBOpenDBRequest; | 64 return EventTargetNames::IDBOpenDBRequest; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void IDBOpenDBRequest::onBlocked(int64_t oldVersion) | 67 void IDBOpenDBRequest::onBlocked(int64_t oldVersion) |
| 68 { | 68 { |
| 69 IDB_TRACE("IDBOpenDBRequest::onBlocked()"); | 69 IDB_TRACE("IDBOpenDBRequest::onBlocked()"); |
| 70 if (!shouldEnqueueEvent()) | 70 if (!shouldEnqueueEvent()) |
| 71 return; | 71 return; |
| 72 RefPtr<IDBAny> newVersionAny = (m_version == IDBDatabaseMetadata::DefaultInt Version) ? IDBAny::createNull() : IDBAny::create(m_version); | 72 RefPtr<SerializedScriptValue> newVersionSSV = (m_version == IDBDatabaseMetad ata::DefaultIntVersion) ? SerializedScriptValue::nullValue() : SerializedScriptV alue::numberValue(m_version); |
|
haraken
2014/02/25 01:14:38
Shall we add a test for nullValue as well?
| |
| 73 enqueueEvent(IDBVersionChangeEvent::create(IDBAny::create(oldVersion), newVe rsionAny.release(), EventTypeNames::blocked)); | 73 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::blocked, Serializ edScriptValue::numberValue(oldVersion), newVersionSSV.release())); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void IDBOpenDBRequest::onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<WebIDBData base> backend, const IDBDatabaseMetadata& metadata, blink::WebIDBDataLoss dataLo ss, String dataLossMessage) | 76 void IDBOpenDBRequest::onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<WebIDBData base> backend, const IDBDatabaseMetadata& metadata, blink::WebIDBDataLoss dataLo ss, String dataLossMessage) |
| 77 { | 77 { |
| 78 IDB_TRACE("IDBOpenDBRequest::onUpgradeNeeded()"); | 78 IDB_TRACE("IDBOpenDBRequest::onUpgradeNeeded()"); |
| 79 if (m_contextStopped || !executionContext()) { | 79 if (m_contextStopped || !executionContext()) { |
| 80 OwnPtr<WebIDBDatabase> db = backend; | 80 OwnPtr<WebIDBDatabase> db = backend; |
| 81 db->abort(m_transactionId); | 81 db->abort(m_transactionId); |
| 82 db->close(); | 82 db->close(); |
| 83 return; | 83 return; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 95 oldVersion = IDBDatabaseMetadata::DefaultIntVersion; | 95 oldVersion = IDBDatabaseMetadata::DefaultIntVersion; |
| 96 } | 96 } |
| 97 IDBDatabaseMetadata oldMetadata(metadata); | 97 IDBDatabaseMetadata oldMetadata(metadata); |
| 98 oldMetadata.intVersion = oldVersion; | 98 oldMetadata.intVersion = oldVersion; |
| 99 | 99 |
| 100 m_transaction = IDBTransaction::create(executionContext(), m_transactionId, idbDatabase.get(), this, oldMetadata); | 100 m_transaction = IDBTransaction::create(executionContext(), m_transactionId, idbDatabase.get(), this, oldMetadata); |
| 101 setResult(IDBAny::create(idbDatabase.release())); | 101 setResult(IDBAny::create(idbDatabase.release())); |
| 102 | 102 |
| 103 if (m_version == IDBDatabaseMetadata::NoIntVersion) | 103 if (m_version == IDBDatabaseMetadata::NoIntVersion) |
| 104 m_version = 1; | 104 m_version = 1; |
| 105 enqueueEvent(IDBVersionChangeEvent::create(IDBAny::create(oldVersion), IDBAn y::create(m_version), EventTypeNames::upgradeneeded, dataLoss, dataLossMessage)) ; | 105 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::upgradeneeded, Se rializedScriptValue::numberValue(oldVersion), SerializedScriptValue::numberValue (m_version), dataLoss, dataLossMessage)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void IDBOpenDBRequest::onSuccess(PassOwnPtr<WebIDBDatabase> backend, const IDBDa tabaseMetadata& metadata) | 108 void IDBOpenDBRequest::onSuccess(PassOwnPtr<WebIDBDatabase> backend, const IDBDa tabaseMetadata& metadata) |
| 109 { | 109 { |
| 110 IDB_TRACE("IDBOpenDBRequest::onSuccess()"); | 110 IDB_TRACE("IDBOpenDBRequest::onSuccess()"); |
| 111 if (m_contextStopped || !executionContext()) { | 111 if (m_contextStopped || !executionContext()) { |
| 112 OwnPtr<WebIDBDatabase> db = backend; | 112 OwnPtr<WebIDBDatabase> db = backend; |
| 113 if (db) | 113 if (db) |
| 114 db->close(); | 114 db->close(); |
| 115 return; | 115 return; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 dequeueEvent(event.get()); | 152 dequeueEvent(event.get()); |
| 153 setResult(nullptr); | 153 setResult(nullptr); |
| 154 onError(DOMError::create(AbortError, "The connection was closed.")); | 154 onError(DOMError::create(AbortError, "The connection was closed.")); |
| 155 return false; | 155 return false; |
| 156 } | 156 } |
| 157 | 157 |
| 158 return IDBRequest::dispatchEvent(event); | 158 return IDBRequest::dispatchEvent(event); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace WebCore | 161 } // namespace WebCore |
| OLD | NEW |