Chromium Code Reviews| Index: Source/modules/indexeddb/IDBObjectStore.cpp |
| diff --git a/Source/modules/indexeddb/IDBObjectStore.cpp b/Source/modules/indexeddb/IDBObjectStore.cpp |
| index f9e5b740b5af2b838bc640c3048c5793adc94ee8..175683b806019ef90783f9d29f5af7abc357d539 100644 |
| --- a/Source/modules/indexeddb/IDBObjectStore.cpp |
| +++ b/Source/modules/indexeddb/IDBObjectStore.cpp |
| @@ -88,7 +88,7 @@ PassRefPtrWillBeRawPtr<DOMStringList> IDBObjectStore::indexNames() const |
| return indexNames.release(); |
| } |
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::get(ExecutionContext* context, const ScriptValue& key, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::get(ScriptState* scriptState, const ScriptValue& key, ExceptionState& exceptionState) |
| { |
| IDB_TRACE("IDBObjectStore::get"); |
| if (isDeleted()) { |
| @@ -103,7 +103,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::get(ExecutionContext* context |
| exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); |
| return nullptr; |
| } |
| - RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, key, exceptionState); |
| + RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), key, exceptionState); |
| if (exceptionState.hadException()) |
| return nullptr; |
| if (!keyRange) { |
| @@ -115,7 +115,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::get(ExecutionContext* context |
| return nullptr; |
| } |
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); |
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); |
| backendDB()->get(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange.release(), false, WebIDBCallbacksImpl::create(request).leakPtr()); |
| return request.release(); |
| } |
| @@ -143,25 +143,25 @@ static void generateIndexKeysForValue(v8::Isolate* isolate, const IDBIndexMetada |
| } |
| } |
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::add(ExecutionContext* executionContext, ScriptValue& value, const ScriptValue& key, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::add(ScriptState* scriptState, ScriptValue& value, const ScriptValue& key, ExceptionState& exceptionState) |
| { |
| IDB_TRACE("IDBObjectStore::add"); |
| - return put(executionContext, WebIDBDatabase::AddOnly, IDBAny::create(this), value, key, exceptionState); |
| + return put(scriptState, WebIDBDatabase::AddOnly, IDBAny::create(this), value, key, exceptionState); |
| } |
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executionContext, ScriptValue& value, const ScriptValue& key, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ScriptState* scriptState, ScriptValue& value, const ScriptValue& key, ExceptionState& exceptionState) |
| { |
| IDB_TRACE("IDBObjectStore::put"); |
| - return put(executionContext, WebIDBDatabase::AddOrUpdate, IDBAny::create(this), value, key, exceptionState); |
| + return put(scriptState, WebIDBDatabase::AddOrUpdate, IDBAny::create(this), value, key, exceptionState); |
| } |
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executionContext, WebIDBDatabase::PutMode putMode, PassRefPtrWillBeRawPtr<IDBAny> source, ScriptValue& value, const ScriptValue& keyValue, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ScriptState* scriptState, WebIDBDatabase::PutMode putMode, PassRefPtrWillBeRawPtr<IDBAny> source, ScriptValue& value, const ScriptValue& keyValue, ExceptionState& exceptionState) |
| { |
| - RefPtrWillBeRawPtr<IDBKey> key = keyValue.isUndefined() ? nullptr : scriptValueToIDBKey(toIsolate(executionContext), keyValue); |
| - return put(executionContext, putMode, source, value, key.release(), exceptionState); |
| + RefPtrWillBeRawPtr<IDBKey> key = keyValue.isUndefined() ? nullptr : scriptValueToIDBKey(scriptState->isolate(), keyValue); |
| + return put(scriptState, putMode, source, value, key.release(), exceptionState); |
| } |
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executionContext, WebIDBDatabase::PutMode putMode, PassRefPtrWillBeRawPtr<IDBAny> source, ScriptValue& value, PassRefPtrWillBeRawPtr<IDBKey> prpKey, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ScriptState* scriptState, WebIDBDatabase::PutMode putMode, PassRefPtrWillBeRawPtr<IDBAny> source, ScriptValue& value, PassRefPtrWillBeRawPtr<IDBKey> prpKey, ExceptionState& exceptionState) |
| { |
| RefPtrWillBeRawPtr<IDBKey> key = prpKey; |
| if (isDeleted()) { |
| @@ -183,7 +183,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executi |
| Vector<WebBlobInfo> blobInfo; |
| - RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(value, &blobInfo, exceptionState, toIsolate(executionContext)); |
| + RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(value, &blobInfo, exceptionState, scriptState->isolate()); |
| if (exceptionState.hadException()) |
| return nullptr; |
| @@ -207,7 +207,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executi |
| return nullptr; |
| } |
| if (usesInLineKeys) { |
| - RefPtrWillBeRawPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(toIsolate(executionContext), value, keyPath); |
| + RefPtrWillBeRawPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(scriptState->isolate(), value, keyPath); |
| if (keyPathKey && !keyPathKey->isValid()) { |
| exceptionState.throwDOMException(DataError, "Evaluating the object store's key path yielded a value that is not a valid key."); |
| return nullptr; |
| @@ -217,7 +217,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executi |
| return nullptr; |
| } |
| if (hasKeyGenerator && !keyPathKey) { |
| - if (!canInjectIDBKeyIntoScriptValue(toIsolate(executionContext), value, keyPath)) { |
| + if (!canInjectIDBKeyIntoScriptValue(scriptState->isolate(), value, keyPath)) { |
| exceptionState.throwDOMException(DataError, "A generated key could not be inserted into the value."); |
| return nullptr; |
| } |
| @@ -239,12 +239,12 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executi |
| WillBeHeapVector<IndexKeys> indexKeys; |
| for (IDBObjectStoreMetadata::IndexMap::const_iterator it = m_metadata.indexes.begin(); it != m_metadata.indexes.end(); ++it) { |
| IndexKeys keys; |
| - generateIndexKeysForValue(toIsolate(executionContext), it->value, value, &keys); |
| + generateIndexKeysForValue(scriptState->isolate(), it->value, value, &keys); |
| indexIds.append(it->key); |
| indexKeys.append(keys); |
| } |
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(executionContext, source, m_transaction.get()); |
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, source, m_transaction.get()); |
| Vector<char> wireBytes; |
| serializedValue->toWireBytes(wireBytes); |
| RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes); |
| @@ -253,7 +253,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executi |
| return request.release(); |
| } |
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::deleteFunction(ExecutionContext* context, const ScriptValue& key, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::deleteFunction(ScriptState* scriptState, const ScriptValue& key, ExceptionState& exceptionState) |
| { |
| IDB_TRACE("IDBObjectStore::delete"); |
| if (isDeleted()) { |
| @@ -273,7 +273,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::deleteFunction(ExecutionConte |
| return nullptr; |
| } |
| - RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, key, exceptionState); |
| + RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), key, exceptionState); |
| if (exceptionState.hadException()) |
| return nullptr; |
| if (!keyRange) { |
| @@ -285,12 +285,12 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::deleteFunction(ExecutionConte |
| return nullptr; |
| } |
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); |
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); |
| backendDB()->deleteRange(m_transaction->id(), id(), keyRange.release(), WebIDBCallbacksImpl::create(request).leakPtr()); |
| return request.release(); |
| } |
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::clear(ExecutionContext* context, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::clear(ScriptState* scriptState, ExceptionState& exceptionState) |
| { |
| IDB_TRACE("IDBObjectStore::clear"); |
| if (isDeleted()) { |
| @@ -314,7 +314,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::clear(ExecutionContext* conte |
| return nullptr; |
| } |
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); |
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); |
| backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(request).leakPtr()); |
| return request.release(); |
| } |
| @@ -348,7 +348,7 @@ private: |
| { |
| } |
| - virtual void handleEvent(ExecutionContext* context, Event* event) OVERRIDE |
| + virtual void handleEvent(ExecutionContext* executionContext, Event* event) OVERRIDE |
|
jsbell
2014/05/23 17:21:35
The executionContext parameter is now unused.
|
| { |
| ASSERT(event->type() == EventTypeNames::success); |
| EventTarget* target = event->target(); |
| @@ -371,7 +371,7 @@ private: |
| ScriptValue value = cursor->value(m_scriptState.get()); |
| IDBObjectStore::IndexKeys indexKeys; |
| - generateIndexKeysForValue(toIsolate(context), m_indexMetadata, value, &indexKeys); |
| + generateIndexKeysForValue(m_scriptState->isolate(), m_indexMetadata, value, &indexKeys); |
|
jsbell
2014/05/23 17:21:35
And this is the only real change in the patch - mo
haraken
2014/05/26 07:04:03
I added the ASSERT.
However, this change won't ch
|
| WillBeHeapVector<IDBObjectStore::IndexKeys> indexKeysList; |
| indexKeysList.append(indexKeys); |
| @@ -461,7 +461,7 @@ PassRefPtrWillBeRawPtr<IDBIndex> IDBObjectStore::createIndex(ScriptState* script |
| if (exceptionState.hadException()) |
| return nullptr; |
| - RefPtrWillBeRawPtr<IDBRequest> indexRequest = openCursor(scriptState->executionContext(), static_cast<IDBKeyRange*>(0), blink::WebIDBCursor::Next, WebIDBDatabase::PreemptiveTask); |
| + RefPtrWillBeRawPtr<IDBRequest> indexRequest = openCursor(scriptState, static_cast<IDBKeyRange*>(0), blink::WebIDBCursor::Next, WebIDBDatabase::PreemptiveTask); |
| indexRequest->preventPropagation(); |
| // This is kept alive by being the success handler of the request, which is in turn kept alive by the owning transaction. |
| @@ -547,7 +547,7 @@ void IDBObjectStore::deleteIndex(const String& name, ExceptionState& exceptionSt |
| } |
| } |
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openCursor(ExecutionContext* context, const ScriptValue& range, const String& directionString, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openCursor(ScriptState* scriptState, const ScriptValue& range, const String& directionString, ExceptionState& exceptionState) |
| { |
| IDB_TRACE("IDBObjectStore::openCursor"); |
| if (isDeleted()) { |
| @@ -567,7 +567,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openCursor(ExecutionContext* |
| if (exceptionState.hadException()) |
| return nullptr; |
| - RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, range, exceptionState); |
| + RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), range, exceptionState); |
| if (exceptionState.hadException()) |
| return nullptr; |
| @@ -576,19 +576,19 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openCursor(ExecutionContext* |
| return nullptr; |
| } |
| - return openCursor(context, keyRange, direction, WebIDBDatabase::NormalTask); |
| + return openCursor(scriptState, keyRange, direction, WebIDBDatabase::NormalTask); |
| } |
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openCursor(ExecutionContext* context, PassRefPtrWillBeRawPtr<IDBKeyRange> range, WebIDBCursor::Direction direction, WebIDBDatabase::TaskType taskType) |
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openCursor(ScriptState* scriptState, PassRefPtrWillBeRawPtr<IDBKeyRange> range, WebIDBCursor::Direction direction, WebIDBDatabase::TaskType taskType) |
| { |
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); |
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); |
| request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction); |
| backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, direction, false, taskType, WebIDBCallbacksImpl::create(request).leakPtr()); |
| return request.release(); |
| } |
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openKeyCursor(ExecutionContext* context, const ScriptValue& range, const String& directionString, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openKeyCursor(ScriptState* scriptState, const ScriptValue& range, const String& directionString, ExceptionState& exceptionState) |
| { |
| IDB_TRACE("IDBObjectStore::openKeyCursor"); |
| if (isDeleted()) { |
| @@ -608,7 +608,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openKeyCursor(ExecutionContex |
| if (exceptionState.hadException()) |
| return nullptr; |
| - RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, range, exceptionState); |
| + RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), range, exceptionState); |
| if (exceptionState.hadException()) |
| return nullptr; |
| @@ -617,14 +617,14 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openKeyCursor(ExecutionContex |
| return nullptr; |
| } |
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); |
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); |
| request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); |
| backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange.release(), direction, true, WebIDBDatabase::NormalTask, WebIDBCallbacksImpl::create(request).leakPtr()); |
| return request.release(); |
| } |
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::count(ExecutionContext* context, const ScriptValue& range, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::count(ScriptState* scriptState, const ScriptValue& range, ExceptionState& exceptionState) |
| { |
| IDB_TRACE("IDBObjectStore::count"); |
| if (isDeleted()) { |
| @@ -640,7 +640,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::count(ExecutionContext* conte |
| return nullptr; |
| } |
| - RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, range, exceptionState); |
| + RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), range, exceptionState); |
| if (exceptionState.hadException()) |
| return nullptr; |
| @@ -649,7 +649,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::count(ExecutionContext* conte |
| return nullptr; |
| } |
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); |
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); |
| backendDB()->count(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange.release(), WebIDBCallbacksImpl::create(request).leakPtr()); |
| return request.release(); |
| } |