OLD | NEW |
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 Loading... |
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 Loading... |
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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 | 954 |
953 OriginTrialContext::AddTokensFromHeader( | 955 OriginTrialContext::AddTokensFromHeader( |
954 document, response_.HttpHeaderField(HTTPNames::Origin_Trial)); | 956 document, response_.HttpHeaderField(HTTPNames::Origin_Trial)); |
955 String referrer_policy_header = | 957 String referrer_policy_header = |
956 response_.HttpHeaderField(HTTPNames::Referrer_Policy); | 958 response_.HttpHeaderField(HTTPNames::Referrer_Policy); |
957 if (!referrer_policy_header.IsNull()) { | 959 if (!referrer_policy_header.IsNull()) { |
958 UseCounter::Count(*document, UseCounter::kReferrerPolicyHeader); | 960 UseCounter::Count(*document, UseCounter::kReferrerPolicyHeader); |
959 document->ParseAndSetReferrerPolicy(referrer_policy_header); | 961 document->ParseAndSetReferrerPolicy(referrer_policy_header); |
960 } | 962 } |
961 | 963 |
| 964 if (RuntimeEnabledFeatures::serverTimingEnabled() && |
| 965 frame_->GetDocument()->domWindow()) { |
| 966 DOMWindowPerformance::performance(*(frame_->GetDocument()->domWindow())) |
| 967 ->AddServerTiming(response_, |
| 968 PerformanceBase::ShouldAddToBuffer::Always); |
| 969 } |
| 970 |
962 GetLocalFrameClient().DidCreateNewDocument(); | 971 GetLocalFrameClient().DidCreateNewDocument(); |
963 } | 972 } |
964 | 973 |
965 void DocumentLoader::DidCommitNavigation() { | 974 void DocumentLoader::DidCommitNavigation() { |
966 if (GetFrameLoader().StateMachine()->CreatingInitialEmptyDocument()) | 975 if (GetFrameLoader().StateMachine()->CreatingInitialEmptyDocument()) |
967 return; | 976 return; |
968 | 977 |
969 if (!frame_->Loader().StateMachine()->CommittedMultipleRealLoads() && | 978 if (!frame_->Loader().StateMachine()->CommittedMultipleRealLoads() && |
970 load_type_ == kFrameLoadTypeStandard) { | 979 load_type_ == kFrameLoadTypeStandard) { |
971 frame_->Loader().StateMachine()->AdvanceTo( | 980 frame_->Loader().StateMachine()->AdvanceTo( |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 if (!init.ShouldReuseDefaultView()) | 1074 if (!init.ShouldReuseDefaultView()) |
1066 frame_->SetDOMWindow(LocalDOMWindow::Create(*frame_)); | 1075 frame_->SetDOMWindow(LocalDOMWindow::Create(*frame_)); |
1067 | 1076 |
1068 Document* document = frame_->DomWindow()->InstallNewDocument(mime_type, init); | 1077 Document* document = frame_->DomWindow()->InstallNewDocument(mime_type, init); |
1069 | 1078 |
1070 if (ShouldClearWindowName(*frame_, previous_security_origin, *document)) { | 1079 if (ShouldClearWindowName(*frame_, previous_security_origin, *document)) { |
1071 // TODO(andypaicu): experimentalSetNullName will just record the fact | 1080 // TODO(andypaicu): experimentalSetNullName will just record the fact |
1072 // that the name would be nulled and if the name is accessed after we will | 1081 // that the name would be nulled and if the name is accessed after we will |
1073 // fire a UseCounter. If we decide to move forward with this change, we'd | 1082 // fire a UseCounter. If we decide to move forward with this change, we'd |
1074 // actually clean the name here. | 1083 // actually clean the name here. |
1075 // m_frame->tree().setName(nullAtom); | 1084 // frame_->tree().setName(nullAtom); |
1076 frame_->Tree().ExperimentalSetNulledName(); | 1085 frame_->Tree().ExperimentalSetNulledName(); |
1077 } | 1086 } |
1078 | 1087 |
1079 frame_->GetPage()->GetChromeClient().InstallSupplements(*frame_); | 1088 frame_->GetPage()->GetChromeClient().InstallSupplements(*frame_); |
1080 if (!overriding_url.IsEmpty()) | 1089 if (!overriding_url.IsEmpty()) |
1081 document->SetBaseURLOverride(overriding_url); | 1090 document->SetBaseURLOverride(overriding_url); |
1082 DidInstallNewDocument(document); | 1091 DidInstallNewDocument(document); |
1083 | 1092 |
1084 // This must be called before DocumentWriter is created, otherwise HTML parser | 1093 // This must be called before DocumentWriter is created, otherwise HTML parser |
1085 // will use stale values from HTMLParserOption. | 1094 // will use stale values from HTMLParserOption. |
(...skipping 28 matching lines...) Expand all Loading... |
1114 InstallNewDocumentReason::kJavascriptURL, | 1123 InstallNewDocumentReason::kJavascriptURL, |
1115 kForceSynchronousParsing, KURL()); | 1124 kForceSynchronousParsing, KURL()); |
1116 if (!source.IsNull()) | 1125 if (!source.IsNull()) |
1117 writer_->AppendReplacingData(source); | 1126 writer_->AppendReplacingData(source); |
1118 EndWriting(); | 1127 EndWriting(); |
1119 } | 1128 } |
1120 | 1129 |
1121 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 1130 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
1122 | 1131 |
1123 } // namespace blink | 1132 } // namespace blink |
OLD | NEW |