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

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: Fixed issue with inital history navigation in child frames Created 5 years, 7 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 ResourceRequest resourceRequestForReload(HistoryItem*, const LocalFra me&, FrameLoadType,
Nate Chapin 2015/05/27 16:54:34 I'm not sure I like this as a static method, given
clamy 2015/05/29 14:41:50 Switched to a non-static function.
71 const KURL& overrideURL = KURL(), ClientRedirectPolicy = NotClientRedire ct);
72 static FrameLoadRequest frameRequestForReload(
73 const ResourceRequest&, ClientRedirectPolicy = NotClientRedirect);
70 74
71 FrameLoader(LocalFrame*); 75 FrameLoader(LocalFrame*);
72 ~FrameLoader(); 76 ~FrameLoader();
73 77
74 void init(); 78 void init();
75 79
76 ProgressTracker& progress() const { return *m_progressTracker; } 80 ProgressTracker& progress() const { return *m_progressTracker; }
77 81
78 // These functions start a load. All eventually call into startLoad() or loa dInSameDocument(). 82 // Starts a load. It will eventually call startLoad() or
79 void load(const FrameLoadRequest&); // The entry point for non-reload, non-h istory loads. 83 // loadInSameDocument(). For history navigations or reloads, an appropriate
80 void reload(ReloadPolicy, const KURL& overrideURL = KURL(), ClientRedirectPo licy = NotClientRedirect); 84 // FrameLoadType should be given. Otherwise, FrameLoadTypeStandard should be
81 void loadHistoryItem(HistoryItem*, FrameLoadType = FrameLoadTypeBackForward, 85 // used (and the final FrameLoadType will be computed). For history
82 HistoryLoadType = HistoryDifferentDocumentLoad, 86 // navigations, a history item should also be provided.
83 ResourceRequestCachePolicy = UseProtocolCachePolicy); // The entry point for all back/forward loads 87 void load(const FrameLoadRequest&, FrameLoadType = FrameLoadTypeStandard, Hi storyItem* = nullptr);
84 88
85 static void reportLocalLoadFailed(LocalFrame*, const String& url); 89 static void reportLocalLoadFailed(LocalFrame*, const String& url);
86 90
87 // Warning: stopAllLoaders can and will detach the LocalFrame out from under you. All callers need to either protect the LocalFrame 91 // 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. 92 // or guarantee they won't in any way access the LocalFrame after stopAllLoa ders returns.
89 void stopAllLoaders(); 93 void stopAllLoaders();
90 94
91 // 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.
92 void clear(); 96 void clear();
93 97
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 RefPtr<DocumentLoader> m_documentLoader; 221 RefPtr<DocumentLoader> m_documentLoader;
218 RefPtr<DocumentLoader> m_provisionalDocumentLoader; 222 RefPtr<DocumentLoader> m_provisionalDocumentLoader;
219 RefPtr<DocumentLoader> m_policyDocumentLoader; 223 RefPtr<DocumentLoader> m_policyDocumentLoader;
220 224
221 RefPtrWillBeMember<HistoryItem> m_currentItem; 225 RefPtrWillBeMember<HistoryItem> m_currentItem;
222 RefPtrWillBeMember<HistoryItem> m_provisionalItem; 226 RefPtrWillBeMember<HistoryItem> m_provisionalItem;
223 227
224 struct DeferredHistoryLoad { 228 struct DeferredHistoryLoad {
225 DISALLOW_ALLOCATION(); 229 DISALLOW_ALLOCATION();
226 public: 230 public:
227 DeferredHistoryLoad(HistoryItem* item, HistoryLoadType type, ResourceReq uestCachePolicy cachePolicy) 231 DeferredHistoryLoad(ResourceRequest request, HistoryItem* item, FrameLoa dType loadType)
228 : m_item(item) 232 : m_request(request)
229 , m_type(type) 233 , m_item(item)
230 , m_cachePolicy(cachePolicy) 234 , m_loadType(loadType)
235 , m_isValid(true)
231 { 236 {
232 } 237 }
233 238
234 DeferredHistoryLoad() { } 239 DeferredHistoryLoad() : m_isValid(false) { }
235
236 bool isValid() { return m_item; }
237 240
238 DEFINE_INLINE_TRACE() 241 DEFINE_INLINE_TRACE()
239 { 242 {
240 visitor->trace(m_item);
241 } 243 }
242 244
245 bool isValid() { return m_isValid; }
246
247 ResourceRequest m_request;
243 RefPtrWillBeMember<HistoryItem> m_item; 248 RefPtrWillBeMember<HistoryItem> m_item;
244 HistoryLoadType m_type; 249 FrameLoadType m_loadType;
245 ResourceRequestCachePolicy m_cachePolicy; 250 bool m_isValid;
246 }; 251 };
247 252
248 DeferredHistoryLoad m_deferredHistoryLoad; 253 DeferredHistoryLoad m_deferredHistoryLoad;
249 254
250 bool m_inStopAllLoaders; 255 bool m_inStopAllLoaders;
251 256
252 Timer<FrameLoader> m_checkTimer; 257 Timer<FrameLoader> m_checkTimer;
253 258
254 bool m_didAccessInitialDocument; 259 bool m_didAccessInitialDocument;
255 Timer<FrameLoader> m_didAccessInitialDocumentTimer; 260 Timer<FrameLoader> m_didAccessInitialDocumentTimer;
256 261
257 SandboxFlags m_forcedSandboxFlags; 262 SandboxFlags m_forcedSandboxFlags;
258 }; 263 };
259 264
260 } // namespace blink 265 } // namespace blink
261 266
262 #endif // FrameLoader_h 267 #endif // FrameLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698