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

Side by Side Diff: content/browser/loader/mojo_async_resource_handler.cc

Issue 2514713002: Send encoded_body_length to renderer when response completed (1/3) (Closed)
Patch Set: merge https://codereview.chromium.org/2526653002/ Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/loader/mojo_async_resource_handler.h" 5 #include "content/browser/loader/mojo_async_resource_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // the ERR_ABORTED error code). 330 // the ERR_ABORTED error code).
331 DCHECK(!was_ignored_by_handler || error_code == net::ERR_ABORTED); 331 DCHECK(!was_ignored_by_handler || error_code == net::ERR_ABORTED);
332 332
333 ResourceRequestCompletionStatus request_complete_data; 333 ResourceRequestCompletionStatus request_complete_data;
334 request_complete_data.error_code = error_code; 334 request_complete_data.error_code = error_code;
335 request_complete_data.was_ignored_by_handler = was_ignored_by_handler; 335 request_complete_data.was_ignored_by_handler = was_ignored_by_handler;
336 request_complete_data.exists_in_cache = request()->response_info().was_cached; 336 request_complete_data.exists_in_cache = request()->response_info().was_cached;
337 request_complete_data.completion_time = base::TimeTicks::Now(); 337 request_complete_data.completion_time = base::TimeTicks::Now();
338 request_complete_data.encoded_data_length = 338 request_complete_data.encoded_data_length =
339 request()->GetTotalReceivedBytes(); 339 request()->GetTotalReceivedBytes();
340 request_complete_data.encoded_body_length = request()->GetRawBodyBytes();
340 341
341 url_loader_client_->OnComplete(request_complete_data); 342 url_loader_client_->OnComplete(request_complete_data);
342 } 343 }
343 344
344 bool MojoAsyncResourceHandler::CopyReadDataToDataPipe(bool* defer) { 345 bool MojoAsyncResourceHandler::CopyReadDataToDataPipe(bool* defer) {
345 while (true) { 346 while (true) {
346 scoped_refptr<net::IOBufferWithSize> dest; 347 scoped_refptr<net::IOBufferWithSize> dest;
347 if (!AllocateWriterIOBuffer(&dest, defer)) 348 if (!AllocateWriterIOBuffer(&dest, defer))
348 return false; 349 return false;
349 if (*defer) 350 if (*defer)
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 const ResourceRequestInfoImpl* info = GetRequestInfo(); 433 const ResourceRequestInfoImpl* info = GetRequestInfo();
433 ResourceDispatcherHostImpl::Get()->CancelRequestFromRenderer( 434 ResourceDispatcherHostImpl::Get()->CancelRequestFromRenderer(
434 GlobalRequestID(info->GetChildID(), info->GetRequestID())); 435 GlobalRequestID(info->GetChildID(), info->GetRequestID()));
435 } 436 }
436 437
437 void MojoAsyncResourceHandler::ReportBadMessage(const std::string& error) { 438 void MojoAsyncResourceHandler::ReportBadMessage(const std::string& error) {
438 mojo::ReportBadMessage(error); 439 mojo::ReportBadMessage(error);
439 } 440 }
440 441
441 } // namespace content 442 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/async_resource_handler_unittest.cc ('k') | content/browser/loader/resource_dispatcher_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698