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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h

Issue 2822453003: Wrap large IndexedDB values into Blobs before writing to LevelDB. (Closed)
Patch Set: Fixed compilation errors on Windows and no-DCHECKs. Created 3 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
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..76b9c5583f3483b8f3f3e68870c6898aea7ef658 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h
@@ -33,6 +33,7 @@
#include "modules/EventTargetModules.h"
#include "modules/ModulesExport.h"
#include "modules/indexeddb/IDBMetadata.h"
+#include "modules/indexeddb/IDBRequestQueue.h"
#include "modules/indexeddb/IndexedDB.h"
#include "platform/bindings/ActiveScriptWrappable.h"
#include "platform/heap/Handle.h"
@@ -105,6 +106,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 QueueResult().
+ inline bool HasQueuedResult() const { return !result_queue_.empty(); }
+ void EnqueueResult(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 +222,14 @@ class MODULES_EXPORT IDBTransaction final
HeapListHashSet<Member<IDBRequest>> request_list_;
+ // The IDBRequest results whose events have not fired 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.
+ // This guarantees that result events are fired in the order in which the
+ // requests were performed, as prescribed by the IndexedDB specification.
+ IDBRequestQueue result_queue_;
+
#if DCHECK_IS_ON()
bool finish_called_ = false;
#endif // DCHECK_IS_ON()

Powered by Google App Engine
This is Rietveld 408576698