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

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: fix 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
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 frame()->loader().progress().incrementProgress(identifier, dataLength);
418 InspectorInstrumentation::didReceiveData(frame(), identifier, data,
419 dataLength);
420 }
421
422 void FrameFetchContext::dispatchDidReceiveEncodedData(unsigned long identifier,
423 int encodedDataLength) {
418 TRACE_EVENT1( 424 TRACE_EVENT1(
419 "devtools.timeline", "ResourceReceivedData", "data", 425 "devtools.timeline", "ResourceReceivedData", "data",
420 InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength)); 426 InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength));
421 frame()->loader().progress().incrementProgress(identifier, dataLength); 427 InspectorInstrumentation::didReceiveEncodedDataLength(frame(), identifier,
422 InspectorInstrumentation::didReceiveData(frame(), identifier, data, 428 encodedDataLength);
423 dataLength, encodedDataLength);
424 } 429 }
425 430
426 void FrameFetchContext::dispatchDidDownloadData(unsigned long identifier, 431 void FrameFetchContext::dispatchDidDownloadData(unsigned long identifier,
427 int dataLength, 432 int dataLength,
428 int encodedDataLength) { 433 int encodedDataLength) {
429 TRACE_EVENT1( 434 TRACE_EVENT1(
430 "devtools.timeline", "ResourceReceivedData", "data", 435 "devtools.timeline", "ResourceReceivedData", "data",
431 InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength)); 436 InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength));
432 frame()->loader().progress().incrementProgress(identifier, dataLength); 437 frame()->loader().progress().incrementProgress(identifier, dataLength);
433 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength, 438 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength);
434 encodedDataLength); 439 InspectorInstrumentation::didReceiveEncodedDataLength(frame(), identifier,
440 encodedDataLength);
435 } 441 }
436 442
437 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, 443 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier,
438 double finishTime, 444 double finishTime,
439 int64_t encodedDataLength) { 445 int64_t encodedDataLength) {
440 TRACE_EVENT1( 446 TRACE_EVENT1(
441 "devtools.timeline", "ResourceFinish", "data", 447 "devtools.timeline", "ResourceFinish", "data",
442 InspectorResourceFinishEvent::data(identifier, finishTime, false)); 448 InspectorResourceFinishEvent::data(identifier, finishTime, false));
443 frame()->loader().progress().completeProgress(identifier); 449 frame()->loader().progress().completeProgress(identifier);
444 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime, 450 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime,
445 encodedDataLength); 451 encodedDataLength);
446 if (frame()->frameScheduler()) 452 if (frame()->frameScheduler())
447 frame()->frameScheduler()->didStopLoading(identifier); 453 frame()->frameScheduler()->didStopLoading(identifier);
448 } 454 }
449 455
450 void FrameFetchContext::dispatchDidFail(unsigned long identifier, 456 void FrameFetchContext::dispatchDidFail(unsigned long identifier,
451 const ResourceError& error, 457 const ResourceError& error,
458 int64_t encodedDataLength,
452 bool isInternalRequest) { 459 bool isInternalRequest) {
453 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", 460 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
454 InspectorResourceFinishEvent::data(identifier, 0, true)); 461 InspectorResourceFinishEvent::data(identifier, 0, true));
455 frame()->loader().progress().completeProgress(identifier); 462 frame()->loader().progress().completeProgress(identifier);
456 InspectorInstrumentation::didFailLoading(frame(), identifier, error); 463 InspectorInstrumentation::didFailLoading(frame(), identifier, error);
457 // Notification to FrameConsole should come AFTER InspectorInstrumentation 464 // Notification to FrameConsole should come AFTER InspectorInstrumentation
458 // call, DevTools front-end relies on this. 465 // call, DevTools front-end relies on this.
459 if (!isInternalRequest) 466 if (!isInternalRequest)
460 frame()->console().didFailLoading(identifier, error); 467 frame()->console().didFailLoading(identifier, error);
461 if (frame()->frameScheduler()) 468 if (frame()->frameScheduler())
(...skipping 14 matching lines...) Expand all
476 resource->options().initiatorInfo); 483 resource->options().initiatorInfo);
477 484
478 InspectorInstrumentation::markResourceAsCached(frame(), identifier); 485 InspectorInstrumentation::markResourceAsCached(frame(), identifier);
479 if (!resource->response().isNull()) { 486 if (!resource->response().isNull()) {
480 dispatchDidReceiveResponseInternal(identifier, resource->response(), 487 dispatchDidReceiveResponseInternal(identifier, resource->response(),
481 frameType, requestContext, resource, 488 frameType, requestContext, resource,
482 LinkLoader::DoNotLoadResources); 489 LinkLoader::DoNotLoadResources);
483 } 490 }
484 491
485 if (resource->encodedSize() > 0) 492 if (resource->encodedSize() > 0)
486 dispatchDidReceiveData(identifier, 0, resource->encodedSize(), 0); 493 dispatchDidReceiveData(identifier, 0, resource->encodedSize());
487 494
488 dispatchDidFinishLoading(identifier, 0, 0); 495 dispatchDidFinishLoading(identifier, 0, 0);
489 } 496 }
490 497
491 bool FrameFetchContext::shouldLoadNewResource(Resource::Type type) const { 498 bool FrameFetchContext::shouldLoadNewResource(Resource::Type type) const {
492 if (!m_documentLoader) 499 if (!m_documentLoader)
493 return true; 500 return true;
494 if (type == Resource::MainResource) 501 if (type == Resource::MainResource)
495 return m_documentLoader == frame()->loader().provisionalDocumentLoader(); 502 return m_documentLoader == frame()->loader().provisionalDocumentLoader();
496 return m_documentLoader == frame()->loader().documentLoader(); 503 return m_documentLoader == frame()->loader().documentLoader();
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 response); 1013 response);
1007 } 1014 }
1008 1015
1009 DEFINE_TRACE(FrameFetchContext) { 1016 DEFINE_TRACE(FrameFetchContext) {
1010 visitor->trace(m_document); 1017 visitor->trace(m_document);
1011 visitor->trace(m_documentLoader); 1018 visitor->trace(m_documentLoader);
1012 FetchContext::trace(visitor); 1019 FetchContext::trace(visitor);
1013 } 1020 }
1014 1021
1015 } // namespace blink 1022 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698