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

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

Issue 1234813004: [BlobAsync] Asynchronous Blob Construction Final Patch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blob-protocol-change
Patch Set: comments Created 4 years, 9 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.h
diff --git a/content/child/blob_storage/blob_transport_controller.h b/content/child/blob_storage/blob_transport_controller.h
index 4a2ef0a49ec0cfee3e74863c2b3eb3bf4e19fdf0..f2699abddfff96a766e8f7c916a10fc9336954c3 100644
--- a/content/child/blob_storage/blob_transport_controller.h
+++ b/content/child/blob_storage/blob_transport_controller.h
@@ -23,6 +23,7 @@
namespace base {
template <typename T>
struct DefaultLazyInstanceTraits;
+class SingleThreadTaskRunner;
}
namespace storage {
@@ -55,10 +56,14 @@ class CONTENT_EXPORT BlobTransportController {
// This kicks off a blob transfer to the browser thread, which involves
// sending an IPC message and storing the blob consolidation object.
- void InitiateBlobTransfer(const std::string& uuid,
- const std::string& type,
- scoped_ptr<BlobConsolidation> consolidation,
- IPC::Sender* sender);
+ // If we have no pending blobs, we also call ChildProcess::AddRefProcess to
+ // keep our process around while we transfer. This will be decremented when
+ // we finish our last pending transfer (when our map is empty).
+ void InitiateBlobTransfer(
+ const std::string& uuid,
+ scoped_ptr<BlobConsolidation> consolidation,
+ IPC::Sender* sender,
+ scoped_refptr<base::SingleThreadTaskRunner> main_runner);
// This responds to the request using the sender.
void OnMemoryRequest(
@@ -73,8 +78,6 @@ class CONTENT_EXPORT BlobTransportController {
void OnDone(const std::string& uuid);
- // Clears all internal state for testing and such.
- void Clear();
bool IsTransporting(const std::string& uuid) {
return blob_storage_.find(uuid) != blob_storage_.end();
@@ -83,11 +86,16 @@ class CONTENT_EXPORT BlobTransportController {
~BlobTransportController();
private:
+ friend class BlobTransportControllerTest;
FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, Descriptions);
FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, Responses);
FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, SharedMemory);
FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, ResponsesErrors);
+ // Clears all internal state. If our map wasn't previously empty, then we call
+ // ChildProcess::ReleaseProcess to release our previous reference.
+ void ClearForTesting();
+
enum class ResponsesStatus {
BLOB_NOT_FOUND,
SHARED_MEMORY_MAP_FAILED,
@@ -97,12 +105,6 @@ class CONTENT_EXPORT BlobTransportController {
BlobTransportController();
- // Sends the IPC to cancel the blob transfer, and releases the blob from
- // internal storage.
- void CancelBlobTransfer(const std::string& uuid,
- storage::IPCBlobCreationCancelCode code,
- IPC::Sender* sender);
-
void GetDescriptions(BlobConsolidation* consolidation,
size_t max_data_population,
std::vector<storage::DataElement>* out);
@@ -114,8 +116,12 @@ class CONTENT_EXPORT BlobTransportController {
const std::vector<IPC::PlatformFileForTransit>& file_handles,
std::vector<storage::BlobItemBytesResponse>* output);
+ // Deletes the consolidation, and if we removed the last consolidation from
+ // our map, we call ChildProcess::ReleaseProcess to release our previous
+ // reference.
void ReleaseBlobConsolidation(const std::string& uuid);
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_;
std::map<std::string, scoped_ptr<BlobConsolidation>> blob_storage_;
DISALLOW_COPY_AND_ASSIGN(BlobTransportController);

Powered by Google App Engine
This is Rietveld 408576698