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

Side by Side Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp

Issue 2712833002: DevTools: Show decoded body length for network requests on timeline. (Closed)
Patch Set: Created 3 years, 10 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) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved.
3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 void ResourceLoader::didReceiveTransferSizeUpdate(int transferSizeDiff) { 417 void ResourceLoader::didReceiveTransferSizeUpdate(int transferSizeDiff) {
418 DCHECK_GT(transferSizeDiff, 0); 418 DCHECK_GT(transferSizeDiff, 0);
419 context().dispatchDidReceiveEncodedData(m_resource->identifier(), 419 context().dispatchDidReceiveEncodedData(m_resource->identifier(),
420 transferSizeDiff); 420 transferSizeDiff);
421 } 421 }
422 422
423 void ResourceLoader::didFinishLoadingFirstPartInMultipart() { 423 void ResourceLoader::didFinishLoadingFirstPartInMultipart() {
424 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", 424 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
425 InspectorResourceFinishEvent::data( 425 InspectorResourceFinishEvent::data(
426 m_resource->identifier(), 0, false, 426 m_resource->identifier(), 0, false,
427 m_resource->response().encodedDataLength())); 427 m_resource->response().encodedDataLength(),
428 m_resource->response().decodedBodyLength()));
428 network_instrumentation::endResourceLoad( 429 network_instrumentation::endResourceLoad(
429 m_resource->identifier(), 430 m_resource->identifier(),
430 network_instrumentation::RequestOutcome::Success); 431 network_instrumentation::RequestOutcome::Success);
431 432
432 m_fetcher->handleLoaderFinish(m_resource.get(), 0, 433 m_fetcher->handleLoaderFinish(m_resource.get(), 0,
433 ResourceFetcher::DidFinishFirstPartInMultipart); 434 ResourceFetcher::DidFinishFirstPartInMultipart);
434 } 435 }
435 436
436 void ResourceLoader::didFinishLoading(double finishTime, 437 void ResourceLoader::didFinishLoading(double finishTime,
437 int64_t encodedDataLength, 438 int64_t encodedDataLength,
438 int64_t encodedBodyLength) { 439 int64_t encodedBodyLength) {
439 TRACE_EVENT1(
440 "devtools.timeline", "ResourceFinish", "data",
441 InspectorResourceFinishEvent::data(m_resource->identifier(), finishTime,
442 false, encodedDataLength));
443 m_resource->setEncodedDataLength(encodedDataLength); 440 m_resource->setEncodedDataLength(encodedDataLength);
444 m_resource->addToEncodedBodyLength(encodedBodyLength); 441 m_resource->addToEncodedBodyLength(encodedBodyLength);
442
443 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
444 InspectorResourceFinishEvent::data(
445 m_resource->identifier(), finishTime, false,
446 m_resource->response().encodedDataLength(),
447 m_resource->response().decodedBodyLength()));
448
445 m_loader.reset(); 449 m_loader.reset();
446 450
447 network_instrumentation::endResourceLoad( 451 network_instrumentation::endResourceLoad(
448 m_resource->identifier(), 452 m_resource->identifier(),
449 network_instrumentation::RequestOutcome::Success); 453 network_instrumentation::RequestOutcome::Success);
450 454
451 m_fetcher->handleLoaderFinish(m_resource.get(), finishTime, 455 m_fetcher->handleLoaderFinish(m_resource.get(), finishTime,
452 ResourceFetcher::DidFinishLoading); 456 ResourceFetcher::DidFinishLoading);
453 } 457 }
454 458
(...skipping 10 matching lines...) Expand all
465 context().shouldLoadNewResource(m_resource->getType())) { 469 context().shouldLoadNewResource(m_resource->getType())) {
466 m_resource->willReloadAfterDiskCacheMiss(); 470 m_resource->willReloadAfterDiskCacheMiss();
467 m_isCacheAwareLoadingActivated = false; 471 m_isCacheAwareLoadingActivated = false;
468 restart(m_resource->resourceRequest()); 472 restart(m_resource->resourceRequest());
469 return; 473 return;
470 } 474 }
471 475
472 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", 476 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
473 InspectorResourceFinishEvent::data( 477 InspectorResourceFinishEvent::data(
474 m_resource->identifier(), 0, true, 478 m_resource->identifier(), 0, true,
475 m_resource->response().encodedDataLength())); 479 m_resource->response().encodedDataLength(),
480 m_resource->response().decodedBodyLength()));
476 m_loader.reset(); 481 m_loader.reset();
477 482
478 network_instrumentation::endResourceLoad( 483 network_instrumentation::endResourceLoad(
479 m_resource->identifier(), network_instrumentation::RequestOutcome::Fail); 484 m_resource->identifier(), network_instrumentation::RequestOutcome::Fail);
480 485
481 m_fetcher->handleLoaderError(m_resource.get(), error); 486 m_fetcher->handleLoaderError(m_resource.get(), error);
482 } 487 }
483 488
484 void ResourceLoader::requestSynchronously(const ResourceRequest& request) { 489 void ResourceLoader::requestSynchronously(const ResourceRequest& request) {
485 // downloadToFile is not supported for synchronous requests. 490 // downloadToFile is not supported for synchronous requests.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 return; 548 return;
544 549
545 // Don't activate if cache policy is explicitly set. 550 // Don't activate if cache policy is explicitly set.
546 if (request.getCachePolicy() != WebCachePolicy::UseProtocolCachePolicy) 551 if (request.getCachePolicy() != WebCachePolicy::UseProtocolCachePolicy)
547 return; 552 return;
548 553
549 m_isCacheAwareLoadingActivated = true; 554 m_isCacheAwareLoadingActivated = true;
550 } 555 }
551 556
552 } // namespace blink 557 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698