Chromium Code Reviews| 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..280d2d9fc2f6315b0fb8083707c714dfdd9dd8ec 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,40 @@ void IDBTransaction::RegisterRequest(IDBRequest* request) { |
| void IDBTransaction::UnregisterRequest(IDBRequest* request) { |
| DCHECK(request); |
| + |
| + // TODO(pwnall): Finish figuring out the abort path. |
| + // DCHECK_EQ(request->QueueItem(), nullptr); |
| + IDBRequestQueueItem* queue_item = request->QueueItem(); |
| + if (queue_item) { |
| + queue_item->CancelLoading(); |
| + } |
| + |
| // 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() { |
|
dmurph
2017/05/23 18:16:39
Can you rename this to SendPendingReadyResponses()
pwnall
2017/05/25 13:27:11
Let's figure out a good name in the next pass.
|
| + while (!result_queue_.empty()) { |
| + IDBRequestQueueItem* result = result_queue_.front().get(); |
| + if (!result->IsReady()) |
| + break; |
| + |
| + result->EnqueueResponse(); |
|
dmurph
2017/05/23 18:16:39
If you change to callbacks.... you can make this j
pwnall
2017/05/25 13:27:12
Per in person discussion, I've introduced a WTF::C
|
| + result_queue_.pop_front(); |
| + } |
| +} |
| + |
| void IDBTransaction::OnAbort(DOMException* error) { |
| IDB_TRACE("IDBTransaction::onAbort"); |
| if (!GetExecutionContext()) { |