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

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentLoader.h

Issue 2556053002: Clarify when DocumentLoader's FrameLoader/FrameLoaderClient accessors can be used (Closed)
Patch Set: Rebase and comment fix Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "wtf/RefPtr.h" 53 #include "wtf/RefPtr.h"
54 #include <memory> 54 #include <memory>
55 55
56 namespace blink { 56 namespace blink {
57 57
58 class ApplicationCacheHost; 58 class ApplicationCacheHost;
59 class ResourceFetcher; 59 class ResourceFetcher;
60 class DocumentInit; 60 class DocumentInit;
61 class LocalFrame; 61 class LocalFrame;
62 class FrameLoader; 62 class FrameLoader;
63 class FrameLoaderClient;
63 class ResourceTimingInfo; 64 class ResourceTimingInfo;
64 class WebDocumentSubresourceFilter; 65 class WebDocumentSubresourceFilter;
65 struct ViewportDescriptionWrapper; 66 struct ViewportDescriptionWrapper;
66 67
67 class CORE_EXPORT DocumentLoader 68 class CORE_EXPORT DocumentLoader
yhirano 2016/12/26 08:46:23 +final
tyoshino (SeeGerritForStatus) 2017/01/10 10:29:25 WebDataSourceImpl is a subclass of this class.
68 : public GarbageCollectedFinalized<DocumentLoader>, 69 : public GarbageCollectedFinalized<DocumentLoader>,
69 private RawResourceClient { 70 private RawResourceClient {
70 USING_GARBAGE_COLLECTED_MIXIN(DocumentLoader); 71 USING_GARBAGE_COLLECTED_MIXIN(DocumentLoader);
71 72
72 public: 73 public:
73 static DocumentLoader* create(LocalFrame* frame, 74 static DocumentLoader* create(LocalFrame* frame,
74 const ResourceRequest& request, 75 const ResourceRequest& request,
75 const SubstituteData& data, 76 const SubstituteData& data,
76 ClientRedirectPolicy clientRedirectPolicy) { 77 ClientRedirectPolicy clientRedirectPolicy) {
78 DCHECK(frame);
79
77 return new DocumentLoader(frame, request, data, clientRedirectPolicy); 80 return new DocumentLoader(frame, request, data, clientRedirectPolicy);
78 } 81 }
79 ~DocumentLoader() override; 82 ~DocumentLoader() override;
80 83
81 LocalFrame* frame() const { return m_frame; } 84 LocalFrame* frame() const { return m_frame; }
82 85
83 ResourceTimingInfo* getNavigationTimingInfo() const; 86 ResourceTimingInfo* getNavigationTimingInfo() const;
84 87
85 virtual void detachFromFrame(); 88 virtual void detachFromFrame();
86 89
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 const AtomicString& mimeType, 202 const AtomicString& mimeType,
200 const AtomicString& encoding, 203 const AtomicString& encoding,
201 bool dispatchWindowObjectAvailable, 204 bool dispatchWindowObjectAvailable,
202 ParserSynchronizationPolicy, 205 ParserSynchronizationPolicy,
203 const KURL& overridingURL = KURL()); 206 const KURL& overridingURL = KURL());
204 207
205 void ensureWriter(const AtomicString& mimeType, 208 void ensureWriter(const AtomicString& mimeType,
206 const KURL& overridingURL = KURL()); 209 const KURL& overridingURL = KURL());
207 void endWriting(); 210 void endWriting();
208 211
209 FrameLoader* frameLoader() const; 212 // Use these method only where it's guaranteed that |m_frame| hasn't been
213 // cleared.
214 FrameLoader& frameLoader() const;
215 FrameLoaderClient* frameLoaderClient() const;
yhirano 2016/12/26 08:46:23 What is the reference-pointer policy here? Both fr
tyoshino (SeeGerritForStatus) 2017/01/10 10:29:25 Ah, right. Changed frameLoaderClient() to also be
210 216
211 void commitIfReady(); 217 void commitIfReady();
212 void commitData(const char* bytes, size_t length); 218 void commitData(const char* bytes, size_t length);
213 void clearMainResourceHandle(); 219 void clearMainResourceHandle();
214 220
215 bool maybeCreateArchive(); 221 bool maybeCreateArchive();
216 222
217 void finishedLoading(double finishTime); 223 void finishedLoading(double finishTime);
218 void cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceResponse&); 224 void cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceResponse&);
225
226 // RawResourceClient implementation
219 bool redirectReceived(Resource*, 227 bool redirectReceived(Resource*,
220 const ResourceRequest&, 228 const ResourceRequest&,
221 const ResourceResponse&) final; 229 const ResourceResponse&) final;
222 void responseReceived(Resource*, 230 void responseReceived(Resource*,
223 const ResourceResponse&, 231 const ResourceResponse&,
224 std::unique_ptr<WebDataConsumerHandle>) final; 232 std::unique_ptr<WebDataConsumerHandle>) final;
225 void dataReceived(Resource*, const char* data, size_t length) final; 233 void dataReceived(Resource*, const char* data, size_t length) final;
226 void processData(const char* data, size_t length); 234
235 // ResourceClient implementation
227 void notifyFinished(Resource*) final; 236 void notifyFinished(Resource*) final;
228 String debugName() const override { return "DocumentLoader"; } 237 String debugName() const override { return "DocumentLoader"; }
229 238
239 void processData(const char* data, size_t length);
240
230 bool maybeLoadEmpty(); 241 bool maybeLoadEmpty();
231 242
232 bool isRedirectAfterPost(const ResourceRequest&, const ResourceResponse&); 243 bool isRedirectAfterPost(const ResourceRequest&, const ResourceResponse&);
233 244
234 bool shouldContinueForResponse() const; 245 bool shouldContinueForResponse() const;
235 246
236 Member<LocalFrame> m_frame; 247 Member<LocalFrame> m_frame;
237 Member<ResourceFetcher> m_fetcher; 248 Member<ResourceFetcher> m_fetcher;
238 std::unique_ptr<WebDocumentSubresourceFilter> m_subresourceFilter; 249 std::unique_ptr<WebDocumentSubresourceFilter> m_subresourceFilter;
239 250
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // Used to protect against reentrancy into dataReceived(). 296 // Used to protect against reentrancy into dataReceived().
286 bool m_inDataReceived; 297 bool m_inDataReceived;
287 RefPtr<SharedBuffer> m_dataBuffer; 298 RefPtr<SharedBuffer> m_dataBuffer;
288 }; 299 };
289 300
290 DECLARE_WEAK_IDENTIFIER_MAP(DocumentLoader); 301 DECLARE_WEAK_IDENTIFIER_MAP(DocumentLoader);
291 302
292 } // namespace blink 303 } // namespace blink
293 304
294 #endif // DocumentLoader_h 305 #endif // DocumentLoader_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698