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

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

Issue 2799093004: Enable ServerTiming support
Patch Set: Created 3 years, 8 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "core/loader/ProgressTracker.h" 58 #include "core/loader/ProgressTracker.h"
59 #include "core/loader/SubresourceFilter.h" 59 #include "core/loader/SubresourceFilter.h"
60 #include "core/loader/appcache/ApplicationCacheHost.h" 60 #include "core/loader/appcache/ApplicationCacheHost.h"
61 #include "core/loader/private/FrameClientHintsPreferencesContext.h" 61 #include "core/loader/private/FrameClientHintsPreferencesContext.h"
62 #include "core/page/Page.h" 62 #include "core/page/Page.h"
63 #include "core/paint/FirstMeaningfulPaintDetector.h" 63 #include "core/paint/FirstMeaningfulPaintDetector.h"
64 #include "core/probe/CoreProbes.h" 64 #include "core/probe/CoreProbes.h"
65 #include "core/svg/graphics/SVGImageChromeClient.h" 65 #include "core/svg/graphics/SVGImageChromeClient.h"
66 #include "core/timing/DOMWindowPerformance.h" 66 #include "core/timing/DOMWindowPerformance.h"
67 #include "core/timing/Performance.h" 67 #include "core/timing/Performance.h"
68 #include "core/timing/PerformanceBase.h"
68 #include "platform/WebFrameScheduler.h" 69 #include "platform/WebFrameScheduler.h"
69 #include "platform/exported/WrappedResourceRequest.h" 70 #include "platform/exported/WrappedResourceRequest.h"
70 #include "platform/instrumentation/tracing/TracedValue.h" 71 #include "platform/instrumentation/tracing/TracedValue.h"
71 #include "platform/loader/fetch/ClientHintsPreferences.h" 72 #include "platform/loader/fetch/ClientHintsPreferences.h"
72 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" 73 #include "platform/loader/fetch/FetchInitiatorTypeNames.h"
73 #include "platform/loader/fetch/Resource.h" 74 #include "platform/loader/fetch/Resource.h"
74 #include "platform/loader/fetch/ResourceLoadPriority.h" 75 #include "platform/loader/fetch/ResourceLoadPriority.h"
75 #include "platform/loader/fetch/ResourceLoadingLog.h" 76 #include "platform/loader/fetch/ResourceLoadingLog.h"
76 #include "platform/loader/fetch/ResourceTimingInfo.h" 77 #include "platform/loader/fetch/ResourceTimingInfo.h"
77 #include "platform/loader/fetch/UniqueIdentifier.h" 78 #include "platform/loader/fetch/UniqueIdentifier.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 } 530 }
530 531
531 frame()->loader().progress().incrementProgress(identifier, response); 532 frame()->loader().progress().incrementProgress(identifier, response);
532 localFrameClient()->dispatchDidReceiveResponse(response); 533 localFrameClient()->dispatchDidReceiveResponse(response);
533 DocumentLoader* documentLoader = masterDocumentLoader(); 534 DocumentLoader* documentLoader = masterDocumentLoader();
534 probe::didReceiveResourceResponse(frame(), identifier, documentLoader, 535 probe::didReceiveResourceResponse(frame(), identifier, documentLoader,
535 response, resource); 536 response, resource);
536 // It is essential that inspector gets resource response BEFORE console. 537 // It is essential that inspector gets resource response BEFORE console.
537 frame()->console().reportResourceResponseReceived(documentLoader, identifier, 538 frame()->console().reportResourceResponseReceived(documentLoader, identifier,
538 response); 539 response);
540
541 if (RuntimeEnabledFeatures::serverTimingEnabled() &&
542 resource->getType() != Resource::MainResource && // MainResource
543 // responses were
544 // already added, skip
545 // them here
Yoav Weiss 2017/04/06 20:19:55 Nit: Maybe move the comment above the condition? F
546 frame()->document() && frame()->document()->domWindow()) {
547 LocalDOMWindow* localDOMWindow = frame()->document()->domWindow();
548 DOMWindowPerformance::performance(*localDOMWindow)
549 ->addServerTiming(response,
550 localDOMWindow->hasLoadEventFired()
551 ? PerformanceBase::ShouldAddToBuffer::Never
552 : PerformanceBase::ShouldAddToBuffer::Always);
553 }
539 } 554 }
540 555
541 void FrameFetchContext::dispatchDidReceiveData(unsigned long identifier, 556 void FrameFetchContext::dispatchDidReceiveData(unsigned long identifier,
542 const char* data, 557 const char* data,
543 int dataLength) { 558 int dataLength) {
544 frame()->loader().progress().incrementProgress(identifier, dataLength); 559 frame()->loader().progress().incrementProgress(identifier, dataLength);
545 probe::didReceiveData(frame(), identifier, data, dataLength); 560 probe::didReceiveData(frame(), identifier, data, dataLength);
546 } 561 }
547 562
548 void FrameFetchContext::dispatchDidReceiveEncodedData(unsigned long identifier, 563 void FrameFetchContext::dispatchDidReceiveEncodedData(unsigned long identifier,
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 return frame()->frameScheduler()->loadingTaskRunner(); 1079 return frame()->frameScheduler()->loadingTaskRunner();
1065 } 1080 }
1066 1081
1067 DEFINE_TRACE(FrameFetchContext) { 1082 DEFINE_TRACE(FrameFetchContext) {
1068 visitor->trace(m_document); 1083 visitor->trace(m_document);
1069 visitor->trace(m_documentLoader); 1084 visitor->trace(m_documentLoader);
1070 FetchContext::trace(visitor); 1085 FetchContext::trace(visitor);
1071 } 1086 }
1072 1087
1073 } // namespace blink 1088 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698