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..d620925091e117ad18e6fc3e565a022264e155ee 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,14 @@ 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, all |
+ // the results that arrive during the post-processing phase are queued up. |
jsbell
2017/05/22 21:54:20
nit: The first result requiring post-processing is
pwnall
2017/05/25 13:27:12
Done.
|
+ // This guarantees that 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() |