| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 namespace blink { | 52 namespace blink { |
| 53 | 53 |
| 54 class ApplicationCacheHost; | 54 class ApplicationCacheHost; |
| 55 class ResourceFetcher; | 55 class ResourceFetcher; |
| 56 class DocumentInit; | 56 class DocumentInit; |
| 57 class LocalFrame; | 57 class LocalFrame; |
| 58 class FrameLoader; | 58 class FrameLoader; |
| 59 class ResourceLoader; | 59 class ResourceLoader; |
| 60 | 60 |
| 61 class CORE_EXPORT DocumentLoader : public RefCountedWillBeGarbageCollectedFinali
zed<DocumentLoader>, private RawResourceClient { | 61 class CORE_EXPORT DocumentLoader : public GarbageCollectedFinalized<DocumentLoad
er>, private RawResourceClient { |
| 62 USING_FAST_MALLOC_WILL_BE_REMOVED(DocumentLoader); | |
| 63 public: | 62 public: |
| 64 static PassRefPtrWillBeRawPtr<DocumentLoader> create(LocalFrame* frame, cons
t ResourceRequest& request, const SubstituteData& data) | 63 static RawPtr<DocumentLoader> create(LocalFrame* frame, const ResourceReques
t& request, const SubstituteData& data) |
| 65 { | 64 { |
| 66 return adoptRefWillBeNoop(new DocumentLoader(frame, request, data)); | 65 return new DocumentLoader(frame, request, data); |
| 67 } | 66 } |
| 68 ~DocumentLoader() override; | 67 ~DocumentLoader() override; |
| 69 | 68 |
| 70 LocalFrame* frame() const { return m_frame; } | 69 LocalFrame* frame() const { return m_frame; } |
| 71 | 70 |
| 72 virtual void detachFromFrame(); | 71 virtual void detachFromFrame(); |
| 73 | 72 |
| 74 unsigned long mainResourceIdentifier() const; | 73 unsigned long mainResourceIdentifier() const; |
| 75 | 74 |
| 76 void replaceDocumentWhileExecutingJavaScriptURL(const DocumentInit&, const S
tring& source); | 75 void replaceDocumentWhileExecutingJavaScriptURL(const DocumentInit&, const S
tring& source); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 110 |
| 112 void acceptDataFromThreadedReceiver(const char* data, int dataLength, int en
codedDataLength); | 111 void acceptDataFromThreadedReceiver(const char* data, int dataLength, int en
codedDataLength); |
| 113 DocumentLoadTiming& timing() { return m_documentLoadTiming; } | 112 DocumentLoadTiming& timing() { return m_documentLoadTiming; } |
| 114 const DocumentLoadTiming& timing() const { return m_documentLoadTiming; } | 113 const DocumentLoadTiming& timing() const { return m_documentLoadTiming; } |
| 115 | 114 |
| 116 ApplicationCacheHost* applicationCacheHost() const { return m_applicationCac
heHost.get(); } | 115 ApplicationCacheHost* applicationCacheHost() const { return m_applicationCac
heHost.get(); } |
| 117 | 116 |
| 118 void clearRedirectChain(); | 117 void clearRedirectChain(); |
| 119 void appendRedirect(const KURL&); | 118 void appendRedirect(const KURL&); |
| 120 | 119 |
| 121 PassRefPtrWillBeRawPtr<ContentSecurityPolicy> releaseContentSecurityPolicy()
{ return m_contentSecurityPolicy.release(); } | 120 RawPtr<ContentSecurityPolicy> releaseContentSecurityPolicy() { return m_cont
entSecurityPolicy.release(); } |
| 122 | 121 |
| 123 ClientHintsPreferences& clientHintsPreferences() { return m_clientHintsPrefe
rences; } | 122 ClientHintsPreferences& clientHintsPreferences() { return m_clientHintsPrefe
rences; } |
| 124 | 123 |
| 125 struct InitialScrollState { | 124 struct InitialScrollState { |
| 126 DISALLOW_NEW(); | 125 DISALLOW_NEW(); |
| 127 InitialScrollState() | 126 InitialScrollState() |
| 128 : wasScrolledByUser(false) | 127 : wasScrolledByUser(false) |
| 129 , didRestoreFromHistory(false) | 128 , didRestoreFromHistory(false) |
| 130 { | 129 { |
| 131 } | 130 } |
| 132 | 131 |
| 133 bool wasScrolledByUser; | 132 bool wasScrolledByUser; |
| 134 bool didRestoreFromHistory; | 133 bool didRestoreFromHistory; |
| 135 }; | 134 }; |
| 136 InitialScrollState& initialScrollState() { return m_initialScrollState; } | 135 InitialScrollState& initialScrollState() { return m_initialScrollState; } |
| 137 | 136 |
| 138 void setWasBlockedAfterXFrameOptionsOrCSP() { m_wasBlockedAfterXFrameOptions
OrCSP = true; } | 137 void setWasBlockedAfterXFrameOptionsOrCSP() { m_wasBlockedAfterXFrameOptions
OrCSP = true; } |
| 139 bool wasBlockedAfterXFrameOptionsOrCSP() { return m_wasBlockedAfterXFrameOpt
ionsOrCSP; } | 138 bool wasBlockedAfterXFrameOptionsOrCSP() { return m_wasBlockedAfterXFrameOpt
ionsOrCSP; } |
| 140 | 139 |
| 141 Resource* startPreload(Resource::Type, FetchRequest&); | 140 Resource* startPreload(Resource::Type, FetchRequest&); |
| 142 | 141 |
| 143 DECLARE_VIRTUAL_TRACE(); | 142 DECLARE_VIRTUAL_TRACE(); |
| 144 | 143 |
| 145 protected: | 144 protected: |
| 146 DocumentLoader(LocalFrame*, const ResourceRequest&, const SubstituteData&); | 145 DocumentLoader(LocalFrame*, const ResourceRequest&, const SubstituteData&); |
| 147 | 146 |
| 148 Vector<KURL> m_redirectChain; | 147 Vector<KURL> m_redirectChain; |
| 149 | 148 |
| 150 private: | 149 private: |
| 151 static PassRefPtrWillBeRawPtr<DocumentWriter> createWriterFor(const Document
Init&, const AtomicString& mimeType, const AtomicString& encoding, bool dispatch
, ParserSynchronizationPolicy); | 150 static RawPtr<DocumentWriter> createWriterFor(const DocumentInit&, const Ato
micString& mimeType, const AtomicString& encoding, bool dispatch, ParserSynchron
izationPolicy); |
| 152 | 151 |
| 153 void ensureWriter(const AtomicString& mimeType, const KURL& overridingURL =
KURL()); | 152 void ensureWriter(const AtomicString& mimeType, const KURL& overridingURL =
KURL()); |
| 154 void endWriting(DocumentWriter*); | 153 void endWriting(DocumentWriter*); |
| 155 | 154 |
| 156 FrameLoader* frameLoader() const; | 155 FrameLoader* frameLoader() const; |
| 157 | 156 |
| 158 void commitIfReady(); | 157 void commitIfReady(); |
| 159 void commitData(const char* bytes, size_t length); | 158 void commitData(const char* bytes, size_t length); |
| 160 ResourceLoader* mainResourceLoader() const; | 159 ResourceLoader* mainResourceLoader() const; |
| 161 void clearMainResourceHandle(); | 160 void clearMainResourceHandle(); |
| 162 | 161 |
| 163 bool maybeCreateArchive(); | 162 bool maybeCreateArchive(); |
| 164 | 163 |
| 165 void finishedLoading(double finishTime); | 164 void finishedLoading(double finishTime); |
| 166 void cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceResponse&); | 165 void cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceResponse&); |
| 167 void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&)
final; | 166 void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&)
final; |
| 168 void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebData
ConsumerHandle>) final; | 167 void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebData
ConsumerHandle>) final; |
| 169 void dataReceived(Resource*, const char* data, size_t length) final; | 168 void dataReceived(Resource*, const char* data, size_t length) final; |
| 170 void processData(const char* data, size_t length); | 169 void processData(const char* data, size_t length); |
| 171 void notifyFinished(Resource*) final; | 170 void notifyFinished(Resource*) final; |
| 172 String debugName() const override { return "DocumentLoader"; } | 171 String debugName() const override { return "DocumentLoader"; } |
| 173 | 172 |
| 174 bool maybeLoadEmpty(); | 173 bool maybeLoadEmpty(); |
| 175 | 174 |
| 176 bool isRedirectAfterPost(const ResourceRequest&, const ResourceResponse&); | 175 bool isRedirectAfterPost(const ResourceRequest&, const ResourceResponse&); |
| 177 | 176 |
| 178 bool shouldContinueForResponse() const; | 177 bool shouldContinueForResponse() const; |
| 179 | 178 |
| 180 RawPtrWillBeMember<LocalFrame> m_frame; | 179 Member<LocalFrame> m_frame; |
| 181 PersistentWillBeMember<ResourceFetcher> m_fetcher; | 180 Member<ResourceFetcher> m_fetcher; |
| 182 | 181 |
| 183 RefPtrWillBeMember<RawResource> m_mainResource; | 182 Member<RawResource> m_mainResource; |
| 184 | 183 |
| 185 RefPtrWillBeMember<DocumentWriter> m_writer; | 184 Member<DocumentWriter> m_writer; |
| 186 | 185 |
| 187 // A reference to actual request used to create the data source. | 186 // A reference to actual request used to create the data source. |
| 188 // The only part of this request that should change is the url, and | 187 // The only part of this request that should change is the url, and |
| 189 // that only in the case of a same-document navigation. | 188 // that only in the case of a same-document navigation. |
| 190 ResourceRequest m_originalRequest; | 189 ResourceRequest m_originalRequest; |
| 191 | 190 |
| 192 SubstituteData m_substituteData; | 191 SubstituteData m_substituteData; |
| 193 | 192 |
| 194 // The 'working' request. It may be mutated | 193 // The 'working' request. It may be mutated |
| 195 // several times from the original request to include additional | 194 // several times from the original request to include additional |
| 196 // headers, cookie information, canonicalization and redirects. | 195 // headers, cookie information, canonicalization and redirects. |
| 197 ResourceRequest m_request; | 196 ResourceRequest m_request; |
| 198 | 197 |
| 199 ResourceResponse m_response; | 198 ResourceResponse m_response; |
| 200 | 199 |
| 201 bool m_isClientRedirect; | 200 bool m_isClientRedirect; |
| 202 bool m_replacesCurrentHistoryItem; | 201 bool m_replacesCurrentHistoryItem; |
| 203 | 202 |
| 204 NavigationType m_navigationType; | 203 NavigationType m_navigationType; |
| 205 | 204 |
| 206 DocumentLoadTiming m_documentLoadTiming; | 205 DocumentLoadTiming m_documentLoadTiming; |
| 207 | 206 |
| 208 double m_timeOfLastDataReceived; | 207 double m_timeOfLastDataReceived; |
| 209 | 208 |
| 210 PersistentWillBeMember<ApplicationCacheHost> m_applicationCacheHost; | 209 Member<ApplicationCacheHost> m_applicationCacheHost; |
| 211 | 210 |
| 212 RefPtrWillBeMember<ContentSecurityPolicy> m_contentSecurityPolicy; | 211 Member<ContentSecurityPolicy> m_contentSecurityPolicy; |
| 213 ClientHintsPreferences m_clientHintsPreferences; | 212 ClientHintsPreferences m_clientHintsPreferences; |
| 214 InitialScrollState m_initialScrollState; | 213 InitialScrollState m_initialScrollState; |
| 215 | 214 |
| 216 bool m_wasBlockedAfterXFrameOptionsOrCSP; | 215 bool m_wasBlockedAfterXFrameOptionsOrCSP; |
| 217 | 216 |
| 218 enum State { | 217 enum State { |
| 219 NotStarted, | 218 NotStarted, |
| 220 Provisional, | 219 Provisional, |
| 221 Committed, | 220 Committed, |
| 222 DataReceived, | 221 DataReceived, |
| 223 MainResourceDone, | 222 MainResourceDone, |
| 224 SentDidFinishLoad | 223 SentDidFinishLoad |
| 225 }; | 224 }; |
| 226 State m_state; | 225 State m_state; |
| 227 | 226 |
| 228 // Used to protect against reentrancy into dataReceived(). | 227 // Used to protect against reentrancy into dataReceived(). |
| 229 bool m_inDataReceived; | 228 bool m_inDataReceived; |
| 230 RefPtr<SharedBuffer> m_dataBuffer; | 229 RefPtr<SharedBuffer> m_dataBuffer; |
| 231 }; | 230 }; |
| 232 | 231 |
| 233 DECLARE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 232 DECLARE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
| 234 | 233 |
| 235 } // namespace blink | 234 } // namespace blink |
| 236 | 235 |
| 237 #endif // DocumentLoader_h | 236 #endif // DocumentLoader_h |
| OLD | NEW |