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

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 Created 3 years, 11 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
« 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
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 const AtomicString& mimeType, 196 const AtomicString& mimeType,
194 const AtomicString& encoding, 197 const AtomicString& encoding,
195 bool dispatchWindowObjectAvailable, 198 bool dispatchWindowObjectAvailable,
196 ParserSynchronizationPolicy, 199 ParserSynchronizationPolicy,
197 const KURL& overridingURL = KURL()); 200 const KURL& overridingURL = KURL());
198 201
199 void ensureWriter(const AtomicString& mimeType, 202 void ensureWriter(const AtomicString& mimeType,
200 const KURL& overridingURL = KURL()); 203 const KURL& overridingURL = KURL());
201 void endWriting(); 204 void endWriting();
202 205
203 FrameLoader* frameLoader() const; 206 // Use these method only where it's guaranteed that |m_frame| hasn't been
207 // cleared.
208 FrameLoader& frameLoader() const;
209 FrameLoaderClient& frameLoaderClient() const;
204 210
205 void commitIfReady(); 211 void commitIfReady();
206 void commitData(const char* bytes, size_t length); 212 void commitData(const char* bytes, size_t length);
207 void clearMainResourceHandle(); 213 void clearMainResourceHandle();
208 214
209 bool maybeCreateArchive(); 215 bool maybeCreateArchive();
210 216
211 void finishedLoading(double finishTime); 217 void finishedLoading(double finishTime);
212 void cancelLoadAfterCSPDenied(const ResourceResponse&); 218 void cancelLoadAfterCSPDenied(const ResourceResponse&);
219
220 // RawResourceClient implementation
213 bool redirectReceived(Resource*, 221 bool redirectReceived(Resource*,
214 const ResourceRequest&, 222 const ResourceRequest&,
215 const ResourceResponse&) final; 223 const ResourceResponse&) final;
216 void responseReceived(Resource*, 224 void responseReceived(Resource*,
217 const ResourceResponse&, 225 const ResourceResponse&,
218 std::unique_ptr<WebDataConsumerHandle>) final; 226 std::unique_ptr<WebDataConsumerHandle>) final;
219 void dataReceived(Resource*, const char* data, size_t length) final; 227 void dataReceived(Resource*, const char* data, size_t length) final;
220 void processData(const char* data, size_t length); 228
229 // ResourceClient implementation
221 void notifyFinished(Resource*) final; 230 void notifyFinished(Resource*) final;
222 String debugName() const override { return "DocumentLoader"; } 231 String debugName() const override { return "DocumentLoader"; }
223 232
233 void processData(const char* data, size_t length);
234
224 bool maybeLoadEmpty(); 235 bool maybeLoadEmpty();
225 236
226 bool isRedirectAfterPost(const ResourceRequest&, const ResourceResponse&); 237 bool isRedirectAfterPost(const ResourceRequest&, const ResourceResponse&);
227 238
228 bool shouldContinueForResponse() const; 239 bool shouldContinueForResponse() const;
229 240
230 Member<LocalFrame> m_frame; 241 Member<LocalFrame> m_frame;
231 Member<ResourceFetcher> m_fetcher; 242 Member<ResourceFetcher> m_fetcher;
232 std::unique_ptr<WebDocumentSubresourceFilter> m_subresourceFilter; 243 std::unique_ptr<WebDocumentSubresourceFilter> m_subresourceFilter;
233 244
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // Used to protect against reentrancy into dataReceived(). 289 // Used to protect against reentrancy into dataReceived().
279 bool m_inDataReceived; 290 bool m_inDataReceived;
280 RefPtr<SharedBuffer> m_dataBuffer; 291 RefPtr<SharedBuffer> m_dataBuffer;
281 }; 292 };
282 293
283 DECLARE_WEAK_IDENTIFIER_MAP(DocumentLoader); 294 DECLARE_WEAK_IDENTIFIER_MAP(DocumentLoader);
284 295
285 } // namespace blink 296 } // namespace blink
286 297
287 #endif // DocumentLoader_h 298 #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