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

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

Issue 2167853003: [DevTools] Always report encodedDataLength in Network.ResponseReceived. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes Created 4 years, 3 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 unified diff | Download patch
OLDNEW
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
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
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 (!first_chunk_read_)
448 encoded_data_length -= request()->raw_header_size();
449
446 int encoded_body_length = CalculateEncodedBodyLengthToReport(); 450 int encoded_body_length = CalculateEncodedBodyLengthToReport();
451 first_chunk_read_ = 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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698