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

Unified Diff: content/child/blob_storage/blob_transport_controller.cc

Issue 1997623002: Revert of [BlobAsync] Fixed race between IPC messages and IO task queue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: content/child/blob_storage/blob_transport_controller.cc
diff --git a/content/child/blob_storage/blob_transport_controller.cc b/content/child/blob_storage/blob_transport_controller.cc
index 2b0e184b550a978aa46c23f718a2762a6f75ed08..0bcadbc85d30e80ac8d13d4cbaad0b5864627a04 100644
--- a/content/child/blob_storage/blob_transport_controller.cc
+++ b/content/child/blob_storage/blob_transport_controller.cc
@@ -72,18 +72,22 @@
main_runner->PostTask(FROM_HERE, base::Bind(&IncChildProcessRefCount));
}
- // TODO(dmurph): handle racy io thread scheduling, so we can send both
- // messages ASAP.
+ std::vector<storage::DataElement> descriptions;
std::set<std::string> referenced_blobs = consolidation->referenced_blobs();
+ BlobTransportController::GetDescriptions(
+ consolidation.get(), kBlobStorageIPCThresholdBytes, &descriptions);
+ // I post the task first to make sure that we store our consolidation before
+ // we get a request back from the browser.
+ io_runner->PostTask(
+ FROM_HERE,
+ base::Bind(&BlobTransportController::StoreBlobDataForRequests,
+ base::Unretained(BlobTransportController::GetInstance()), uuid,
+ base::Passed(std::move(consolidation)),
+ base::Passed(std::move(main_runner))));
+ // TODO(dmurph): Merge register and start messages.
sender->Send(new BlobStorageMsg_RegisterBlobUUID(uuid, content_type, "",
referenced_blobs));
- io_runner->PostTask(
- FROM_HERE,
- base::Bind(&BlobTransportController::StoreBlobDataAndStart,
- base::Unretained(BlobTransportController::GetInstance()), uuid,
- base::Passed(&consolidation),
- base::Passed(&sender),
- base::Passed(&main_runner)));
+ sender->Send(new BlobStorageMsg_StartBuildingBlob(uuid, descriptions));
}
void BlobTransportController::OnMemoryRequest(
@@ -194,16 +198,10 @@
blob_storage_.clear();
}
-void BlobTransportController::StoreBlobDataAndStart(
+void BlobTransportController::StoreBlobDataForRequests(
const std::string& uuid,
std::unique_ptr<BlobConsolidation> consolidation,
- scoped_refptr<ThreadSafeSender> sender,
scoped_refptr<base::SingleThreadTaskRunner> main_runner) {
- std::vector<storage::DataElement> descriptions;
- BlobTransportController::GetDescriptions(
- consolidation.get(), kBlobStorageIPCThresholdBytes, &descriptions);
- sender->Send(new BlobStorageMsg_StartBuildingBlob(uuid, descriptions));
-
if (!main_thread_runner_.get()) {
main_thread_runner_ = std::move(main_runner);
}

Powered by Google App Engine
This is Rietveld 408576698