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

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

Issue 2715803004: Introduce ThreadableLoadingContext: make threaded loading code one step away from Document (Closed)
Patch Set: . Created 3 years, 9 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) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013, Intel Corporation 3 * Copyright (C) 2013, Intel Corporation
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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "wtf/text/WTFString.h" 45 #include "wtf/text/WTFString.h"
46 #include <memory> 46 #include <memory>
47 47
48 namespace blink { 48 namespace blink {
49 49
50 class Document; 50 class Document;
51 class KURL; 51 class KURL;
52 class ResourceRequest; 52 class ResourceRequest;
53 class SecurityOrigin; 53 class SecurityOrigin;
54 class ThreadableLoaderClient; 54 class ThreadableLoaderClient;
55 class ThreadableLoadingContext;
55 56
56 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, 57 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader,
57 private RawResourceClient { 58 private RawResourceClient {
58 USING_GARBAGE_COLLECTED_MIXIN(DocumentThreadableLoader); 59 USING_GARBAGE_COLLECTED_MIXIN(DocumentThreadableLoader);
59 60
60 public: 61 public:
61 static void loadResourceSynchronously(Document&, 62 static void loadResourceSynchronously(Document&,
62 const ResourceRequest&, 63 const ResourceRequest&,
63 ThreadableLoaderClient&, 64 ThreadableLoaderClient&,
64 const ThreadableLoaderOptions&, 65 const ThreadableLoaderOptions&,
65 const ResourceLoaderOptions&); 66 const ResourceLoaderOptions&);
66 static DocumentThreadableLoader* create(Document&, 67 static DocumentThreadableLoader* create(ThreadableLoadingContext&,
67 ThreadableLoaderClient*, 68 ThreadableLoaderClient*,
68 const ThreadableLoaderOptions&, 69 const ThreadableLoaderOptions&,
69 const ResourceLoaderOptions&); 70 const ResourceLoaderOptions&);
70 ~DocumentThreadableLoader() override; 71 ~DocumentThreadableLoader() override;
71 72
72 void start(const ResourceRequest&) override; 73 void start(const ResourceRequest&) override;
73 74
74 void overrideTimeout(unsigned long timeout) override; 75 void overrideTimeout(unsigned long timeout) override;
75 76
76 void cancel() override; 77 void cancel() override;
77 void setDefersLoading(bool); 78 void setDefersLoading(bool);
78 79
79 DECLARE_TRACE(); 80 DECLARE_TRACE();
80 81
81 private: 82 private:
82 enum BlockingBehavior { LoadSynchronously, LoadAsynchronously }; 83 enum BlockingBehavior { LoadSynchronously, LoadAsynchronously };
83 84
84 DocumentThreadableLoader(Document&, 85 DocumentThreadableLoader(ThreadableLoadingContext&,
85 ThreadableLoaderClient*, 86 ThreadableLoaderClient*,
86 BlockingBehavior, 87 BlockingBehavior,
87 const ThreadableLoaderOptions&, 88 const ThreadableLoaderOptions&,
88 const ResourceLoaderOptions&); 89 const ResourceLoaderOptions&);
89 90
90 void clear(); 91 void clear();
91 92
92 // ResourceClient 93 // ResourceClient
93 void notifyFinished(Resource*) override; 94 void notifyFinished(Resource*) override;
94 95
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 if (newResource) { 176 if (newResource) {
176 m_resource = newResource; 177 m_resource = newResource;
177 m_checker.willAddClient(); 178 m_checker.willAddClient();
178 m_resource->addClient(this); 179 m_resource->addClient(this);
179 } 180 }
180 } 181 }
181 Member<RawResource> m_resource; 182 Member<RawResource> m_resource;
182 // End of ResourceOwner re-implementation, see above. 183 // End of ResourceOwner re-implementation, see above.
183 184
184 const SecurityOrigin* getSecurityOrigin() const; 185 const SecurityOrigin* getSecurityOrigin() const;
185 Document& document() const; 186
187 // TODO(kinuko): Remove dependency to document.
188 Document* document() const;
186 189
187 ThreadableLoaderClient* m_client; 190 ThreadableLoaderClient* m_client;
188 Member<Document> m_document; 191 Member<ThreadableLoadingContext> m_loadingContext;
189 192
190 const ThreadableLoaderOptions m_options; 193 const ThreadableLoaderOptions m_options;
191 // Some items may be overridden by m_forceDoNotAllowStoredCredentials and 194 // Some items may be overridden by m_forceDoNotAllowStoredCredentials and
192 // m_securityOrigin. In such a case, build a ResourceLoaderOptions with 195 // m_securityOrigin. In such a case, build a ResourceLoaderOptions with
193 // up-to-date values from them and this variable, and use it. 196 // up-to-date values from them and this variable, and use it.
194 const ResourceLoaderOptions m_resourceLoaderOptions; 197 const ResourceLoaderOptions m_resourceLoaderOptions;
195 198
196 bool m_forceDoNotAllowStoredCredentials; 199 bool m_forceDoNotAllowStoredCredentials;
197 RefPtr<SecurityOrigin> m_securityOrigin; 200 RefPtr<SecurityOrigin> m_securityOrigin;
198 201
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // used to populate the HTTP Referer header when following the redirect. 239 // used to populate the HTTP Referer header when following the redirect.
237 bool m_overrideReferrer; 240 bool m_overrideReferrer;
238 Referrer m_referrerAfterRedirect; 241 Referrer m_referrerAfterRedirect;
239 242
240 RawResourceClientStateChecker m_checker; 243 RawResourceClientStateChecker m_checker;
241 }; 244 };
242 245
243 } // namespace blink 246 } // namespace blink
244 247
245 #endif // DocumentThreadableLoader_h 248 #endif // DocumentThreadableLoader_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/BUILD.gn ('k') | third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698