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

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

Issue 2712833002: DevTools: Show decoded body length for network requests on timeline. (Closed)
Patch Set: rebaseline Created 3 years, 9 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 /* 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 "devtools.timeline", "ResourceReceivedData", "data", 484 "devtools.timeline", "ResourceReceivedData", "data",
485 InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength)); 485 InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength));
486 frame()->loader().progress().incrementProgress(identifier, dataLength); 486 frame()->loader().progress().incrementProgress(identifier, dataLength);
487 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength); 487 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength);
488 InspectorInstrumentation::didReceiveEncodedDataLength(frame(), identifier, 488 InspectorInstrumentation::didReceiveEncodedDataLength(frame(), identifier,
489 encodedDataLength); 489 encodedDataLength);
490 } 490 }
491 491
492 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, 492 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier,
493 double finishTime, 493 double finishTime,
494 int64_t encodedDataLength) { 494 int64_t encodedDataLength,
495 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", 495 int64_t decodedBodyLength) {
496 InspectorResourceFinishEvent::data(identifier, finishTime, false, 496 TRACE_EVENT1(
497 encodedDataLength)); 497 "devtools.timeline", "ResourceFinish", "data",
498 InspectorResourceFinishEvent::data(identifier, finishTime, false,
499 encodedDataLength, decodedBodyLength));
498 frame()->loader().progress().completeProgress(identifier); 500 frame()->loader().progress().completeProgress(identifier);
499 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime, 501 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime,
500 encodedDataLength); 502 encodedDataLength);
501 if (frame()->frameScheduler()) 503 if (frame()->frameScheduler())
502 frame()->frameScheduler()->didStopLoading(identifier); 504 frame()->frameScheduler()->didStopLoading(identifier);
503 } 505 }
504 506
505 void FrameFetchContext::dispatchDidFail(unsigned long identifier, 507 void FrameFetchContext::dispatchDidFail(unsigned long identifier,
506 const ResourceError& error, 508 const ResourceError& error,
507 int64_t encodedDataLength, 509 int64_t encodedDataLength,
508 bool isInternalRequest) { 510 bool isInternalRequest) {
509 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", 511 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
510 InspectorResourceFinishEvent::data(identifier, 0, true, 512 InspectorResourceFinishEvent::data(identifier, 0, true,
511 encodedDataLength)); 513 encodedDataLength, 0));
512 frame()->loader().progress().completeProgress(identifier); 514 frame()->loader().progress().completeProgress(identifier);
513 InspectorInstrumentation::didFailLoading(frame(), identifier, error); 515 InspectorInstrumentation::didFailLoading(frame(), identifier, error);
514 // Notification to FrameConsole should come AFTER InspectorInstrumentation 516 // Notification to FrameConsole should come AFTER InspectorInstrumentation
515 // call, DevTools front-end relies on this. 517 // call, DevTools front-end relies on this.
516 if (!isInternalRequest) 518 if (!isInternalRequest)
517 frame()->console().didFailLoading(identifier, error); 519 frame()->console().didFailLoading(identifier, error);
518 if (frame()->frameScheduler()) 520 if (frame()->frameScheduler())
519 frame()->frameScheduler()->didStopLoading(identifier); 521 frame()->frameScheduler()->didStopLoading(identifier);
520 } 522 }
521 523
(...skipping 13 matching lines...) Expand all
535 InspectorInstrumentation::markResourceAsCached(frame(), identifier); 537 InspectorInstrumentation::markResourceAsCached(frame(), identifier);
536 if (!resource->response().isNull()) { 538 if (!resource->response().isNull()) {
537 dispatchDidReceiveResponseInternal(identifier, resource->response(), 539 dispatchDidReceiveResponseInternal(identifier, resource->response(),
538 frameType, requestContext, resource, 540 frameType, requestContext, resource,
539 LinkLoader::DoNotLoadResources); 541 LinkLoader::DoNotLoadResources);
540 } 542 }
541 543
542 if (resource->encodedSize() > 0) 544 if (resource->encodedSize() > 0)
543 dispatchDidReceiveData(identifier, 0, resource->encodedSize()); 545 dispatchDidReceiveData(identifier, 0, resource->encodedSize());
544 546
545 dispatchDidFinishLoading(identifier, 0, 0); 547 dispatchDidFinishLoading(identifier, 0, 0,
548 resource->response().decodedBodyLength());
546 } 549 }
547 550
548 bool FrameFetchContext::shouldLoadNewResource(Resource::Type type) const { 551 bool FrameFetchContext::shouldLoadNewResource(Resource::Type type) const {
549 if (!m_documentLoader) 552 if (!m_documentLoader)
550 return true; 553 return true;
551 554
552 FrameLoader& loader = m_documentLoader->frame()->loader(); 555 FrameLoader& loader = m_documentLoader->frame()->loader();
553 if (type == Resource::MainResource) 556 if (type == Resource::MainResource)
554 return m_documentLoader == loader.provisionalDocumentLoader(); 557 return m_documentLoader == loader.provisionalDocumentLoader();
555 return m_documentLoader == loader.documentLoader(); 558 return m_documentLoader == loader.documentLoader();
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 response); 1113 response);
1111 } 1114 }
1112 1115
1113 DEFINE_TRACE(FrameFetchContext) { 1116 DEFINE_TRACE(FrameFetchContext) {
1114 visitor->trace(m_document); 1117 visitor->trace(m_document);
1115 visitor->trace(m_documentLoader); 1118 visitor->trace(m_documentLoader);
1116 FetchContext::trace(visitor); 1119 FetchContext::trace(visitor);
1117 } 1120 }
1118 1121
1119 } // namespace blink 1122 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.h ('k') | third_party/WebKit/Source/core/loader/PingLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698