X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fmodules%2Findexeddb%2FIDBRequest.cpp;h=239c414d484f7bc5507f4a2523dcc73d03b51296;hb=f5180d0a4dfe13ef74567dc9aa75047c1a9cd6de;hp=0f8b362443b15dc279c65b26cbddf5b835ed7821;hpb=669bbc0a54393464248e6bac22558cda42a9a350;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp b/src/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp index 0f8b362..239c414 100644 --- a/src/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp +++ b/src/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp @@ -38,6 +38,7 @@ #include "modules/indexeddb/IDBCursorWithValue.h" #include "modules/indexeddb/IDBDatabase.h" #include "modules/indexeddb/IDBEventDispatcher.h" +#include "modules/indexeddb/IDBPendingTransactionMonitor.h" #include "modules/indexeddb/IDBTracing.h" #include "platform/SharedBuffer.h" #include "public/platform/WebBlobInfo.h" @@ -77,6 +78,11 @@ IDBRequest::IDBRequest(ScriptState* scriptState, IDBAny* source, IDBTransaction* IDBRequest::~IDBRequest() { ASSERT(m_readyState == DONE || m_readyState == EarlyDeath || !executionContext()); + ASSERT(!m_blobInfo || m_blobInfo->size() == 0); +} + +void IDBRequest::dispose() +{ handleBlobAcks(); } @@ -199,17 +205,25 @@ void IDBRequest::setResultCursor(IDBCursor* cursor, IDBKey* key, IDBKey* primary m_cursorKey = key; m_cursorPrimaryKey = primaryKey; m_cursorValue = value; - ASSERT(!m_blobInfo.get()); - m_blobInfo = blobInfo; + setBlobInfo(blobInfo); onSuccessInternal(IDBAny::create(cursor)); } +void IDBRequest::setBlobInfo(PassOwnPtr> blobInfo) +{ + ASSERT(!m_blobInfo); + m_blobInfo = blobInfo; + if (m_blobInfo && m_blobInfo->size() > 0) + V8PerIsolateData::from(scriptState()->isolate())->ensureIDBPendingTransactionMonitor()->registerRequest(*this); +} + void IDBRequest::handleBlobAcks() { if (m_blobInfo.get() && m_blobInfo->size()) { m_transaction->db()->ackReceivedBlobs(m_blobInfo.get()); m_blobInfo.clear(); + V8PerIsolateData::from(scriptState()->isolate())->ensureIDBPendingTransactionMonitor()->unregisterRequest(*this); } } @@ -296,8 +310,7 @@ void IDBRequest::onSuccess(PassRefPtr valueBuffer, PassOwnPtr prpValueBuffer, PassOwnPtr valueBuffer = prpValueBuffer; IDBKey* primaryKey = prpPrimaryKey; - ASSERT(!m_blobInfo.get()); - m_blobInfo = blobInfo; + setBlobInfo(blobInfo); #if ENABLE(ASSERT) assertPrimaryKeyValidOrInjectable(m_scriptState.get(), valueBuffer, m_blobInfo.get(), primaryKey, keyPath); @@ -447,8 +459,11 @@ bool IDBRequest::dispatchEvent(PassRefPtrWillBeRawPtr event) IDBCursor* cursorToNotify = 0; if (event->type() == EventTypeNames::success) { cursorToNotify = getResultCursor(); - if (cursorToNotify) + if (cursorToNotify) { + if (m_blobInfo && m_blobInfo->size() > 0) + V8PerIsolateData::from(scriptState()->isolate())->ensureIDBPendingTransactionMonitor()->unregisterRequest(*this); cursorToNotify->setValueReady(m_cursorKey.release(), m_cursorPrimaryKey.release(), m_cursorValue.release(), m_blobInfo.release()); + } } if (event->type() == EventTypeNames::upgradeneeded) {