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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 | 943 |
942 OriginTrialContext::AddTokensFromHeader( | 944 OriginTrialContext::AddTokensFromHeader( |
943 document, response_.HttpHeaderField(HTTPNames::Origin_Trial)); | 945 document, response_.HttpHeaderField(HTTPNames::Origin_Trial)); |
944 String referrer_policy_header = | 946 String referrer_policy_header = |
945 response_.HttpHeaderField(HTTPNames::Referrer_Policy); | 947 response_.HttpHeaderField(HTTPNames::Referrer_Policy); |
946 if (!referrer_policy_header.IsNull()) { | 948 if (!referrer_policy_header.IsNull()) { |
947 UseCounter::Count(*document, UseCounter::kReferrerPolicyHeader); | 949 UseCounter::Count(*document, UseCounter::kReferrerPolicyHeader); |
948 document->ParseAndSetReferrerPolicy(referrer_policy_header); | 950 document->ParseAndSetReferrerPolicy(referrer_policy_header); |
949 } | 951 } |
950 | 952 |
| 953 if (RuntimeEnabledFeatures::serverTimingEnabled() && |
| 954 frame_->GetDocument()->domWindow()) { |
| 955 DOMWindowPerformance::performance(*(frame_->GetDocument()->domWindow())) |
| 956 ->AddServerTiming(response_, |
| 957 PerformanceBase::ShouldAddToBuffer::Always); |
| 958 } |
| 959 |
951 GetLocalFrameClient().DidCreateNewDocument(); | 960 GetLocalFrameClient().DidCreateNewDocument(); |
952 } | 961 } |
953 | 962 |
954 void DocumentLoader::DidCommitNavigation() { | 963 void DocumentLoader::DidCommitNavigation() { |
955 if (GetFrameLoader().StateMachine()->CreatingInitialEmptyDocument()) | 964 if (GetFrameLoader().StateMachine()->CreatingInitialEmptyDocument()) |
956 return; | 965 return; |
957 | 966 |
958 if (!frame_->Loader().StateMachine()->CommittedMultipleRealLoads() && | 967 if (!frame_->Loader().StateMachine()->CommittedMultipleRealLoads() && |
959 load_type_ == kFrameLoadTypeStandard) { | 968 load_type_ == kFrameLoadTypeStandard) { |
960 frame_->Loader().StateMachine()->AdvanceTo( | 969 frame_->Loader().StateMachine()->AdvanceTo( |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 if (!init.ShouldReuseDefaultView()) | 1060 if (!init.ShouldReuseDefaultView()) |
1052 frame_->SetDOMWindow(LocalDOMWindow::Create(*frame_)); | 1061 frame_->SetDOMWindow(LocalDOMWindow::Create(*frame_)); |
1053 | 1062 |
1054 Document* document = frame_->DomWindow()->InstallNewDocument(mime_type, init); | 1063 Document* document = frame_->DomWindow()->InstallNewDocument(mime_type, init); |
1055 | 1064 |
1056 if (ShouldClearWindowName(*frame_, previous_security_origin, *document)) { | 1065 if (ShouldClearWindowName(*frame_, previous_security_origin, *document)) { |
1057 // TODO(andypaicu): experimentalSetNullName will just record the fact | 1066 // TODO(andypaicu): experimentalSetNullName will just record the fact |
1058 // that the name would be nulled and if the name is accessed after we will | 1067 // that the name would be nulled and if the name is accessed after we will |
1059 // fire a UseCounter. If we decide to move forward with this change, we'd | 1068 // fire a UseCounter. If we decide to move forward with this change, we'd |
1060 // actually clean the name here. | 1069 // actually clean the name here. |
1061 // m_frame->tree().setName(nullAtom); | 1070 // frame_->tree().setName(nullAtom); |
1062 frame_->Tree().ExperimentalSetNulledName(); | 1071 frame_->Tree().ExperimentalSetNulledName(); |
1063 } | 1072 } |
1064 | 1073 |
1065 frame_->GetPage()->GetChromeClient().InstallSupplements(*frame_); | 1074 frame_->GetPage()->GetChromeClient().InstallSupplements(*frame_); |
1066 if (!overriding_url.IsEmpty()) | 1075 if (!overriding_url.IsEmpty()) |
1067 document->SetBaseURLOverride(overriding_url); | 1076 document->SetBaseURLOverride(overriding_url); |
1068 DidInstallNewDocument(document); | 1077 DidInstallNewDocument(document); |
1069 | 1078 |
1070 // This must be called before DocumentWriter is created, otherwise HTML parser | 1079 // This must be called before DocumentWriter is created, otherwise HTML parser |
1071 // will use stale values from HTMLParserOption. | 1080 // will use stale values from HTMLParserOption. |
(...skipping 28 matching lines...) Expand all Loading... |
1100 InstallNewDocumentReason::kJavascriptURL, | 1109 InstallNewDocumentReason::kJavascriptURL, |
1101 kForceSynchronousParsing, KURL()); | 1110 kForceSynchronousParsing, KURL()); |
1102 if (!source.IsNull()) | 1111 if (!source.IsNull()) |
1103 writer_->AppendReplacingData(source); | 1112 writer_->AppendReplacingData(source); |
1104 EndWriting(); | 1113 EndWriting(); |
1105 } | 1114 } |
1106 | 1115 |
1107 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 1116 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
1108 | 1117 |
1109 } // namespace blink | 1118 } // namespace blink |
OLD | NEW |