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

Unified Diff: content/network/cache_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 | « content/common/resource_request_completion_status.cc ('k') | content/network/url_loader_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/network/cache_url_loader.cc
diff --git a/content/network/cache_url_loader.cc b/content/network/cache_url_loader.cc
index dc8cc19225edaa8d150e6af0d1981d3f9b3d4bf2..67e0ab7588f99d8ea446cddd18916d052872de37 100644
--- a/content/network/cache_url_loader.cc
+++ b/content/network/cache_url_loader.cc
@@ -52,28 +52,13 @@ class CacheURLLoader {
private:
void DataAvailable(int result) {
DCHECK_EQ(net::OK, result);
- 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()));
// So we don't delete |this| in the constructor.
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
« no previous file with comments | « content/common/resource_request_completion_status.cc ('k') | content/network/url_loader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698