OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/async_resource_handler.h" | 5 #include "content/browser/loader/async_resource_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 waiting_for_upload_progress_ack_ = false; | 344 waiting_for_upload_progress_ack_ = false; |
345 ReportUploadProgress(); | 345 ReportUploadProgress(); |
346 } | 346 } |
347 | 347 |
348 if (rdh_->delegate()) { | 348 if (rdh_->delegate()) { |
349 rdh_->delegate()->OnResponseStarted(request(), info->GetContext(), | 349 rdh_->delegate()->OnResponseStarted(request(), info->GetContext(), |
350 response); | 350 response); |
351 } | 351 } |
352 | 352 |
353 NetLogObserver::PopulateResponseInfo(request(), response); | 353 NetLogObserver::PopulateResponseInfo(request(), response); |
| 354 response->head.encoded_data_length = request()->raw_header_size(); |
354 | 355 |
355 const HostZoomMapImpl* host_zoom_map = | 356 const HostZoomMapImpl* host_zoom_map = |
356 static_cast<const HostZoomMapImpl*>(info->filter()->GetHostZoomMap()); | 357 static_cast<const HostZoomMapImpl*>(info->filter()->GetHostZoomMap()); |
357 | 358 |
358 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME && host_zoom_map) { | 359 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME && host_zoom_map) { |
359 const GURL& request_url = request()->url(); | 360 const GURL& request_url = request()->url(); |
360 int render_process_id = info->GetChildID(); | 361 int render_process_id = info->GetChildID(); |
361 int render_view_id = info->GetRouteID(); | 362 int render_view_id = info->GetRouteID(); |
362 | 363 |
363 double zoom_level = host_zoom_map->GetZoomLevelForView( | 364 double zoom_level = host_zoom_map->GetZoomLevelForView( |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 DCHECK_GE(bytes_read, 0); | 437 DCHECK_GE(bytes_read, 0); |
437 | 438 |
438 if (!bytes_read) | 439 if (!bytes_read) |
439 return true; | 440 return true; |
440 | 441 |
441 ResourceMessageFilter* filter = GetFilter(); | 442 ResourceMessageFilter* filter = GetFilter(); |
442 if (!filter) | 443 if (!filter) |
443 return false; | 444 return false; |
444 | 445 |
445 int encoded_data_length = CalculateEncodedDataLengthToReport(); | 446 int encoded_data_length = CalculateEncodedDataLengthToReport(); |
| 447 if (!received_first_packet_) |
| 448 encoded_data_length -= request()->raw_header_size(); |
| 449 |
446 int encoded_body_length = CalculateEncodedBodyLengthToReport(); | 450 int encoded_body_length = CalculateEncodedBodyLengthToReport(); |
| 451 received_first_packet_ = true; |
447 | 452 |
448 // Return early if InliningHelper handled the received data. | 453 // Return early if InliningHelper handled the received data. |
449 if (inlining_helper_->SendInlinedDataIfApplicable( | 454 if (inlining_helper_->SendInlinedDataIfApplicable( |
450 bytes_read, encoded_data_length, encoded_body_length, filter, | 455 bytes_read, encoded_data_length, encoded_body_length, filter, |
451 GetRequestID())) | 456 GetRequestID())) |
452 return true; | 457 return true; |
453 | 458 |
454 buffer_->ShrinkLastAllocation(bytes_read); | 459 buffer_->ShrinkLastAllocation(bytes_read); |
455 | 460 |
456 if (!sent_data_buffer_msg_) { | 461 if (!sent_data_buffer_msg_) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 } else { | 606 } else { |
602 UMA_HISTOGRAM_CUSTOM_COUNTS( | 607 UMA_HISTOGRAM_CUSTOM_COUNTS( |
603 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB", | 608 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB", |
604 elapsed_time, 1, 100000, 100); | 609 elapsed_time, 1, 100000, 100); |
605 } | 610 } |
606 | 611 |
607 inlining_helper_->RecordHistogram(elapsed_time); | 612 inlining_helper_->RecordHistogram(elapsed_time); |
608 } | 613 } |
609 | 614 |
610 } // namespace content | 615 } // namespace content |
OLD | NEW |