Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(950)

Unified Diff: Source/modules/indexeddb/IDBObjectStore.cpp

Issue 236773003: Completely remove DOMRequestState from IndexedDB code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/indexeddb/IDBKeyRange.cpp ('k') | Source/modules/indexeddb/IDBRequest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/indexeddb/IDBObjectStore.cpp
diff --git a/Source/modules/indexeddb/IDBObjectStore.cpp b/Source/modules/indexeddb/IDBObjectStore.cpp
index 508fde4a4336cabd889b4fb933603d26884c4c59..656db133514fcbda7310b4b0cb7f41226c2945a8 100644
--- a/Source/modules/indexeddb/IDBObjectStore.cpp
+++ b/Source/modules/indexeddb/IDBObjectStore.cpp
@@ -104,10 +104,10 @@ PassRefPtr<IDBRequest> IDBObjectStore::get(ExecutionContext* context, const Scri
return request.release();
}
-static void generateIndexKeysForValue(DOMRequestState* requestState, const IDBIndexMetadata& indexMetadata, const ScriptValue& objectValue, IDBObjectStore::IndexKeys* indexKeys)
+static void generateIndexKeysForValue(v8::Isolate* isolate, const IDBIndexMetadata& indexMetadata, const ScriptValue& objectValue, IDBObjectStore::IndexKeys* indexKeys)
{
ASSERT(indexKeys);
- RefPtr<IDBKey> indexKey = createIDBKeyFromScriptValueAndKeyPath(requestState, objectValue, indexMetadata.keyPath);
+ RefPtr<IDBKey> indexKey = createIDBKeyFromScriptValueAndKeyPath(isolate, objectValue, indexMetadata.keyPath);
if (!indexKey)
return;
@@ -141,9 +141,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptState* state, ScriptValue& valu
PassRefPtr<IDBRequest> IDBObjectStore::put(WebIDBDatabase::PutMode putMode, PassRefPtr<IDBAny> source, ScriptState* state, ScriptValue& value, const ScriptValue& keyValue, ExceptionState& exceptionState)
{
- ExecutionContext* context = state->executionContext();
- DOMRequestState requestState(toIsolate(context));
- RefPtr<IDBKey> key = keyValue.isUndefined() ? nullptr : scriptValueToIDBKey(&requestState, keyValue);
+ RefPtr<IDBKey> key = keyValue.isUndefined() ? nullptr : scriptValueToIDBKey(state->isolate(), keyValue);
return put(putMode, source, state, value, key.release(), exceptionState);
}
@@ -182,8 +180,6 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(WebIDBDatabase::PutMode putMode, Pass
const bool hasKeyGenerator = autoIncrement();
ExecutionContext* context = state->executionContext();
- DOMRequestState requestState(toIsolate(context));
-
if (putMode != WebIDBDatabase::CursorUpdate && usesInLineKeys && key) {
exceptionState.throwDOMException(DataError, "The object store uses in-line keys and the key parameter was provided.");
return nullptr;
@@ -193,7 +189,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(WebIDBDatabase::PutMode putMode, Pass
return nullptr;
}
if (usesInLineKeys) {
- RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(&requestState, value, keyPath);
+ RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(state->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;
@@ -203,7 +199,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(WebIDBDatabase::PutMode putMode, Pass
return nullptr;
}
if (hasKeyGenerator && !keyPathKey) {
- if (!canInjectIDBKeyIntoScriptValue(&requestState, value, keyPath)) {
+ if (!canInjectIDBKeyIntoScriptValue(state->isolate(), value, keyPath)) {
exceptionState.throwDOMException(DataError, "A generated key could not be inserted into the value.");
return nullptr;
}
@@ -220,7 +216,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(WebIDBDatabase::PutMode putMode, Pass
Vector<IndexKeys> indexKeys;
for (IDBObjectStoreMetadata::IndexMap::const_iterator it = m_metadata.indexes.begin(); it != m_metadata.indexes.end(); ++it) {
IndexKeys keys;
- generateIndexKeysForValue(&requestState, it->value, value, &keys);
+ generateIndexKeysForValue(state->isolate(), it->value, value, &keys);
indexIds.append(it->key);
indexKeys.append(keys);
}
@@ -340,7 +336,7 @@ private:
ScriptValue value = cursor->value(m_scriptState.get());
IDBObjectStore::IndexKeys indexKeys;
- generateIndexKeysForValue(request->requestState(), m_indexMetadata, value, &indexKeys);
+ generateIndexKeysForValue(toIsolate(context), m_indexMetadata, value, &indexKeys);
Vector<IDBObjectStore::IndexKeys> indexKeysList;
indexKeysList.append(indexKeys);
« no previous file with comments | « Source/modules/indexeddb/IDBKeyRange.cpp ('k') | Source/modules/indexeddb/IDBRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698