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

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

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

Powered by Google App Engine
This is Rietveld 408576698