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

Unified Diff: content/browser/blob_storage/blob_internals_url_loader.cc

Issue 2875143002: Reduce boilerplate when creating simple mojom::URLLoaders. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | content/browser/histogram_internals_url_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/blob_storage/blob_internals_url_loader.cc
diff --git a/content/browser/blob_storage/blob_internals_url_loader.cc b/content/browser/blob_storage/blob_internals_url_loader.cc
index fe5d62b2c706e4297a8b8b9b2a63e63ee019862d..84906c806d8dfdb8d83e2fa050f197d7488c0840 100644
--- a/content/browser/blob_storage/blob_internals_url_loader.cc
+++ b/content/browser/blob_storage/blob_internals_url_loader.cc
@@ -26,16 +26,7 @@ void StartBlobInternalsURLLoader(
std::string output = storage::ViewBlobInternalsJob::GenerateHTML(
blob_storage_context->context());
-
- MojoCreateDataPipeOptions options;
- options.struct_size = sizeof(MojoCreateDataPipeOptions);
- options.flags = MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE;
- options.element_num_bytes = 1;
- options.capacity_num_bytes = output.size();
- mojo::DataPipe data_pipe(options);
-
- DCHECK(data_pipe.producer_handle.is_valid());
- DCHECK(data_pipe.consumer_handle.is_valid());
+ mojo::DataPipe data_pipe(output.size());
void* buffer = nullptr;
uint32_t num_bytes = output.size();
@@ -50,14 +41,7 @@ void StartBlobInternalsURLLoader(
CHECK_EQ(result, MOJO_RESULT_OK);
client->OnStartLoadingResponseBody(std::move(data_pipe.consumer_handle));
-
- ResourceRequestCompletionStatus request_complete_data;
- request_complete_data.error_code = net::OK;
- request_complete_data.exists_in_cache = false;
- request_complete_data.completion_time = base::TimeTicks::Now();
- request_complete_data.encoded_data_length = output.size();
- request_complete_data.encoded_body_length = output.size();
- client->OnComplete(request_complete_data);
+ client->OnComplete(ResourceRequestCompletionStatus(output.size()));
}
} // namespace content
« no previous file with comments | « no previous file | content/browser/histogram_internals_url_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698