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

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

Issue 2799093004: Enable ServerTiming support
Patch Set: Updates for Patch Set 4 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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "core/loader/SubresourceFilter.h" 54 #include "core/loader/SubresourceFilter.h"
55 #include "core/loader/appcache/ApplicationCacheHost.h" 55 #include "core/loader/appcache/ApplicationCacheHost.h"
56 #include "core/loader/resource/CSSStyleSheetResource.h" 56 #include "core/loader/resource/CSSStyleSheetResource.h"
57 #include "core/loader/resource/FontResource.h" 57 #include "core/loader/resource/FontResource.h"
58 #include "core/loader/resource/ImageResource.h" 58 #include "core/loader/resource/ImageResource.h"
59 #include "core/loader/resource/ScriptResource.h" 59 #include "core/loader/resource/ScriptResource.h"
60 #include "core/origin_trials/OriginTrialContext.h" 60 #include "core/origin_trials/OriginTrialContext.h"
61 #include "core/page/FrameTree.h" 61 #include "core/page/FrameTree.h"
62 #include "core/page/Page.h" 62 #include "core/page/Page.h"
63 #include "core/probe/CoreProbes.h" 63 #include "core/probe/CoreProbes.h"
64 #include "core/timing/DOMWindowPerformance.h"
65 #include "core/timing/Performance.h"
64 #include "platform/HTTPNames.h" 66 #include "platform/HTTPNames.h"
65 #include "platform/UserGestureIndicator.h" 67 #include "platform/UserGestureIndicator.h"
66 #include "platform/feature_policy/FeaturePolicy.h" 68 #include "platform/feature_policy/FeaturePolicy.h"
67 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" 69 #include "platform/loader/fetch/FetchInitiatorTypeNames.h"
68 #include "platform/loader/fetch/FetchParameters.h" 70 #include "platform/loader/fetch/FetchParameters.h"
69 #include "platform/loader/fetch/FetchUtils.h" 71 #include "platform/loader/fetch/FetchUtils.h"
70 #include "platform/loader/fetch/MemoryCache.h" 72 #include "platform/loader/fetch/MemoryCache.h"
71 #include "platform/loader/fetch/ResourceFetcher.h" 73 #include "platform/loader/fetch/ResourceFetcher.h"
72 #include "platform/loader/fetch/ResourceTimingInfo.h" 74 #include "platform/loader/fetch/ResourceTimingInfo.h"
73 #include "platform/mhtml/ArchiveResource.h" 75 #include "platform/mhtml/ArchiveResource.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 135
134 FrameLoader& DocumentLoader::GetFrameLoader() const { 136 FrameLoader& DocumentLoader::GetFrameLoader() const {
135 DCHECK(frame_); 137 DCHECK(frame_);
136 return frame_->Loader(); 138 return frame_->Loader();
137 } 139 }
138 140
139 LocalFrameClient& DocumentLoader::GetLocalFrameClient() const { 141 LocalFrameClient& DocumentLoader::GetLocalFrameClient() const {
140 DCHECK(frame_); 142 DCHECK(frame_);
141 LocalFrameClient* client = frame_->Client(); 143 LocalFrameClient* client = frame_->Client();
142 // LocalFrame clears its |m_client| only after detaching all DocumentLoaders 144 // LocalFrame clears its |m_client| only after detaching all DocumentLoaders
143 // (i.e. calls detachFromFrame() which clears |m_frame|) owned by the 145 // (i.e. calls detachFromFrame() which clears |frame_|) owned by the
144 // LocalFrame's FrameLoader. So, if |m_frame| is non nullptr, |client| is 146 // LocalFrame's FrameLoader. So, if |frame_| is non nullptr, |client| is
145 // also non nullptr. 147 // also non nullptr.
146 DCHECK(client); 148 DCHECK(client);
147 return *client; 149 return *client;
148 } 150 }
149 151
150 DocumentLoader::~DocumentLoader() { 152 DocumentLoader::~DocumentLoader() {
151 DCHECK(!frame_); 153 DCHECK(!frame_);
152 DCHECK(!main_resource_); 154 DCHECK(!main_resource_);
153 DCHECK(!application_cache_host_); 155 DCHECK(!application_cache_host_);
154 DCHECK_EQ(state_, kSentDidFinishLoad); 156 DCHECK_EQ(state_, kSentDidFinishLoad);
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 941
940 OriginTrialContext::AddTokensFromHeader( 942 OriginTrialContext::AddTokensFromHeader(
941 document, response_.HttpHeaderField(HTTPNames::Origin_Trial)); 943 document, response_.HttpHeaderField(HTTPNames::Origin_Trial));
942 String referrer_policy_header = 944 String referrer_policy_header =
943 response_.HttpHeaderField(HTTPNames::Referrer_Policy); 945 response_.HttpHeaderField(HTTPNames::Referrer_Policy);
944 if (!referrer_policy_header.IsNull()) { 946 if (!referrer_policy_header.IsNull()) {
945 UseCounter::Count(*document, UseCounter::kReferrerPolicyHeader); 947 UseCounter::Count(*document, UseCounter::kReferrerPolicyHeader);
946 document->ParseAndSetReferrerPolicy(referrer_policy_header); 948 document->ParseAndSetReferrerPolicy(referrer_policy_header);
947 } 949 }
948 950
951 if (RuntimeEnabledFeatures::serverTimingEnabled() &&
952 frame_->GetDocument()->domWindow()) {
953 DOMWindowPerformance::performance(*(frame_->GetDocument()->domWindow()))
954 ->AddServerTiming(response_,
955 PerformanceBase::ShouldAddToBuffer::Always);
956 }
957
949 GetLocalFrameClient().DidCreateNewDocument(); 958 GetLocalFrameClient().DidCreateNewDocument();
950 } 959 }
951 960
952 void DocumentLoader::DidCommitNavigation() { 961 void DocumentLoader::DidCommitNavigation() {
953 if (GetFrameLoader().StateMachine()->CreatingInitialEmptyDocument()) 962 if (GetFrameLoader().StateMachine()->CreatingInitialEmptyDocument())
954 return; 963 return;
955 964
956 if (!frame_->Loader().StateMachine()->CommittedMultipleRealLoads() && 965 if (!frame_->Loader().StateMachine()->CommittedMultipleRealLoads() &&
957 load_type_ == kFrameLoadTypeStandard) { 966 load_type_ == kFrameLoadTypeStandard) {
958 frame_->Loader().StateMachine()->AdvanceTo( 967 frame_->Loader().StateMachine()->AdvanceTo(
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 if (!init.ShouldReuseDefaultView()) 1061 if (!init.ShouldReuseDefaultView())
1053 frame_->SetDOMWindow(LocalDOMWindow::Create(*frame_)); 1062 frame_->SetDOMWindow(LocalDOMWindow::Create(*frame_));
1054 1063
1055 Document* document = frame_->DomWindow()->InstallNewDocument(mime_type, init); 1064 Document* document = frame_->DomWindow()->InstallNewDocument(mime_type, init);
1056 1065
1057 if (ShouldClearWindowName(*frame_, previous_security_origin, *document)) { 1066 if (ShouldClearWindowName(*frame_, previous_security_origin, *document)) {
1058 // TODO(andypaicu): experimentalSetNullName will just record the fact 1067 // TODO(andypaicu): experimentalSetNullName will just record the fact
1059 // that the name would be nulled and if the name is accessed after we will 1068 // that the name would be nulled and if the name is accessed after we will
1060 // fire a UseCounter. If we decide to move forward with this change, we'd 1069 // fire a UseCounter. If we decide to move forward with this change, we'd
1061 // actually clean the name here. 1070 // actually clean the name here.
1062 // m_frame->tree().setName(nullAtom); 1071 // frame_->tree().setName(nullAtom);
1063 frame_->Tree().ExperimentalSetNulledName(); 1072 frame_->Tree().ExperimentalSetNulledName();
1064 } 1073 }
1065 1074
1066 frame_->GetPage()->GetChromeClient().InstallSupplements(*frame_); 1075 frame_->GetPage()->GetChromeClient().InstallSupplements(*frame_);
1067 if (!overriding_url.IsEmpty()) 1076 if (!overriding_url.IsEmpty())
1068 document->SetBaseURLOverride(overriding_url); 1077 document->SetBaseURLOverride(overriding_url);
1069 DidInstallNewDocument(document); 1078 DidInstallNewDocument(document);
1070 1079
1071 // This must be called before DocumentWriter is created, otherwise HTML parser 1080 // This must be called before DocumentWriter is created, otherwise HTML parser
1072 // will use stale values from HTMLParserOption. 1081 // will use stale values from HTMLParserOption.
(...skipping 28 matching lines...) Expand all
1101 InstallNewDocumentReason::kJavascriptURL, 1110 InstallNewDocumentReason::kJavascriptURL,
1102 kForceSynchronousParsing, KURL()); 1111 kForceSynchronousParsing, KURL());
1103 if (!source.IsNull()) 1112 if (!source.IsNull())
1104 writer_->AppendReplacingData(source); 1113 writer_->AppendReplacingData(source);
1105 EndWriting(); 1114 EndWriting();
1106 } 1115 }
1107 1116
1108 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 1117 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
1109 1118
1110 } // namespace blink 1119 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698