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

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

Issue 2822453003: Wrap large IndexedDB values into Blobs before writing to LevelDB. (Closed)
Patch Set: Addressed last round of feedback. Created 3 years, 7 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.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp
index 2cd04cee1f4d08913dcd6c95af7bf885dcdffb1f..42dff94b67a67a38be96b1db205b9a2624e9a9b8 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp
@@ -36,6 +36,7 @@
#include "modules/indexeddb/IDBIndex.h"
#include "modules/indexeddb/IDBObjectStore.h"
#include "modules/indexeddb/IDBOpenDBRequest.h"
+#include "modules/indexeddb/IDBRequestQueueItem.h"
#include "modules/indexeddb/IDBTracing.h"
#include "platform/bindings/ScriptState.h"
#include "platform/bindings/V8PerIsolateData.h"
@@ -380,10 +381,37 @@ void IDBTransaction::RegisterRequest(IDBRequest* request) {
void IDBTransaction::UnregisterRequest(IDBRequest* request) {
DCHECK(request);
+#if DCHECK_IS_ON()
+ // Make sure that no pending IDBRequest gets left behind in the result queue.
+ DCHECK(!request->QueueItem() || request->QueueItem()->IsReady());
+#endif // DCHECK_IS_ON()
+
// If we aborted the request, it will already have been removed.
request_list_.erase(request);
}
+void IDBTransaction::EnqueueResult(
+ std::unique_ptr<IDBRequestQueueItem> result) {
+ DCHECK(result);
+ DCHECK(HasQueuedResults() || !result->IsReady());
+
+ result_queue_.push_back(std::move(result));
+ // StartLoading() may complete post-processing synchronously, so the result
+ // needs to be in the queue before StartLoading() is called.
+ result_queue_.back()->StartLoading();
+}
+
+void IDBTransaction::OnResultReady() {
+ while (!result_queue_.empty()) {
+ IDBRequestQueueItem* result = result_queue_.front().get();
+ if (!result->IsReady())
+ break;
+
+ result->EnqueueResponse();
+ result_queue_.pop_front();
+ }
+}
+
void IDBTransaction::OnAbort(DOMException* error) {
IDB_TRACE("IDBTransaction::onAbort");
if (!GetExecutionContext()) {

Powered by Google App Engine
This is Rietveld 408576698