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

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

Issue 2799093004: Enable ServerTiming support
Patch Set: server-timing 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "core/loader/ProgressTracker.h" 57 #include "core/loader/ProgressTracker.h"
58 #include "core/loader/SubresourceFilter.h" 58 #include "core/loader/SubresourceFilter.h"
59 #include "core/loader/appcache/ApplicationCacheHost.h" 59 #include "core/loader/appcache/ApplicationCacheHost.h"
60 #include "core/loader/private/FrameClientHintsPreferencesContext.h" 60 #include "core/loader/private/FrameClientHintsPreferencesContext.h"
61 #include "core/page/Page.h" 61 #include "core/page/Page.h"
62 #include "core/paint/FirstMeaningfulPaintDetector.h" 62 #include "core/paint/FirstMeaningfulPaintDetector.h"
63 #include "core/probe/CoreProbes.h" 63 #include "core/probe/CoreProbes.h"
64 #include "core/svg/graphics/SVGImageChromeClient.h" 64 #include "core/svg/graphics/SVGImageChromeClient.h"
65 #include "core/timing/DOMWindowPerformance.h" 65 #include "core/timing/DOMWindowPerformance.h"
66 #include "core/timing/Performance.h" 66 #include "core/timing/Performance.h"
67 #include "core/timing/PerformanceBase.h"
67 #include "platform/WebFrameScheduler.h" 68 #include "platform/WebFrameScheduler.h"
68 #include "platform/exported/WrappedResourceRequest.h" 69 #include "platform/exported/WrappedResourceRequest.h"
69 #include "platform/instrumentation/tracing/TracedValue.h" 70 #include "platform/instrumentation/tracing/TracedValue.h"
70 #include "platform/loader/fetch/ClientHintsPreferences.h" 71 #include "platform/loader/fetch/ClientHintsPreferences.h"
71 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" 72 #include "platform/loader/fetch/FetchInitiatorTypeNames.h"
72 #include "platform/loader/fetch/Resource.h" 73 #include "platform/loader/fetch/Resource.h"
73 #include "platform/loader/fetch/ResourceLoadPriority.h" 74 #include "platform/loader/fetch/ResourceLoadPriority.h"
74 #include "platform/loader/fetch/ResourceLoadingLog.h" 75 #include "platform/loader/fetch/ResourceLoadingLog.h"
75 #include "platform/loader/fetch/ResourceTimingInfo.h" 76 #include "platform/loader/fetch/ResourceTimingInfo.h"
76 #include "platform/loader/fetch/UniqueIdentifier.h" 77 #include "platform/loader/fetch/UniqueIdentifier.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 515 }
515 516
516 GetFrame()->Loader().Progress().IncrementProgress(identifier, response); 517 GetFrame()->Loader().Progress().IncrementProgress(identifier, response);
517 GetLocalFrameClient()->DispatchDidReceiveResponse(response); 518 GetLocalFrameClient()->DispatchDidReceiveResponse(response);
518 DocumentLoader* document_loader = MasterDocumentLoader(); 519 DocumentLoader* document_loader = MasterDocumentLoader();
519 probe::didReceiveResourceResponse(GetFrame(), identifier, document_loader, 520 probe::didReceiveResourceResponse(GetFrame(), identifier, document_loader,
520 response, resource); 521 response, resource);
521 // It is essential that inspector gets resource response BEFORE console. 522 // It is essential that inspector gets resource response BEFORE console.
522 GetFrame()->Console().ReportResourceResponseReceived(document_loader, 523 GetFrame()->Console().ReportResourceResponseReceived(document_loader,
523 identifier, response); 524 identifier, response);
525
526 // MainResource responses were already added, skip them here.
527 if (RuntimeEnabledFeatures::serverTimingEnabled() &&
528 resource->GetType() != Resource::kMainResource &&
529 GetFrame()->GetDocument() && GetFrame()->GetDocument()->domWindow()) {
530 LocalDOMWindow* localDOMWindow = GetFrame()->GetDocument()->domWindow();
531 DOMWindowPerformance::performance(*localDOMWindow)
532 ->AddServerTiming(response,
533 localDOMWindow->HasLoadEventFired()
534 ? PerformanceBase::ShouldAddToBuffer::Never
535 : PerformanceBase::ShouldAddToBuffer::Always);
536 }
524 } 537 }
525 538
526 void FrameFetchContext::DispatchDidReceiveData(unsigned long identifier, 539 void FrameFetchContext::DispatchDidReceiveData(unsigned long identifier,
527 const char* data, 540 const char* data,
528 int data_length) { 541 int data_length) {
529 GetFrame()->Loader().Progress().IncrementProgress(identifier, data_length); 542 GetFrame()->Loader().Progress().IncrementProgress(identifier, data_length);
530 probe::didReceiveData(GetFrame(), identifier, data, data_length); 543 probe::didReceiveData(GetFrame(), identifier, data, data_length);
531 } 544 }
532 545
533 void FrameFetchContext::DispatchDidReceiveEncodedData(unsigned long identifier, 546 void FrameFetchContext::DispatchDidReceiveEncodedData(unsigned long identifier,
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 return GetFrame()->FrameScheduler()->LoadingTaskRunner(); 1088 return GetFrame()->FrameScheduler()->LoadingTaskRunner();
1076 } 1089 }
1077 1090
1078 DEFINE_TRACE(FrameFetchContext) { 1091 DEFINE_TRACE(FrameFetchContext) {
1079 visitor->Trace(document_); 1092 visitor->Trace(document_);
1080 visitor->Trace(document_loader_); 1093 visitor->Trace(document_loader_);
1081 FetchContext::Trace(visitor); 1094 FetchContext::Trace(visitor);
1082 } 1095 }
1083 1096
1084 } // namespace blink 1097 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698