| 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 30 matching lines...) Expand all Loading... |
| 41 #include "core/loader/DocumentWriter.h" | 41 #include "core/loader/DocumentWriter.h" |
| 42 #include "core/loader/FrameLoaderTypes.h" | 42 #include "core/loader/FrameLoaderTypes.h" |
| 43 #include "core/loader/NavigationPolicy.h" | 43 #include "core/loader/NavigationPolicy.h" |
| 44 #include "platform/network/ResourceError.h" | 44 #include "platform/network/ResourceError.h" |
| 45 #include "platform/network/ResourceRequest.h" | 45 #include "platform/network/ResourceRequest.h" |
| 46 #include "platform/network/ResourceResponse.h" | 46 #include "platform/network/ResourceResponse.h" |
| 47 #include "wtf/HashSet.h" | 47 #include "wtf/HashSet.h" |
| 48 #include "wtf/RefPtr.h" | 48 #include "wtf/RefPtr.h" |
| 49 | 49 |
| 50 namespace blink { | 50 namespace blink { |
| 51 |
| 51 class ApplicationCacheHost; | 52 class ApplicationCacheHost; |
| 52 class ResourceFetcher; | 53 class ResourceFetcher; |
| 53 class DocumentInit; | 54 class DocumentInit; |
| 54 class LocalFrame; | 55 class LocalFrame; |
| 55 class FrameLoader; | 56 class FrameLoader; |
| 56 class MHTMLArchive; | 57 class MHTMLArchive; |
| 57 class ResourceLoader; | 58 class ResourceLoader; |
| 58 class ThreadedDataReceiver; | 59 class ThreadedDataReceiver; |
| 59 | 60 |
| 60 class CORE_EXPORT DocumentLoader : public RefCounted<DocumentLoader>, privat
e RawResourceClient { | 61 class CORE_EXPORT DocumentLoader : public RefCountedWillBeGarbageCollectedFi
nalized<DocumentLoader>, private RawResourceClient { |
| 61 WTF_MAKE_FAST_ALLOCATED(DocumentLoader); | 62 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(DocumentLoader); |
| 62 public: | 63 public: |
| 63 static PassRefPtr<DocumentLoader> create(LocalFrame* frame, const Resour
ceRequest& request, const SubstituteData& data) | 64 static PassRefPtrWillBeRawPtr<DocumentLoader> create(LocalFrame* frame,
const ResourceRequest& request, const SubstituteData& data) |
| 64 { | 65 { |
| 65 return adoptRef(new DocumentLoader(frame, request, data)); | 66 return adoptRefWillBeNoop(new DocumentLoader(frame, request, data)); |
| 66 } | 67 } |
| 67 virtual ~DocumentLoader(); | 68 virtual ~DocumentLoader(); |
| 68 | 69 |
| 69 LocalFrame* frame() const { return m_frame; } | 70 LocalFrame* frame() const { return m_frame; } |
| 70 | 71 |
| 71 void detachFromFrame(); | 72 virtual void detachFromFrame(); |
| 72 | 73 |
| 73 unsigned long mainResourceIdentifier() const; | 74 unsigned long mainResourceIdentifier() const; |
| 74 | 75 |
| 75 void replaceDocumentWhileExecutingJavaScriptURL(const DocumentInit&, con
st String& source, Document*); | 76 void replaceDocumentWhileExecutingJavaScriptURL(const DocumentInit&, con
st String& source, Document*); |
| 76 | 77 |
| 77 const AtomicString& mimeType() const; | 78 const AtomicString& mimeType() const; |
| 78 | 79 |
| 79 const ResourceRequest& originalRequest() const; | 80 const ResourceRequest& originalRequest() const; |
| 80 | 81 |
| 81 const ResourceRequest& request() const; | 82 const ResourceRequest& request() const; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 135 |
| 135 // TODO(skobes): Move FrameView::m_wasScrolledByUser into here. | 136 // TODO(skobes): Move FrameView::m_wasScrolledByUser into here. |
| 136 bool didRestoreFromHistory; | 137 bool didRestoreFromHistory; |
| 137 }; | 138 }; |
| 138 InitialScrollState& initialScrollState() { return m_initialScrollState;
} | 139 InitialScrollState& initialScrollState() { return m_initialScrollState;
} |
| 139 | 140 |
| 140 bool loadingMultipartContent() const; | 141 bool loadingMultipartContent() const; |
| 141 | 142 |
| 142 void startPreload(Resource::Type, FetchRequest&); | 143 void startPreload(Resource::Type, FetchRequest&); |
| 143 | 144 |
| 145 DECLARE_VIRTUAL_TRACE(); |
| 146 |
| 144 protected: | 147 protected: |
| 145 DocumentLoader(LocalFrame*, const ResourceRequest&, const SubstituteData
&); | 148 DocumentLoader(LocalFrame*, const ResourceRequest&, const SubstituteData
&); |
| 146 | 149 |
| 147 Vector<KURL> m_redirectChain; | 150 Vector<KURL> m_redirectChain; |
| 148 | 151 |
| 149 private: | 152 private: |
| 150 static PassRefPtrWillBeRawPtr<DocumentWriter> createWriterFor(const Docu
ment* ownerDocument, const DocumentInit&, const AtomicString& mimeType, const At
omicString& encoding, bool dispatch, ParserSynchronizationPolicy); | 153 static PassRefPtrWillBeRawPtr<DocumentWriter> createWriterFor(const Docu
ment* ownerDocument, const DocumentInit&, const AtomicString& mimeType, const At
omicString& encoding, bool dispatch, ParserSynchronizationPolicy); |
| 151 | 154 |
| 152 void ensureWriter(const AtomicString& mimeType, const KURL& overridingUR
L = KURL()); | 155 void ensureWriter(const AtomicString& mimeType, const KURL& overridingUR
L = KURL()); |
| 153 void endWriting(DocumentWriter*); | 156 void endWriting(DocumentWriter*); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 174 virtual void responseReceived(Resource*, const ResourceResponse&, PassOw
nPtr<WebDataConsumerHandle>) override final; | 177 virtual void responseReceived(Resource*, const ResourceResponse&, PassOw
nPtr<WebDataConsumerHandle>) override final; |
| 175 virtual void dataReceived(Resource*, const char* data, unsigned length)
override final; | 178 virtual void dataReceived(Resource*, const char* data, unsigned length)
override final; |
| 176 virtual void notifyFinished(Resource*) override final; | 179 virtual void notifyFinished(Resource*) override final; |
| 177 | 180 |
| 178 bool maybeLoadEmpty(); | 181 bool maybeLoadEmpty(); |
| 179 | 182 |
| 180 bool isRedirectAfterPost(const ResourceRequest&, const ResourceResponse&
); | 183 bool isRedirectAfterPost(const ResourceRequest&, const ResourceResponse&
); |
| 181 | 184 |
| 182 bool shouldContinueForResponse() const; | 185 bool shouldContinueForResponse() const; |
| 183 | 186 |
| 184 LocalFrame* m_frame; | 187 RawPtrWillBeMember<LocalFrame> m_frame; |
| 185 RefPtrWillBePersistent<ResourceFetcher> m_fetcher; | 188 RefPtrWillBeMember<ResourceFetcher> m_fetcher; |
| 186 | 189 |
| 187 ResourcePtr<RawResource> m_mainResource; | 190 ResourcePtr<RawResource> m_mainResource; |
| 188 | 191 |
| 189 RefPtrWillBePersistent<DocumentWriter> m_writer; | 192 RefPtrWillBeMember<DocumentWriter> m_writer; |
| 190 | 193 |
| 191 // A reference to actual request used to create the data source. | 194 // A reference to actual request used to create the data source. |
| 192 // 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 |
| 193 // that only in the case of a same-document navigation. | 196 // that only in the case of a same-document navigation. |
| 194 ResourceRequest m_originalRequest; | 197 ResourceRequest m_originalRequest; |
| 195 | 198 |
| 196 SubstituteData m_substituteData; | 199 SubstituteData m_substituteData; |
| 197 | 200 |
| 198 // The 'working' request. It may be mutated | 201 // The 'working' request. It may be mutated |
| 199 // several times from the original request to include additional | 202 // several times from the original request to include additional |
| 200 // headers, cookie information, canonicalization and redirects. | 203 // headers, cookie information, canonicalization and redirects. |
| 201 ResourceRequest m_request; | 204 ResourceRequest m_request; |
| 202 | 205 |
| 203 ResourceResponse m_response; | 206 ResourceResponse m_response; |
| 204 | 207 |
| 205 ResourceError m_mainDocumentError; | 208 ResourceError m_mainDocumentError; |
| 206 | 209 |
| 207 bool m_committed; | 210 bool m_committed; |
| 208 bool m_isClientRedirect; | 211 bool m_isClientRedirect; |
| 209 bool m_replacesCurrentHistoryItem; | 212 bool m_replacesCurrentHistoryItem; |
| 210 | 213 |
| 211 NavigationType m_navigationType; | 214 NavigationType m_navigationType; |
| 212 | 215 |
| 213 RefPtrWillBePersistent<MHTMLArchive> m_archive; | 216 RefPtrWillBeMember<MHTMLArchive> m_archive; |
| 214 | 217 |
| 215 bool m_loadingMainResource; | 218 bool m_loadingMainResource; |
| 216 DocumentLoadTiming m_documentLoadTiming; | 219 DocumentLoadTiming m_documentLoadTiming; |
| 217 | 220 |
| 218 double m_timeOfLastDataReceived; | 221 double m_timeOfLastDataReceived; |
| 219 | 222 |
| 220 friend class ApplicationCacheHost; // for substitute resource delivery | 223 PersistentWillBeMember<ApplicationCacheHost> m_applicationCacheHost; |
| 221 OwnPtrWillBePersistent<ApplicationCacheHost> m_applicationCacheHost; | |
| 222 | 224 |
| 223 RefPtr<ContentSecurityPolicy> m_contentSecurityPolicy; | 225 RefPtr<ContentSecurityPolicy> m_contentSecurityPolicy; |
| 224 ClientHintsPreferences m_clientHintsPreferences; | 226 ClientHintsPreferences m_clientHintsPreferences; |
| 225 InitialScrollState m_initialScrollState; | 227 InitialScrollState m_initialScrollState; |
| 226 }; | 228 }; |
| 227 } | 229 |
| 230 } // namespace blink |
| 228 | 231 |
| 229 #endif // DocumentLoader_h | 232 #endif // DocumentLoader_h |
| OLD | NEW |