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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2519893002: Stop dispatching encoded-data-length on each data chunk arrival (Closed)
Patch Set: PS5 again 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 WebURLRequest::FrameType frameType, 406 WebURLRequest::FrameType frameType,
407 WebURLRequest::RequestContext requestContext, 407 WebURLRequest::RequestContext requestContext,
408 Resource* resource) { 408 Resource* resource) {
409 dispatchDidReceiveResponseInternal(identifier, response, frameType, 409 dispatchDidReceiveResponseInternal(identifier, response, frameType,
410 requestContext, resource, 410 requestContext, resource,
411 LinkLoader::LoadResourcesAndPreconnect); 411 LinkLoader::LoadResourcesAndPreconnect);
412 } 412 }
413 413
414 void FrameFetchContext::dispatchDidReceiveData(unsigned long identifier, 414 void FrameFetchContext::dispatchDidReceiveData(unsigned long identifier,
415 const char* data, 415 const char* data,
416 int dataLength, 416 int dataLength) {
417 int encodedDataLength) { 417 TRACE_EVENT1("devtools.timeline", "ResourceReceivedData", "data",
418 InspectorReceiveDataEvent::data(identifier, frame(), 0));
419 frame()->loader().progress().incrementProgress(identifier, dataLength);
420 InspectorInstrumentation::didReceiveData(frame(), identifier, data,
421 dataLength);
422 }
423
424 void FrameFetchContext::dispatchDidReceiveEncodedData(unsigned long identifier,
425 int encodedDataLength) {
418 TRACE_EVENT1( 426 TRACE_EVENT1(
419 "devtools.timeline", "ResourceReceivedData", "data", 427 "devtools.timeline", "ResourceReceivedData", "data",
420 InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength)); 428 InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength));
421 frame()->loader().progress().incrementProgress(identifier, dataLength); 429 InspectorInstrumentation::didReceiveEncodedData(frame(), identifier,
422 InspectorInstrumentation::didReceiveData(frame(), identifier, data, 430 encodedDataLength);
423 dataLength, encodedDataLength);
424 } 431 }
425 432
426 void FrameFetchContext::dispatchDidDownloadData(unsigned long identifier, 433 void FrameFetchContext::dispatchDidDownloadData(unsigned long identifier,
427 int dataLength, 434 int dataLength,
428 int encodedDataLength) { 435 int encodedDataLength) {
429 TRACE_EVENT1( 436 TRACE_EVENT1(
430 "devtools.timeline", "ResourceReceivedData", "data", 437 "devtools.timeline", "ResourceReceivedData", "data",
431 InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength)); 438 InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength));
432 frame()->loader().progress().incrementProgress(identifier, dataLength); 439 frame()->loader().progress().incrementProgress(identifier, dataLength);
433 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength, 440 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength);
434 encodedDataLength); 441 InspectorInstrumentation::didReceiveEncodedData(frame(), identifier,
442 encodedDataLength);
435 } 443 }
436 444
437 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, 445 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier,
438 double finishTime, 446 double finishTime,
439 int64_t encodedDataLength) { 447 int64_t encodedDataLength) {
440 TRACE_EVENT1( 448 TRACE_EVENT1(
441 "devtools.timeline", "ResourceFinish", "data", 449 "devtools.timeline", "ResourceFinish", "data",
442 InspectorResourceFinishEvent::data(identifier, finishTime, false)); 450 InspectorResourceFinishEvent::data(identifier, finishTime, false));
443 frame()->loader().progress().completeProgress(identifier); 451 frame()->loader().progress().completeProgress(identifier);
444 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime, 452 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime,
445 encodedDataLength); 453 encodedDataLength);
446 if (frame()->frameScheduler()) 454 if (frame()->frameScheduler())
447 frame()->frameScheduler()->didStopLoading(identifier); 455 frame()->frameScheduler()->didStopLoading(identifier);
448 } 456 }
449 457
450 void FrameFetchContext::dispatchDidFail(unsigned long identifier, 458 void FrameFetchContext::dispatchDidFail(unsigned long identifier,
451 const ResourceError& error, 459 const ResourceError& error,
460 int64_t encodedDataLength,
dgozman 2016/11/30 18:02:17 Why pass this if it's unused?
yhirano 2016/12/01 10:33:10 For consistency.
452 bool isInternalRequest) { 461 bool isInternalRequest) {
453 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", 462 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
454 InspectorResourceFinishEvent::data(identifier, 0, true)); 463 InspectorResourceFinishEvent::data(identifier, 0, true));
455 frame()->loader().progress().completeProgress(identifier); 464 frame()->loader().progress().completeProgress(identifier);
456 InspectorInstrumentation::didFailLoading(frame(), identifier, error); 465 InspectorInstrumentation::didFailLoading(frame(), identifier, error);
457 // Notification to FrameConsole should come AFTER InspectorInstrumentation 466 // Notification to FrameConsole should come AFTER InspectorInstrumentation
458 // call, DevTools front-end relies on this. 467 // call, DevTools front-end relies on this.
459 if (!isInternalRequest) 468 if (!isInternalRequest)
460 frame()->console().didFailLoading(identifier, error); 469 frame()->console().didFailLoading(identifier, error);
461 if (frame()->frameScheduler()) 470 if (frame()->frameScheduler())
(...skipping 14 matching lines...) Expand all
476 resource->options().initiatorInfo); 485 resource->options().initiatorInfo);
477 486
478 InspectorInstrumentation::markResourceAsCached(frame(), identifier); 487 InspectorInstrumentation::markResourceAsCached(frame(), identifier);
479 if (!resource->response().isNull()) { 488 if (!resource->response().isNull()) {
480 dispatchDidReceiveResponseInternal(identifier, resource->response(), 489 dispatchDidReceiveResponseInternal(identifier, resource->response(),
481 frameType, requestContext, resource, 490 frameType, requestContext, resource,
482 LinkLoader::DoNotLoadResources); 491 LinkLoader::DoNotLoadResources);
483 } 492 }
484 493
485 if (resource->encodedSize() > 0) 494 if (resource->encodedSize() > 0)
486 dispatchDidReceiveData(identifier, 0, resource->encodedSize(), 0); 495 dispatchDidReceiveData(identifier, 0, resource->encodedSize());
487 496
488 dispatchDidFinishLoading(identifier, 0, 0); 497 dispatchDidFinishLoading(identifier, 0, 0);
489 } 498 }
490 499
491 bool FrameFetchContext::shouldLoadNewResource(Resource::Type type) const { 500 bool FrameFetchContext::shouldLoadNewResource(Resource::Type type) const {
492 if (!m_documentLoader) 501 if (!m_documentLoader)
493 return true; 502 return true;
494 if (type == Resource::MainResource) 503 if (type == Resource::MainResource)
495 return m_documentLoader == frame()->loader().provisionalDocumentLoader(); 504 return m_documentLoader == frame()->loader().provisionalDocumentLoader();
496 return m_documentLoader == frame()->loader().documentLoader(); 505 return m_documentLoader == frame()->loader().documentLoader();
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 response); 1015 response);
1007 } 1016 }
1008 1017
1009 DEFINE_TRACE(FrameFetchContext) { 1018 DEFINE_TRACE(FrameFetchContext) {
1010 visitor->trace(m_document); 1019 visitor->trace(m_document);
1011 visitor->trace(m_documentLoader); 1020 visitor->trace(m_documentLoader);
1012 FetchContext::trace(visitor); 1021 FetchContext::trace(visitor);
1013 } 1022 }
1014 1023
1015 } // namespace blink 1024 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698