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

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

Issue 2799093004: Enable ServerTiming support
Patch Set: updates for Patch Set 7 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 123
122 FrameLoader& DocumentLoader::GetFrameLoader() const { 124 FrameLoader& DocumentLoader::GetFrameLoader() const {
123 DCHECK(frame_); 125 DCHECK(frame_);
124 return frame_->Loader(); 126 return frame_->Loader();
125 } 127 }
126 128
127 LocalFrameClient& DocumentLoader::GetLocalFrameClient() const { 129 LocalFrameClient& DocumentLoader::GetLocalFrameClient() const {
128 DCHECK(frame_); 130 DCHECK(frame_);
129 LocalFrameClient* client = frame_->Client(); 131 LocalFrameClient* client = frame_->Client();
130 // LocalFrame clears its |m_client| only after detaching all DocumentLoaders 132 // LocalFrame clears its |m_client| only after detaching all DocumentLoaders
131 // (i.e. calls detachFromFrame() which clears |m_frame|) owned by the 133 // (i.e. calls detachFromFrame() which clears |frame_|) owned by the
132 // LocalFrame's FrameLoader. So, if |m_frame| is non nullptr, |client| is 134 // LocalFrame's FrameLoader. So, if |frame_| is non nullptr, |client| is
133 // also non nullptr. 135 // also non nullptr.
134 DCHECK(client); 136 DCHECK(client);
135 return *client; 137 return *client;
136 } 138 }
137 139
138 DocumentLoader::~DocumentLoader() { 140 DocumentLoader::~DocumentLoader() {
139 DCHECK(!frame_); 141 DCHECK(!frame_);
140 DCHECK(!main_resource_); 142 DCHECK(!main_resource_);
141 DCHECK(!application_cache_host_); 143 DCHECK(!application_cache_host_);
142 DCHECK_EQ(state_, kSentDidFinishLoad); 144 DCHECK_EQ(state_, kSentDidFinishLoad);
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 929
928 OriginTrialContext::AddTokensFromHeader( 930 OriginTrialContext::AddTokensFromHeader(
929 document, response_.HttpHeaderField(HTTPNames::Origin_Trial)); 931 document, response_.HttpHeaderField(HTTPNames::Origin_Trial));
930 String referrer_policy_header = 932 String referrer_policy_header =
931 response_.HttpHeaderField(HTTPNames::Referrer_Policy); 933 response_.HttpHeaderField(HTTPNames::Referrer_Policy);
932 if (!referrer_policy_header.IsNull()) { 934 if (!referrer_policy_header.IsNull()) {
933 UseCounter::Count(*document, UseCounter::kReferrerPolicyHeader); 935 UseCounter::Count(*document, UseCounter::kReferrerPolicyHeader);
934 document->ParseAndSetReferrerPolicy(referrer_policy_header); 936 document->ParseAndSetReferrerPolicy(referrer_policy_header);
935 } 937 }
936 938
939 if (RuntimeEnabledFeatures::serverTimingEnabled() &&
940 frame_->GetDocument()->domWindow()) {
941 DOMWindowPerformance::performance(*(frame_->GetDocument()->domWindow()))
942 ->AddServerTiming(response_,
943 PerformanceBase::ShouldAddToBuffer::Always);
944 }
945
937 GetLocalFrameClient().DidCreateNewDocument(); 946 GetLocalFrameClient().DidCreateNewDocument();
938 } 947 }
939 948
940 void DocumentLoader::DidCommitNavigation() { 949 void DocumentLoader::DidCommitNavigation() {
941 if (GetFrameLoader().StateMachine()->CreatingInitialEmptyDocument()) 950 if (GetFrameLoader().StateMachine()->CreatingInitialEmptyDocument())
942 return; 951 return;
943 952
944 if (!frame_->Loader().StateMachine()->CommittedMultipleRealLoads() && 953 if (!frame_->Loader().StateMachine()->CommittedMultipleRealLoads() &&
945 load_type_ == kFrameLoadTypeStandard) { 954 load_type_ == kFrameLoadTypeStandard) {
946 frame_->Loader().StateMachine()->AdvanceTo( 955 frame_->Loader().StateMachine()->AdvanceTo(
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 if (!init.ShouldReuseDefaultView()) 1046 if (!init.ShouldReuseDefaultView())
1038 frame_->SetDOMWindow(LocalDOMWindow::Create(*frame_)); 1047 frame_->SetDOMWindow(LocalDOMWindow::Create(*frame_));
1039 1048
1040 Document* document = frame_->DomWindow()->InstallNewDocument(mime_type, init); 1049 Document* document = frame_->DomWindow()->InstallNewDocument(mime_type, init);
1041 1050
1042 if (ShouldClearWindowName(*frame_, previous_security_origin, *document)) { 1051 if (ShouldClearWindowName(*frame_, previous_security_origin, *document)) {
1043 // TODO(andypaicu): experimentalSetNullName will just record the fact 1052 // TODO(andypaicu): experimentalSetNullName will just record the fact
1044 // that the name would be nulled and if the name is accessed after we will 1053 // that the name would be nulled and if the name is accessed after we will
1045 // fire a UseCounter. If we decide to move forward with this change, we'd 1054 // fire a UseCounter. If we decide to move forward with this change, we'd
1046 // actually clean the name here. 1055 // actually clean the name here.
1047 // m_frame->tree().setName(nullAtom); 1056 // frame_->tree().setName(nullAtom);
1048 frame_->Tree().ExperimentalSetNulledName(); 1057 frame_->Tree().ExperimentalSetNulledName();
1049 } 1058 }
1050 1059
1051 frame_->GetPage()->GetChromeClient().InstallSupplements(*frame_); 1060 frame_->GetPage()->GetChromeClient().InstallSupplements(*frame_);
1052 if (!overriding_url.IsEmpty()) 1061 if (!overriding_url.IsEmpty())
1053 document->SetBaseURLOverride(overriding_url); 1062 document->SetBaseURLOverride(overriding_url);
1054 DidInstallNewDocument(document); 1063 DidInstallNewDocument(document);
1055 1064
1056 // This must be called before DocumentWriter is created, otherwise HTML parser 1065 // This must be called before DocumentWriter is created, otherwise HTML parser
1057 // will use stale values from HTMLParserOption. 1066 // will use stale values from HTMLParserOption.
(...skipping 28 matching lines...) Expand all
1086 InstallNewDocumentReason::kJavascriptURL, 1095 InstallNewDocumentReason::kJavascriptURL,
1087 kForceSynchronousParsing, KURL()); 1096 kForceSynchronousParsing, KURL());
1088 if (!source.IsNull()) 1097 if (!source.IsNull())
1089 writer_->AppendReplacingData(source); 1098 writer_->AppendReplacingData(source);
1090 EndWriting(); 1099 EndWriting();
1091 } 1100 }
1092 1101
1093 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 1102 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
1094 1103
1095 } // namespace blink 1104 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp ('k') | third_party/WebKit/Source/core/loader/FrameFetchContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698