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

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(
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(const LocalFrame&, FrameLoadType,
Nate Chapin 2015/06/02 17:19:35 No need to take the LocalFrame& now, we can just u
clamy 2015/06/03 14:39:14 Done.
79 const KURL& overrideURL = KURL(), ClientRedirectPolicy = NotClientRedire ct);
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_ALLOCATION();
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)
239 , m_isValid(true)
231 { 240 {
232 } 241 }
233 242
234 DeferredHistoryLoad() { } 243 DeferredHistoryLoad() : m_isValid(false) { }
235
236 bool isValid() { return m_item; }
237 244
238 DEFINE_INLINE_TRACE() 245 DEFINE_INLINE_TRACE()
239 { 246 {
240 visitor->trace(m_item);
dcheng 2015/06/02 18:42:02 Why was this removed? This probably breaks Oilpan.
clamy 2015/06/03 14:39:14 Done.
241 } 247 }
242 248
249 bool isValid() { return m_isValid; }
250
251 ResourceRequest m_request;
243 RefPtrWillBeMember<HistoryItem> m_item; 252 RefPtrWillBeMember<HistoryItem> m_item;
244 HistoryLoadType m_type; 253 FrameLoadType m_loadType;
245 ResourceRequestCachePolicy m_cachePolicy; 254 HistoryLoadType m_historyLoadType;
255 bool m_isValid;
dcheng 2015/06/02 18:42:02 Rather than having a m_isValid member, I'd rather
clamy 2015/06/03 14:39:14 Done.
246 }; 256 };
247 257
248 DeferredHistoryLoad m_deferredHistoryLoad; 258 DeferredHistoryLoad m_deferredHistoryLoad;
249 259
250 bool m_inStopAllLoaders; 260 bool m_inStopAllLoaders;
251 261
252 Timer<FrameLoader> m_checkTimer; 262 Timer<FrameLoader> m_checkTimer;
253 263
254 bool m_didAccessInitialDocument; 264 bool m_didAccessInitialDocument;
255 Timer<FrameLoader> m_didAccessInitialDocumentTimer; 265 Timer<FrameLoader> m_didAccessInitialDocumentTimer;
256 266
257 SandboxFlags m_forcedSandboxFlags; 267 SandboxFlags m_forcedSandboxFlags;
258 }; 268 };
259 269
260 } // namespace blink 270 } // namespace blink
261 271
262 #endif // FrameLoader_h 272 #endif // FrameLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698