| 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 namespace blink { | 51 namespace blink { |
| 52 | 52 |
| 53 class ApplicationCacheHost; | 53 class ApplicationCacheHost; |
| 54 class ResourceFetcher; | 54 class ResourceFetcher; |
| 55 class DocumentInit; | 55 class DocumentInit; |
| 56 class LocalFrame; | 56 class LocalFrame; |
| 57 class FrameLoader; | 57 class FrameLoader; |
| 58 class ResourceLoader; | 58 class ResourceLoader; |
| 59 class ThreadedDataReceiver; | 59 class ThreadedDataReceiver; |
| 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, Document*); | 75 void replaceDocumentWhileExecutingJavaScriptURL(const DocumentInit&, const S
tring& source, Document*); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 107 bool sentDidFinishLoad() const { return m_state == SentDidFinishLoad; } | 106 bool sentDidFinishLoad() const { return m_state == SentDidFinishLoad; } |
| 108 | 107 |
| 109 NavigationType navigationType() const { return m_navigationType; } | 108 NavigationType navigationType() const { return m_navigationType; } |
| 110 void setNavigationType(NavigationType navigationType) { m_navigationType = n
avigationType; } | 109 void setNavigationType(NavigationType navigationType) { m_navigationType = n
avigationType; } |
| 111 | 110 |
| 112 void setDefersLoading(bool); | 111 void setDefersLoading(bool); |
| 113 | 112 |
| 114 void startLoadingMainResource(); | 113 void startLoadingMainResource(); |
| 115 void cancelMainResourceLoad(const ResourceError&); | 114 void cancelMainResourceLoad(const ResourceError&); |
| 116 | 115 |
| 117 void attachThreadedDataReceiver(PassRefPtrWillBeRawPtr<ThreadedDataReceiver>
); | 116 void attachThreadedDataReceiver(RawPtr<ThreadedDataReceiver>); |
| 118 void acceptDataFromThreadedReceiver(const char* data, int dataLength, int en
codedDataLength); | 117 void acceptDataFromThreadedReceiver(const char* data, int dataLength, int en
codedDataLength); |
| 119 DocumentLoadTiming& timing() { return m_documentLoadTiming; } | 118 DocumentLoadTiming& timing() { return m_documentLoadTiming; } |
| 120 const DocumentLoadTiming& timing() const { return m_documentLoadTiming; } | 119 const DocumentLoadTiming& timing() const { return m_documentLoadTiming; } |
| 121 | 120 |
| 122 ApplicationCacheHost* applicationCacheHost() const { return m_applicationCac
heHost.get(); } | 121 ApplicationCacheHost* applicationCacheHost() const { return m_applicationCac
heHost.get(); } |
| 123 | 122 |
| 124 void clearRedirectChain(); | 123 void clearRedirectChain(); |
| 125 void appendRedirect(const KURL&); | 124 void appendRedirect(const KURL&); |
| 126 | 125 |
| 127 PassRefPtrWillBeRawPtr<ContentSecurityPolicy> releaseContentSecurityPolicy()
{ return m_contentSecurityPolicy.release(); } | 126 RawPtr<ContentSecurityPolicy> releaseContentSecurityPolicy() { return m_cont
entSecurityPolicy.release(); } |
| 128 | 127 |
| 129 ClientHintsPreferences& clientHintsPreferences() { return m_clientHintsPrefe
rences; } | 128 ClientHintsPreferences& clientHintsPreferences() { return m_clientHintsPrefe
rences; } |
| 130 | 129 |
| 131 struct InitialScrollState { | 130 struct InitialScrollState { |
| 132 DISALLOW_NEW(); | 131 DISALLOW_NEW(); |
| 133 InitialScrollState() | 132 InitialScrollState() |
| 134 : wasScrolledByUser(false) | 133 : wasScrolledByUser(false) |
| 135 , didRestoreFromHistory(false) | 134 , didRestoreFromHistory(false) |
| 136 { | 135 { |
| 137 } | 136 } |
| 138 | 137 |
| 139 bool wasScrolledByUser; | 138 bool wasScrolledByUser; |
| 140 bool didRestoreFromHistory; | 139 bool didRestoreFromHistory; |
| 141 }; | 140 }; |
| 142 InitialScrollState& initialScrollState() { return m_initialScrollState; } | 141 InitialScrollState& initialScrollState() { return m_initialScrollState; } |
| 143 | 142 |
| 144 bool loadingMultipartContent() const; | 143 bool loadingMultipartContent() const; |
| 145 | 144 |
| 146 Resource* startPreload(Resource::Type, FetchRequest&); | 145 Resource* startPreload(Resource::Type, FetchRequest&); |
| 147 | 146 |
| 148 DECLARE_VIRTUAL_TRACE(); | 147 DECLARE_VIRTUAL_TRACE(); |
| 149 | 148 |
| 150 protected: | 149 protected: |
| 151 DocumentLoader(LocalFrame*, const ResourceRequest&, const SubstituteData&); | 150 DocumentLoader(LocalFrame*, const ResourceRequest&, const SubstituteData&); |
| 152 | 151 |
| 153 Vector<KURL> m_redirectChain; | 152 Vector<KURL> m_redirectChain; |
| 154 | 153 |
| 155 private: | 154 private: |
| 156 static PassRefPtrWillBeRawPtr<DocumentWriter> createWriterFor(const Document
* ownerDocument, const DocumentInit&, const AtomicString& mimeType, const Atomic
String& encoding, bool dispatch, ParserSynchronizationPolicy); | 155 static RawPtr<DocumentWriter> createWriterFor(const Document* ownerDocument,
const DocumentInit&, const AtomicString& mimeType, const AtomicString& encoding
, bool dispatch, ParserSynchronizationPolicy); |
| 157 | 156 |
| 158 void ensureWriter(const AtomicString& mimeType, const KURL& overridingURL =
KURL()); | 157 void ensureWriter(const AtomicString& mimeType, const KURL& overridingURL =
KURL()); |
| 159 void endWriting(DocumentWriter*); | 158 void endWriting(DocumentWriter*); |
| 160 | 159 |
| 161 Document* document() const; | 160 Document* document() const; |
| 162 FrameLoader* frameLoader() const; | 161 FrameLoader* frameLoader() const; |
| 163 | 162 |
| 164 void commitIfReady(); | 163 void commitIfReady(); |
| 165 void commitData(const char* bytes, size_t length); | 164 void commitData(const char* bytes, size_t length); |
| 166 ResourceLoader* mainResourceLoader() const; | 165 ResourceLoader* mainResourceLoader() const; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 178 void processData(const char* data, size_t length); | 177 void processData(const char* data, size_t length); |
| 179 void notifyFinished(Resource*) final; | 178 void notifyFinished(Resource*) final; |
| 180 String debugName() const override { return "DocumentLoader"; } | 179 String debugName() const override { return "DocumentLoader"; } |
| 181 | 180 |
| 182 bool maybeLoadEmpty(); | 181 bool maybeLoadEmpty(); |
| 183 | 182 |
| 184 bool isRedirectAfterPost(const ResourceRequest&, const ResourceResponse&); | 183 bool isRedirectAfterPost(const ResourceRequest&, const ResourceResponse&); |
| 185 | 184 |
| 186 bool shouldContinueForResponse() const; | 185 bool shouldContinueForResponse() const; |
| 187 | 186 |
| 188 RawPtrWillBeMember<LocalFrame> m_frame; | 187 Member<LocalFrame> m_frame; |
| 189 PersistentWillBeMember<ResourceFetcher> m_fetcher; | 188 Member<ResourceFetcher> m_fetcher; |
| 190 | 189 |
| 191 RefPtrWillBeMember<RawResource> m_mainResource; | 190 Member<RawResource> m_mainResource; |
| 192 | 191 |
| 193 RefPtrWillBeMember<DocumentWriter> m_writer; | 192 Member<DocumentWriter> m_writer; |
| 194 | 193 |
| 195 // A reference to actual request used to create the data source. | 194 // A reference to actual request used to create the data source. |
| 196 // The only part of this request that should change is the url, and | 195 // The only part of this request that should change is the url, and |
| 197 // that only in the case of a same-document navigation. | 196 // that only in the case of a same-document navigation. |
| 198 ResourceRequest m_originalRequest; | 197 ResourceRequest m_originalRequest; |
| 199 | 198 |
| 200 SubstituteData m_substituteData; | 199 SubstituteData m_substituteData; |
| 201 | 200 |
| 202 // The 'working' request. It may be mutated | 201 // The 'working' request. It may be mutated |
| 203 // several times from the original request to include additional | 202 // several times from the original request to include additional |
| 204 // headers, cookie information, canonicalization and redirects. | 203 // headers, cookie information, canonicalization and redirects. |
| 205 ResourceRequest m_request; | 204 ResourceRequest m_request; |
| 206 | 205 |
| 207 ResourceResponse m_response; | 206 ResourceResponse m_response; |
| 208 | 207 |
| 209 bool m_isClientRedirect; | 208 bool m_isClientRedirect; |
| 210 bool m_replacesCurrentHistoryItem; | 209 bool m_replacesCurrentHistoryItem; |
| 211 | 210 |
| 212 NavigationType m_navigationType; | 211 NavigationType m_navigationType; |
| 213 | 212 |
| 214 DocumentLoadTiming m_documentLoadTiming; | 213 DocumentLoadTiming m_documentLoadTiming; |
| 215 | 214 |
| 216 double m_timeOfLastDataReceived; | 215 double m_timeOfLastDataReceived; |
| 217 | 216 |
| 218 PersistentWillBeMember<ApplicationCacheHost> m_applicationCacheHost; | 217 Member<ApplicationCacheHost> m_applicationCacheHost; |
| 219 | 218 |
| 220 RefPtrWillBeMember<ContentSecurityPolicy> m_contentSecurityPolicy; | 219 Member<ContentSecurityPolicy> m_contentSecurityPolicy; |
| 221 ClientHintsPreferences m_clientHintsPreferences; | 220 ClientHintsPreferences m_clientHintsPreferences; |
| 222 InitialScrollState m_initialScrollState; | 221 InitialScrollState m_initialScrollState; |
| 223 | 222 |
| 224 enum State { | 223 enum State { |
| 225 NotStarted, | 224 NotStarted, |
| 226 Provisional, | 225 Provisional, |
| 227 Committed, | 226 Committed, |
| 228 DataReceived, | 227 DataReceived, |
| 229 MainResourceDone, | 228 MainResourceDone, |
| 230 SentDidFinishLoad | 229 SentDidFinishLoad |
| 231 }; | 230 }; |
| 232 State m_state; | 231 State m_state; |
| 233 | 232 |
| 234 // Used to protect against reentrancy into dataReceived(). | 233 // Used to protect against reentrancy into dataReceived(). |
| 235 bool m_inDataReceived; | 234 bool m_inDataReceived; |
| 236 RefPtr<SharedBuffer> m_dataBuffer; | 235 RefPtr<SharedBuffer> m_dataBuffer; |
| 237 }; | 236 }; |
| 238 | 237 |
| 239 DECLARE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 238 DECLARE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
| 240 | 239 |
| 241 } // namespace blink | 240 } // namespace blink |
| 242 | 241 |
| 243 #endif // DocumentLoader_h | 242 #endif // DocumentLoader_h |
| OLD | NEW |