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

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

Issue 2737623006: Revert of [instrumentation] Introduce InspectorTraceEvents agent (Closed)
Patch Set: 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 void FrameFetchContext::prepareRequest(ResourceRequest& request) { 423 void FrameFetchContext::prepareRequest(ResourceRequest& request) {
424 frame()->loader().applyUserAgent(request); 424 frame()->loader().applyUserAgent(request);
425 localFrameClient()->dispatchWillSendRequest(request); 425 localFrameClient()->dispatchWillSendRequest(request);
426 } 426 }
427 427
428 void FrameFetchContext::dispatchWillSendRequest( 428 void FrameFetchContext::dispatchWillSendRequest(
429 unsigned long identifier, 429 unsigned long identifier,
430 ResourceRequest& request, 430 ResourceRequest& request,
431 const ResourceResponse& redirectResponse, 431 const ResourceResponse& redirectResponse,
432 const FetchInitiatorInfo& initiatorInfo) { 432 const FetchInitiatorInfo& initiatorInfo) {
433 TRACE_EVENT1("devtools.timeline", "ResourceSendRequest", "data",
434 InspectorSendRequestEvent::data(identifier, frame(), request));
433 // For initial requests, prepareRequest() is called in 435 // For initial requests, prepareRequest() is called in
434 // willStartLoadingResource(), before revalidation policy is determined. That 436 // willStartLoadingResource(), before revalidation policy is determined. That
435 // call doesn't exist for redirects, so call preareRequest() here. 437 // call doesn't exist for redirects, so call preareRequest() here.
436 if (!redirectResponse.isNull()) { 438 if (!redirectResponse.isNull()) {
437 prepareRequest(request); 439 prepareRequest(request);
438 } else { 440 } else {
439 frame()->loader().progress().willStartLoading(identifier, 441 frame()->loader().progress().willStartLoading(identifier,
440 request.priority()); 442 request.priority());
441 } 443 }
442 probe::willSendRequest(frame(), identifier, masterDocumentLoader(), request, 444 probe::willSendRequest(frame(), identifier, masterDocumentLoader(), request,
(...skipping 15 matching lines...) Expand all
458 460
459 void FrameFetchContext::dispatchDidReceiveData(unsigned long identifier, 461 void FrameFetchContext::dispatchDidReceiveData(unsigned long identifier,
460 const char* data, 462 const char* data,
461 int dataLength) { 463 int dataLength) {
462 frame()->loader().progress().incrementProgress(identifier, dataLength); 464 frame()->loader().progress().incrementProgress(identifier, dataLength);
463 probe::didReceiveData(frame(), identifier, data, dataLength); 465 probe::didReceiveData(frame(), identifier, data, dataLength);
464 } 466 }
465 467
466 void FrameFetchContext::dispatchDidReceiveEncodedData(unsigned long identifier, 468 void FrameFetchContext::dispatchDidReceiveEncodedData(unsigned long identifier,
467 int encodedDataLength) { 469 int encodedDataLength) {
470 TRACE_EVENT1(
471 "devtools.timeline", "ResourceReceivedData", "data",
472 InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength));
468 probe::didReceiveEncodedDataLength(frame(), identifier, encodedDataLength); 473 probe::didReceiveEncodedDataLength(frame(), identifier, encodedDataLength);
469 } 474 }
470 475
471 void FrameFetchContext::dispatchDidDownloadData(unsigned long identifier, 476 void FrameFetchContext::dispatchDidDownloadData(unsigned long identifier,
472 int dataLength, 477 int dataLength,
473 int encodedDataLength) { 478 int encodedDataLength) {
479 TRACE_EVENT1(
480 "devtools.timeline", "ResourceReceivedData", "data",
481 InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength));
474 frame()->loader().progress().incrementProgress(identifier, dataLength); 482 frame()->loader().progress().incrementProgress(identifier, dataLength);
475 probe::didReceiveData(frame(), identifier, 0, dataLength); 483 probe::didReceiveData(frame(), identifier, 0, dataLength);
476 probe::didReceiveEncodedDataLength(frame(), identifier, encodedDataLength); 484 probe::didReceiveEncodedDataLength(frame(), identifier, encodedDataLength);
477 } 485 }
478 486
479 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, 487 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier,
480 double finishTime, 488 double finishTime,
481 int64_t encodedDataLength, 489 int64_t encodedDataLength,
482 int64_t decodedBodyLength) { 490 int64_t decodedBodyLength) {
491 TRACE_EVENT1(
492 "devtools.timeline", "ResourceFinish", "data",
493 InspectorResourceFinishEvent::data(identifier, finishTime, false,
494 encodedDataLength, decodedBodyLength));
483 frame()->loader().progress().completeProgress(identifier); 495 frame()->loader().progress().completeProgress(identifier);
484 probe::didFinishLoading(frame(), identifier, finishTime, encodedDataLength, 496 probe::didFinishLoading(frame(), identifier, finishTime, encodedDataLength);
485 decodedBodyLength);
486 if (frame()->frameScheduler()) 497 if (frame()->frameScheduler())
487 frame()->frameScheduler()->didStopLoading(identifier); 498 frame()->frameScheduler()->didStopLoading(identifier);
488 } 499 }
489 500
490 void FrameFetchContext::dispatchDidFail(unsigned long identifier, 501 void FrameFetchContext::dispatchDidFail(unsigned long identifier,
491 const ResourceError& error, 502 const ResourceError& error,
492 int64_t encodedDataLength, 503 int64_t encodedDataLength,
493 bool isInternalRequest) { 504 bool isInternalRequest) {
505 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
506 InspectorResourceFinishEvent::data(identifier, 0, true,
507 encodedDataLength, 0));
494 frame()->loader().progress().completeProgress(identifier); 508 frame()->loader().progress().completeProgress(identifier);
495 probe::didFailLoading(frame(), identifier, error); 509 probe::didFailLoading(frame(), identifier, error);
496 // Notification to FrameConsole should come AFTER InspectorInstrumentation 510 // Notification to FrameConsole should come AFTER InspectorInstrumentation
497 // call, DevTools front-end relies on this. 511 // call, DevTools front-end relies on this.
498 if (!isInternalRequest) 512 if (!isInternalRequest)
499 frame()->console().didFailLoading(identifier, error); 513 frame()->console().didFailLoading(identifier, error);
500 if (frame()->frameScheduler()) 514 if (frame()->frameScheduler())
501 frame()->frameScheduler()->didStopLoading(identifier); 515 frame()->frameScheduler()->didStopLoading(identifier);
502 } 516 }
503 517
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 return frame()->frameScheduler()->loadingTaskRunner(); 1039 return frame()->frameScheduler()->loadingTaskRunner();
1026 } 1040 }
1027 1041
1028 void FrameFetchContext::dispatchDidReceiveResponseInternal( 1042 void FrameFetchContext::dispatchDidReceiveResponseInternal(
1029 unsigned long identifier, 1043 unsigned long identifier,
1030 const ResourceResponse& response, 1044 const ResourceResponse& response,
1031 WebURLRequest::FrameType frameType, 1045 WebURLRequest::FrameType frameType,
1032 WebURLRequest::RequestContext requestContext, 1046 WebURLRequest::RequestContext requestContext,
1033 Resource* resource, 1047 Resource* resource,
1034 LinkLoader::CanLoadResources resourceLoadingPolicy) { 1048 LinkLoader::CanLoadResources resourceLoadingPolicy) {
1049 TRACE_EVENT1(
1050 "devtools.timeline", "ResourceReceiveResponse", "data",
1051 InspectorReceiveResponseEvent::data(identifier, frame(), response));
1035 MixedContentChecker::checkMixedPrivatePublic(frame(), 1052 MixedContentChecker::checkMixedPrivatePublic(frame(),
1036 response.remoteIPAddress()); 1053 response.remoteIPAddress());
1037 if (m_documentLoader && 1054 if (m_documentLoader &&
1038 m_documentLoader == 1055 m_documentLoader ==
1039 m_documentLoader->frame()->loader().provisionalDocumentLoader()) { 1056 m_documentLoader->frame()->loader().provisionalDocumentLoader()) {
1040 FrameClientHintsPreferencesContext hintsContext(frame()); 1057 FrameClientHintsPreferencesContext hintsContext(frame());
1041 m_documentLoader->clientHintsPreferences() 1058 m_documentLoader->clientHintsPreferences()
1042 .updateFromAcceptClientHintsHeader( 1059 .updateFromAcceptClientHintsHeader(
1043 response.httpHeaderField(HTTPNames::Accept_CH), &hintsContext); 1060 response.httpHeaderField(HTTPNames::Accept_CH), &hintsContext);
1044 // When response is received with a provisional docloader, the resource 1061 // When response is received with a provisional docloader, the resource
(...skipping 20 matching lines...) Expand all
1065 response); 1082 response);
1066 } 1083 }
1067 1084
1068 DEFINE_TRACE(FrameFetchContext) { 1085 DEFINE_TRACE(FrameFetchContext) {
1069 visitor->trace(m_document); 1086 visitor->trace(m_document);
1070 visitor->trace(m_documentLoader); 1087 visitor->trace(m_documentLoader);
1071 FetchContext::trace(visitor); 1088 FetchContext::trace(visitor);
1072 } 1089 }
1073 1090
1074 } // namespace blink 1091 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698