Index: third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h |
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h |
index 0f5eaed372837c3acdeac43dc18a3ffc5811ac60..de044dbe7fef9f79301aa0c228f97e0f1ed975c4 100644 |
--- a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h |
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h |
@@ -26,6 +26,8 @@ |
#ifndef IDBTransaction_h |
#define IDBTransaction_h |
+#include <memory> |
+ |
#include "core/dom/ContextLifecycleObserver.h" |
#include "core/dom/DOMStringList.h" |
#include "core/events/EventListener.h" |
@@ -36,6 +38,7 @@ |
#include "modules/indexeddb/IndexedDB.h" |
#include "platform/bindings/ActiveScriptWrappable.h" |
#include "platform/heap/Handle.h" |
+#include "platform/wtf/Deque.h" |
#include "platform/wtf/HashSet.h" |
#include "platform/wtf/Vector.h" |
#include "public/platform/modules/indexeddb/WebIDBDatabase.h" |
@@ -51,6 +54,7 @@ class IDBIndex; |
class IDBObjectStore; |
class IDBOpenDBRequest; |
class IDBRequest; |
+class IDBRequestQueueItem; |
class ScriptState; |
class MODULES_EXPORT IDBTransaction final |
@@ -105,6 +109,15 @@ class MODULES_EXPORT IDBTransaction final |
void RegisterRequest(IDBRequest*); |
void UnregisterRequest(IDBRequest*); |
+ // True if this transaction has at least one request whose result is being |
+ // post-processed. |
+ // |
+ // While this is true, new results must be queued using EnqueueResult(). |
+ inline bool HasQueuedResults() const { return !result_queue_.empty(); } |
+ void EnqueueResult(std::unique_ptr<IDBRequestQueueItem> result); |
+ // Called when a result's post-processing has completed. |
+ void OnResultReady(); |
+ |
// The methods below are called right before the changes are applied to the |
// database's metadata. We use this unusual sequencing because some of the |
// methods below need to access the metadata values before the change, and |
@@ -212,6 +225,15 @@ class MODULES_EXPORT IDBTransaction final |
HeapListHashSet<Member<IDBRequest>> request_list_; |
+ // The IDBRequest results whose events have not been enqueued yet. |
+ // |
+ // When a result requires post-processing, such as large value unwrapping, it |
+ // is queued up until post-processing completes. All the results that arrive |
+ // during the post-processing phase are also queued up, so their result events |
+ // are fired in the order in which the requests were performed, as prescribed |
+ // by the IndexedDB specification. |
+ Deque<std::unique_ptr<IDBRequestQueueItem>> result_queue_; |
+ |
#if DCHECK_IS_ON() |
bool finish_called_ = false; |
#endif // DCHECK_IS_ON() |