Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
| 4 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 5 * Copyright (C) 2011 Google Inc. All rights reserved. | 5 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 #define FrameLoader_h | 33 #define FrameLoader_h |
| 34 | 34 |
| 35 #include "core/dom/IconURL.h" | 35 #include "core/dom/IconURL.h" |
| 36 #include "core/dom/SandboxFlags.h" | 36 #include "core/dom/SandboxFlags.h" |
| 37 #include "core/dom/SecurityContext.h" | 37 #include "core/dom/SecurityContext.h" |
| 38 #include "core/fetch/ResourceLoaderOptions.h" | 38 #include "core/fetch/ResourceLoaderOptions.h" |
| 39 #include "core/loader/FrameLoaderStateMachine.h" | 39 #include "core/loader/FrameLoaderStateMachine.h" |
| 40 #include "core/loader/FrameLoaderTypes.h" | 40 #include "core/loader/FrameLoaderTypes.h" |
| 41 #include "core/loader/HistoryItem.h" | 41 #include "core/loader/HistoryItem.h" |
| 42 #include "platform/Timer.h" | 42 #include "platform/Timer.h" |
| 43 #include "platform/heap/Handle.h" | |
| 43 #include "platform/network/ResourceRequest.h" | 44 #include "platform/network/ResourceRequest.h" |
| 44 #include "wtf/Forward.h" | 45 #include "wtf/Forward.h" |
| 45 #include "wtf/HashSet.h" | 46 #include "wtf/HashSet.h" |
| 46 #include "wtf/OwnPtr.h" | 47 #include "wtf/OwnPtr.h" |
| 47 | 48 |
| 48 namespace blink { | 49 namespace blink { |
| 49 | 50 |
| 50 class DocumentLoader; | 51 class DocumentLoader; |
| 51 class FetchContext; | 52 class FetchContext; |
| 52 class FormState; | 53 class FormState; |
| 53 class Frame; | 54 class Frame; |
| 54 class FrameLoaderClient; | 55 class FrameLoaderClient; |
| 55 class NavigationAction; | 56 class NavigationAction; |
| 56 class ProgressTracker; | 57 class ProgressTracker; |
| 57 class ResourceError; | 58 class ResourceError; |
| 58 class SerializedScriptValue; | 59 class SerializedScriptValue; |
| 59 class SubstituteData; | 60 class SubstituteData; |
| 60 | 61 |
| 61 struct FrameLoadRequest; | 62 struct FrameLoadRequest; |
| 62 | 63 |
| 63 bool isBackForwardLoadType(FrameLoadType); | 64 bool isBackForwardLoadType(FrameLoadType); |
| 64 | 65 |
| 65 class FrameLoader { | 66 class FrameLoader FINAL { |
| 66 WTF_MAKE_NONCOPYABLE(FrameLoader); | 67 WTF_MAKE_NONCOPYABLE(FrameLoader); |
| 68 ALLOW_ONLY_INLINE_ALLOCATION(); | |
|
haraken
2014/09/22 05:35:23
DISALLOW_ALLOCATION() ?
sof
2014/09/22 07:25:49
That would be more precise.
Possible to come up
haraken
2014/09/22 08:19:03
Or COMPOUND_OR_STACK_ALLOCATED() ? Then we can ren
| |
| 67 public: | 69 public: |
| 68 static ResourceRequest requestFromHistoryItem(HistoryItem*, ResourceRequestC achePolicy); | 70 static ResourceRequest requestFromHistoryItem(HistoryItem*, ResourceRequestC achePolicy); |
| 69 | 71 |
| 70 FrameLoader(LocalFrame*); | 72 FrameLoader(LocalFrame*); |
| 71 ~FrameLoader(); | 73 ~FrameLoader(); |
| 72 | 74 |
| 73 void init(); | 75 void init(); |
| 74 | 76 |
| 75 LocalFrame* frame() const { return m_frame; } | 77 LocalFrame* frame() const { return m_frame; } |
| 76 | 78 |
| 77 ProgressTracker& progress() const { return *m_progressTracker; } | 79 ProgressTracker& progress() const { return *m_progressTracker; } |
| 78 | 80 |
| 79 // These functions start a load. All eventually call into loadWithNavigation Action() or loadInSameDocument(). | 81 // These functions start a load. All eventually call into loadWithNavigation Action() or loadInSameDocument(). |
| 80 void load(const FrameLoadRequest&); // The entry point for non-reload, non-h istory loads. | 82 void load(const FrameLoadRequest&); // The entry point for non-reload, non-h istory loads. |
| 81 void reload(ReloadPolicy = NormalReload, const KURL& overrideURL = KURL(), c onst AtomicString& overrideEncoding = nullAtom, ClientRedirectPolicy = NotClient Redirect); | 83 void reload(ReloadPolicy = NormalReload, const KURL& overrideURL = KURL(), c onst AtomicString& overrideEncoding = nullAtom, ClientRedirectPolicy = NotClient Redirect); |
| 82 void loadHistoryItem(HistoryItem*, HistoryLoadType = HistoryDifferentDocumen tLoad, ResourceRequestCachePolicy = UseProtocolCachePolicy); // The entry point for all back/forward loads | 84 void loadHistoryItem(HistoryItem*, HistoryLoadType = HistoryDifferentDocumen tLoad, ResourceRequestCachePolicy = UseProtocolCachePolicy); // The entry point for all back/forward loads |
| 83 | 85 |
| 84 static void reportLocalLoadFailed(LocalFrame*, const String& url); | 86 static void reportLocalLoadFailed(LocalFrame*, const String& url); |
| 85 | 87 |
| 86 // FIXME: These are all functions which stop loads. We have too many. | 88 // FIXME: These are all functions which stop loads. We have too many. |
| 87 // Warning: stopAllLoaders can and will detach the LocalFrame out from under you. All callers need to either protect the LocalFrame | 89 // Warning: stopAllLoaders can and will detach the LocalFrame out from under you. All callers need to either protect the LocalFrame |
| 88 // or guarantee they won't in any way access the LocalFrame after stopAllLoa ders returns. | 90 // or guarantee they won't in any way access the LocalFrame after stopAllLoa ders returns. |
| 89 void stopAllLoaders(); | 91 void stopAllLoaders(); |
| 90 void stopLoading(); | 92 void stopLoading(); |
| 91 bool closeURL(); | 93 bool closeURL(); |
| 94 | |
| 92 // FIXME: clear() is trying to do too many things. We should break it down i nto smaller functions. | 95 // FIXME: clear() is trying to do too many things. We should break it down i nto smaller functions. |
| 93 void clear(); | 96 void clear(); |
| 97 | |
| 94 void replaceDocumentWhileExecutingJavaScriptURL(const String& source, Docume nt* ownerDocument); | 98 void replaceDocumentWhileExecutingJavaScriptURL(const String& source, Docume nt* ownerDocument); |
| 95 | 99 |
| 96 // Sets a timer to notify the client that the initial empty document has | 100 // Sets a timer to notify the client that the initial empty document has |
| 97 // been accessed, and thus it is no longer safe to show a provisional URL | 101 // been accessed, and thus it is no longer safe to show a provisional URL |
| 98 // above the document without risking a URL spoof. | 102 // above the document without risking a URL spoof. |
| 99 void didAccessInitialDocument(); | 103 void didAccessInitialDocument(); |
| 100 | 104 |
| 101 // If the initial empty document is showing and has been accessed, this | 105 // If the initial empty document is showing and has been accessed, this |
| 102 // cancels the timer and immediately notifies the client in cases that | 106 // cancels the timer and immediately notifies the client in cases that |
| 103 // waiting to notify would allow a URL spoof. | 107 // waiting to notify would allow a URL spoof. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 bool allowPlugins(ReasonForCallingAllowPlugins); | 173 bool allowPlugins(ReasonForCallingAllowPlugins); |
| 170 | 174 |
| 171 void updateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSour ce, PassRefPtr<SerializedScriptValue>, FrameLoadType); | 175 void updateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSour ce, PassRefPtr<SerializedScriptValue>, FrameLoadType); |
| 172 | 176 |
| 173 HistoryItem* currentItem() const { return m_currentItem.get(); } | 177 HistoryItem* currentItem() const { return m_currentItem.get(); } |
| 174 void saveScrollState(); | 178 void saveScrollState(); |
| 175 void clearScrollPositionAndViewState(); | 179 void clearScrollPositionAndViewState(); |
| 176 | 180 |
| 177 void restoreScrollPositionAndViewState(); | 181 void restoreScrollPositionAndViewState(); |
| 178 | 182 |
| 183 void trace(Visitor*); | |
| 184 | |
| 179 private: | 185 private: |
| 180 bool allChildrenAreComplete() const; // immediate children, not all descenda nts | 186 bool allChildrenAreComplete() const; // immediate children, not all descenda nts |
| 181 | 187 |
| 182 void completed(); | 188 void completed(); |
| 183 | 189 |
| 184 void checkTimerFired(Timer<FrameLoader>*); | 190 void checkTimerFired(Timer<FrameLoader>*); |
| 185 void didAccessInitialDocumentTimerFired(Timer<FrameLoader>*); | 191 void didAccessInitialDocumentTimerFired(Timer<FrameLoader>*); |
| 186 | 192 |
| 187 bool prepareRequestForThisFrame(FrameLoadRequest&); | 193 bool prepareRequestForThisFrame(FrameLoadRequest&); |
| 188 void setReferrerForFrameRequest(ResourceRequest&, ShouldSendReferrer, Docume nt*); | 194 void setReferrerForFrameRequest(ResourceRequest&, ShouldSendReferrer, Docume nt*); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 203 bool validateTransitionNavigationMode(); | 209 bool validateTransitionNavigationMode(); |
| 204 bool dispatchNavigationTransitionData(); | 210 bool dispatchNavigationTransitionData(); |
| 205 void detachClient(); | 211 void detachClient(); |
| 206 | 212 |
| 207 void setHistoryItemStateForCommit(HistoryCommitType, bool isPushOrReplaceSta te = false, PassRefPtr<SerializedScriptValue> = nullptr); | 213 void setHistoryItemStateForCommit(HistoryCommitType, bool isPushOrReplaceSta te = false, PassRefPtr<SerializedScriptValue> = nullptr); |
| 208 | 214 |
| 209 void loadInSameDocument(const KURL&, PassRefPtr<SerializedScriptValue> state Object, FrameLoadType, ClientRedirectPolicy); | 215 void loadInSameDocument(const KURL&, PassRefPtr<SerializedScriptValue> state Object, FrameLoadType, ClientRedirectPolicy); |
| 210 | 216 |
| 211 void scheduleCheckCompleted(); | 217 void scheduleCheckCompleted(); |
| 212 | 218 |
| 213 LocalFrame* m_frame; | 219 RawPtrWillBeMember<LocalFrame> m_frame; |
| 214 | 220 |
| 215 // FIXME: These should be OwnPtr<T> to reduce build times and simplify | 221 // FIXME: These should be OwnPtr<T> to reduce build times and simplify |
| 216 // header dependencies unless performance testing proves otherwise. | 222 // header dependencies unless performance testing proves otherwise. |
| 217 // Some of these could be lazily created for memory savings on devices. | 223 // Some of these could be lazily created for memory savings on devices. |
| 218 mutable FrameLoaderStateMachine m_stateMachine; | 224 mutable FrameLoaderStateMachine m_stateMachine; |
| 219 | 225 |
| 220 OwnPtr<ProgressTracker> m_progressTracker; | 226 OwnPtr<ProgressTracker> m_progressTracker; |
| 221 | 227 |
| 222 FrameState m_state; | 228 FrameState m_state; |
| 223 FrameLoadType m_loadType; | 229 FrameLoadType m_loadType; |
| 224 | 230 |
| 225 // Document loaders for the three phases of frame loading. Note that while | 231 // Document loaders for the three phases of frame loading. Note that while |
| 226 // a new request is being loaded, the old document loader may still be refer enced. | 232 // a new request is being loaded, the old document loader may still be refer enced. |
| 227 // E.g. while a new request is in the "policy" state, the old document loade r may | 233 // E.g. while a new request is in the "policy" state, the old document loade r may |
| 228 // be consulted in particular as it makes sense to imply certain settings on the new loader. | 234 // be consulted in particular as it makes sense to imply certain settings on the new loader. |
| 229 RefPtr<DocumentLoader> m_documentLoader; | 235 RefPtr<DocumentLoader> m_documentLoader; |
| 230 RefPtr<DocumentLoader> m_provisionalDocumentLoader; | 236 RefPtr<DocumentLoader> m_provisionalDocumentLoader; |
| 231 RefPtr<DocumentLoader> m_policyDocumentLoader; | 237 RefPtr<DocumentLoader> m_policyDocumentLoader; |
| 232 OwnPtr<FetchContext> m_fetchContext; | 238 OwnPtrWillBeMember<FetchContext> m_fetchContext; |
| 233 | 239 |
| 234 RefPtr<HistoryItem> m_currentItem; | 240 RefPtr<HistoryItem> m_currentItem; |
| 235 RefPtr<HistoryItem> m_provisionalItem; | 241 RefPtr<HistoryItem> m_provisionalItem; |
| 236 struct DeferredHistoryLoad { | 242 struct DeferredHistoryLoad { |
| 237 DeferredHistoryLoad(HistoryItem* item, HistoryLoadType type, ResourceReq uestCachePolicy cachePolicy) | 243 DeferredHistoryLoad(HistoryItem* item, HistoryLoadType type, ResourceReq uestCachePolicy cachePolicy) |
| 238 : m_item(item) | 244 : m_item(item) |
| 239 , m_type(type) | 245 , m_type(type) |
| 240 , m_cachePolicy(cachePolicy) | 246 , m_cachePolicy(cachePolicy) |
| 241 { | 247 { |
| 242 } | 248 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 257 | 263 |
| 258 bool m_didAccessInitialDocument; | 264 bool m_didAccessInitialDocument; |
| 259 Timer<FrameLoader> m_didAccessInitialDocumentTimer; | 265 Timer<FrameLoader> m_didAccessInitialDocumentTimer; |
| 260 | 266 |
| 261 SandboxFlags m_forcedSandboxFlags; | 267 SandboxFlags m_forcedSandboxFlags; |
| 262 }; | 268 }; |
| 263 | 269 |
| 264 } // namespace blink | 270 } // namespace blink |
| 265 | 271 |
| 266 #endif // FrameLoader_h | 272 #endif // FrameLoader_h |
| OLD | NEW |