Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: Source/core/loader/FrameLoader.h

Issue 1156473002: Refactor FrameLoader loading interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 class SubstituteData; 59 class SubstituteData;
60 60
61 struct FrameLoadRequest; 61 struct FrameLoadRequest;
62 62
63 CORE_EXPORT bool isBackForwardLoadType(FrameLoadType); 63 CORE_EXPORT bool isBackForwardLoadType(FrameLoadType);
64 64
65 class CORE_EXPORT FrameLoader final { 65 class CORE_EXPORT FrameLoader final {
66 WTF_MAKE_NONCOPYABLE(FrameLoader); 66 WTF_MAKE_NONCOPYABLE(FrameLoader);
67 DISALLOW_ALLOCATION(); 67 DISALLOW_ALLOCATION();
68 public: 68 public:
69 static ResourceRequest requestFromHistoryItem(HistoryItem*, ResourceRequestC achePolicy); 69 static ResourceRequest resourceRequestFromHistoryItem(HistoryItem*, Resource RequestCachePolicy);
70 static FrameLoadRequest frameRequestForReload(
Nate Chapin 2015/06/04 23:23:09 I'm not convinced this helper does enough to be wo
clamy 2015/06/05 14:11:48 I removed it.
71 const ResourceRequest&, ClientRedirectPolicy = NotClientRedirect);
70 72
71 FrameLoader(LocalFrame*); 73 FrameLoader(LocalFrame*);
72 ~FrameLoader(); 74 ~FrameLoader();
73 75
74 void init(); 76 void init();
75 77
78 ResourceRequest resourceRequestForReload(FrameLoadType, const KURL& override URL = KURL(),
79 ClientRedirectPolicy = NotClientRedirect);
80
76 ProgressTracker& progress() const { return *m_progressTracker; } 81 ProgressTracker& progress() const { return *m_progressTracker; }
77 82
78 // These functions start a load. All eventually call into startLoad() or loa dInSameDocument(). 83 // Starts a load. It will eventually call startLoad() or
79 void load(const FrameLoadRequest&); // The entry point for non-reload, non-h istory loads. 84 // loadInSameDocument(). For history navigations or reloads, an appropriate
80 void reload(ReloadPolicy, const KURL& overrideURL = KURL(), ClientRedirectPo licy = NotClientRedirect); 85 // FrameLoadType should be given. Otherwise, FrameLoadTypeStandard should be
81 void loadHistoryItem(HistoryItem*, FrameLoadType = FrameLoadTypeBackForward, 86 // used (and the final FrameLoadType will be computed). For history
82 HistoryLoadType = HistoryDifferentDocumentLoad, 87 // navigations, a history item and a HistoryLoadType should also be provided .
83 ResourceRequestCachePolicy = UseProtocolCachePolicy); // The entry point for all back/forward loads 88 void load(const FrameLoadRequest&, FrameLoadType = FrameLoadTypeStandard,
89 HistoryItem* = nullptr, HistoryLoadType = HistoryDifferentDocumentLoad);
84 90
85 static void reportLocalLoadFailed(LocalFrame*, const String& url); 91 static void reportLocalLoadFailed(LocalFrame*, const String& url);
86 92
87 // Warning: stopAllLoaders can and will detach the LocalFrame out from under you. All callers need to either protect the LocalFrame 93 // 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. 94 // or guarantee they won't in any way access the LocalFrame after stopAllLoa ders returns.
89 void stopAllLoaders(); 95 void stopAllLoaders();
90 96
91 // FIXME: clear() is trying to do too many things. We should break it down i nto smaller functions. 97 // FIXME: clear() is trying to do too many things. We should break it down i nto smaller functions.
92 void clear(); 98 void clear();
93 99
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // E.g. while a new request is in the "policy" state, the old document loade r may 221 // E.g. while a new request is in the "policy" state, the old document loade r may
216 // be consulted in particular as it makes sense to imply certain settings on the new loader. 222 // be consulted in particular as it makes sense to imply certain settings on the new loader.
217 RefPtr<DocumentLoader> m_documentLoader; 223 RefPtr<DocumentLoader> m_documentLoader;
218 RefPtr<DocumentLoader> m_provisionalDocumentLoader; 224 RefPtr<DocumentLoader> m_provisionalDocumentLoader;
219 RefPtr<DocumentLoader> m_policyDocumentLoader; 225 RefPtr<DocumentLoader> m_policyDocumentLoader;
220 226
221 RefPtrWillBeMember<HistoryItem> m_currentItem; 227 RefPtrWillBeMember<HistoryItem> m_currentItem;
222 RefPtrWillBeMember<HistoryItem> m_provisionalItem; 228 RefPtrWillBeMember<HistoryItem> m_provisionalItem;
223 229
224 struct DeferredHistoryLoad { 230 struct DeferredHistoryLoad {
225 DISALLOW_ALLOCATION(); 231 DISALLOW_COPY(DeferredHistoryLoad);
226 public: 232 public:
227 DeferredHistoryLoad(HistoryItem* item, HistoryLoadType type, ResourceReq uestCachePolicy cachePolicy) 233 DeferredHistoryLoad(ResourceRequest request, HistoryItem* item, FrameLoa dType loadType,
228 : m_item(item) 234 HistoryLoadType historyLoadType)
229 , m_type(type) 235 : m_request(request)
230 , m_cachePolicy(cachePolicy) 236 , m_item(item)
237 , m_loadType(loadType)
238 , m_historyLoadType(historyLoadType)
231 { 239 {
232 } 240 }
233 241
234 DeferredHistoryLoad() { } 242 DeferredHistoryLoad() { }
235 243
236 bool isValid() { return m_item; }
237
238 DEFINE_INLINE_TRACE() 244 DEFINE_INLINE_TRACE()
239 { 245 {
240 visitor->trace(m_item); 246 visitor->trace(m_item);
241 } 247 }
242 248
249 ResourceRequest m_request;
243 RefPtrWillBeMember<HistoryItem> m_item; 250 RefPtrWillBeMember<HistoryItem> m_item;
244 HistoryLoadType m_type; 251 FrameLoadType m_loadType;
245 ResourceRequestCachePolicy m_cachePolicy; 252 HistoryLoadType m_historyLoadType;
246 }; 253 };
247 254
248 DeferredHistoryLoad m_deferredHistoryLoad; 255 OwnPtr<DeferredHistoryLoad> m_deferredHistoryLoad;
249 256
250 bool m_inStopAllLoaders; 257 bool m_inStopAllLoaders;
251 258
252 Timer<FrameLoader> m_checkTimer; 259 Timer<FrameLoader> m_checkTimer;
253 260
254 bool m_didAccessInitialDocument; 261 bool m_didAccessInitialDocument;
255 Timer<FrameLoader> m_didAccessInitialDocumentTimer; 262 Timer<FrameLoader> m_didAccessInitialDocumentTimer;
256 263
257 SandboxFlags m_forcedSandboxFlags; 264 SandboxFlags m_forcedSandboxFlags;
258 265
259 bool m_dispatchingDidClearWindowObjectInMainWorld; 266 bool m_dispatchingDidClearWindowObjectInMainWorld;
260 }; 267 };
261 268
262 } // namespace blink 269 } // namespace blink
263 270
264 #endif // FrameLoader_h 271 #endif // FrameLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698