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