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

Unified Diff: content/browser/histogram_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
Index: content/browser/histogram_internals_url_loader.cc
diff --git a/content/browser/histogram_internals_url_loader.cc b/content/browser/histogram_internals_url_loader.cc
index 67b37b3c4a535306325065685e0b8bf597a11f27..8e38a9b639f3b94229732627eae335cc1b642c1f 100644
--- a/content/browser/histogram_internals_url_loader.cc
+++ b/content/browser/histogram_internals_url_loader.cc
@@ -22,28 +22,11 @@ void StartHistogramInternalsURLLoader(const ResourceRequest& request,
base::StatisticsRecorder::ImportProvidedHistograms();
std::string data = HistogramInternalsRequestJob::GenerateHTML(request.url);
-
- 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 = data.size();
- mojo::DataPipe data_pipe(options);
-
- DCHECK(data_pipe.producer_handle.is_valid());
- DCHECK(data_pipe.consumer_handle.is_valid());
-
+ mojo::DataPipe data_pipe(data.size());
CHECK(mojo::common::BlockingCopyFromString(data, data_pipe.producer_handle));
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 = data.size();
- request_complete_data.encoded_body_length = data.size();
- client->OnComplete(request_complete_data);
+ client->OnComplete(ResourceRequestCompletionStatus(data.size()));
}
} // namespace content
« no previous file with comments | « content/browser/blob_storage/blob_internals_url_loader.cc ('k') | content/browser/webui/web_ui_url_loader_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698